Skip to content

Commit

Permalink
Support escaped percent sign (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
glugg23 authored Dec 2, 2020
1 parent e17802e commit 46203f2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions detex.l
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ VERBSYMBOL =|\\leq|\\geq|\\in|>|<|\\subseteq|\subseteq|\\subset|\\supset|\\sim|\

/* escaping commands */
<Normal>"\\slash" putchar('/');
<Normal>"\\%" putchar('%');

<Normal>\\(aa|AA|ae|AE|oe|OE|ss)[ \t]*[ \t\n}] /* handle ligatures */ {(void)printf("%.2s", yytext+1);}
<Normal>\\[OoijLl][ \t]*[ \t\n}] {(void)printf("%.1s", yytext+1);}
Expand Down
1 change: 1 addition & 0 deletions test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
assert_produces_correct_output('words.tex', 'words-correct.txt', '-w -l');
assert_produces_correct_output('nouns.tex', 'nouns-correct.txt', '-r');
assert_produces_correct_output('with-srcloc.tex', 'with-srcloc-correct.txt', '-1');
assert_produces_correct_output('comments.tex', 'comments-correct.txt');

run_for_wrong_input("non-existent-file");
run_for_wrong_input("non-existent-file.tex");
Expand Down
2 changes: 2 additions & 0 deletions test/comments-correct.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

This 100% has a percent sign and will be included.
5 changes: 5 additions & 0 deletions test/comments.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
\documentclass[draft]{book}
\begin{document}
%This is a comment and will not be included.
This 100\% has a percent sign and will be included.
\end{document}

0 comments on commit 46203f2

Please sign in to comment.