Support substitution of identifiers #64
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds
identifiers
option toget_latex
andwith_latex
.CC: @cccntu @alecglen
It works like:
![無題](https://user-images.githubusercontent.com/1023695/197580266-8c1b66aa-8a86-4a76-a4b3-7dd402a739ad.png)
At this point, this feature does not support:
foo.bar
) because it requires recursive analysis and another syntax of substitution rules.Details
identifiers
option takesdict[str, str]
, in which each key/value represents a substitution rule of identifier names (must follow the Python's naming convention of identifiers). The rule affects against (1) function names, (2) function arguments, and (3) any identifiers in the expression.The process is implemented as a
NodeTransformer
and is applied among AST parsing and LaTeX codegen.References
Blocked by