Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for LaTeX \verb|...| command in pattern matching #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aphcity
Copy link

@Aphcity Aphcity commented Feb 9, 2025

This pull request introduces changes to support verbatim patterns in LaTeX files. The most important changes include adding the VERB constant to the regexes, updating the Pattern struct to track verbatim patterns, and modifying the logic to handle verbatim patterns in the get_verbatim_diff function.

Changes to support verbatim patterns:

  • src/regexes.rs: Added the VERB constant to match LaTeX \verb|...| patterns and updated the SPLITTING array to include the verbatim pattern. Also added a new regex RE_VERB to capture content inside \verb|...|. [1] [2]
  • src/format.rs: Updated the Pattern struct to include a contains_verbatim field and modified the impl Pattern block to set this field based on the presence of verbatim patterns. [1] [2] [3]
  • src/verbatim.rs: Modified the get_verbatim_diff function to return 1 if the pattern contains verbatim patterns.

Test updates:

  • tests/verbatim/source/verbatim.tex and tests/verbatim/target/verbatim.tex: Added test cases for verbatim patterns to ensure the changes work as expected.

Result:

image

Should close issue #83

@Aphcity
Copy link
Author

Aphcity commented Feb 9, 2025

Should close #83

@WGUNDERWOOD
Copy link
Owner

Thanks very much for this PR! It seems that some tests are failing at the moment -- might you be able to look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants