fchauvel / flap

Flattening LaTeX projects
https://fchauvel.github.io/flap
GNU General Public License v3.0
17 stars 2 forks source link

handling of comments in \verb{} #6

Closed gro1729 closed 7 years ago

gro1729 commented 8 years ago

Hello, inside a fragile slide, I use des "\verb"-Environment

           \begin{center}
              \verb|\| \verb|{| \verb|}| \verb|%| \verb|~| \verb|&|
              \verb|#| \verb|$| \verb|^| \verb|_|
           \end{center}

"flap" translates to

           \begin{center}
              \verb|\| \verb|{| \verb|}| \verb|
              \verb|#| \verb|$| \verb|^| \verb|_|
           \end{center}

I think, this can be considered to be a "featured bug"

fchauvel commented 8 years ago

I think we reach here the limits of the current design, which is based on regular expressions. To handle this, I believe one has to build a proper TeX engine. Along the same lines, I guess that a comment within a verbatim environment would be stripped out as well.

gro1729 commented 8 years ago

I agree. It is a featured bug. After these simple manuell changes the merged - files compiles. Great, thanks a lot.

Am 31.08.2015 13:33, schrieb Franck Chauvel:

I think we reach here the limits of the current design, which is based on regular expressions. To handle this, I believe one has to build a proper TeX engine. Along the same lines, I guess that a comment within a |verbatim| environment would be stripped out as well.

— Reply to this email directly or view it on GitHub https://github.com/fchauvel/flap/issues/6#issuecomment-136342224.

gro1729 commented 8 years ago

As a remark, only because you mentioned it. There is another tool, called "plasTeX". As I have understood, this tool works on basis of a \LaTeX\ -Parser, implemented in Python

gro1729 commented 8 years ago

With your last modifications, this issue probably can be closed

fchauvel commented 8 years ago

Thanks for the comment, I had forgotten about this one, but I will check whether it does solve this issue at the same time.

fchauvel commented 8 years ago

It works using the 'lookbehind' feature of Python regular expressions. So it detects that % is preceded by a '|' and in turn that it is therefore not a comment. Yet, this looks to me more like a quick and dirty fix. Feel free to close this issue if it works in your case.