Add config option to provide names for lstinline-like commands#126
Add config option to provide names for lstinline-like commands#126jprotze wants to merge 4 commits intoftilmann:masterfrom
Conversation
latexdiff
Outdated
| # mark added verbatim commands | ||
| $addblock =~ s/\\DIFverb/\\DIFDIFaddverb/g; | ||
| $addblock =~ s/\\DIFlstinline/\\DIFDIFaddlstinline/g; | ||
| 1 while $addblock =~ s/((?<!\\)%.*)\\DIF($LSTINLINEENV)/$1\\DIFDIFadd$2/mg; |
There was a problem hiding this comment.
I probably overlook something simple but why did you add the line 1 while $addblock ... .
As far as I can tell without testing this will change \DIFlstinline (and variants) in comments into \DIFDIFaddlstinline.
But the following line makes this change everywhere (including comments).
There was a problem hiding this comment.
You are right, I missed to remove this line. Commented inline-code is handled at 3 other places now.
ftilmann
left a comment
There was a problem hiding this comment.
This looks good, if multiline \lstinline is indeed not allowed (I am not so familar with this package). There is one line I have a question about.
Also, is it really necessary to have a special treatment for lstinline commands in comments?
I would have thought that no harm is done if in comments the hashing is done and then later inserted again.
|
If the comment changed, I have seen that in some cases the color-highlighting was added. With the first part of this replacement being in comment, the result would not compile. I'm checking, whether L3088 is sufficient to catch all cases. |
|
For the restriction of lstinline to single line, I could not find something in the documentation. But my latex compiler complains with |
|
The full pull request patched latexdiff failed with testsuite/verbatim-{old,new}.tex so I cannot accept as is. |
|
We found that lstinline has poor performance and triples compile time for our pdf compared to verb or simply a command containing \detokenize. The latter is also compatible with \DIFdel. Nevertheless, I could find the bug and can add the changes if this is still of interest. |
This PR adds the possibility to configure customized lstinline-like commands/shortcuts.
For something like:
\newcommand\myJSsnippet{\lstinline[style=JavaScript,breaklines=true]}You would add this to the config:
LSTINLINEENV=myJSsnippet