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

Feature request: more universal and robust comments deletion? #8

Open
refraction-ray opened this issue Jun 16, 2019 · 2 comments
Open
Labels
bug Something isn't working enhancement New feature or request

Comments

@refraction-ray
Copy link

This example is helpful considering various scenarios when deleting comments in tex files. And I show the example below:

\begin{document}
hello world
% comment after %
20\% just a percent 
new line \\%still a comment
\begin{comment}
comment even without percent % haha
\end{comment}
\begin{verbatim}
% not a comment though with %
\end{verbatim}
\end{document}
after document

In current version of this script:

  1. No support for verbatim package. Since every char within verbatim env is not comment even with %.

  2. Cannot delete comment directly attached after the newline \\, it will recognize \\% as \ \% where \% is just a percent symbol instead of the beginning of comment.

  3. Maybe it is also relevant to delete everything below \end{document} since they would never be involved with the file.

1, 3 are more like feature requests while I think it would be better to fix 2.

@jponttuset jponttuset added bug Something isn't working enhancement New feature or request labels Jun 17, 2019
@jponttuset
Copy link
Collaborator

Hi @refraction-ray
Thanks for the example and for pointing out current limitations! I'll mark this issue as 'enhancement' for 1 and 3, bug for 2.
In any case, I always recommend quickly checking the output code to see if some comment has been missed.

@theRealSuperMario
Copy link
Contributor

You could have a look at #31, which introduces a general regex replacement pipeline. You could use this feature to build a multi-line regular expression for your comment string and replace it with an empty string ("").

pattern : '(:?\\begin{verbatim}\s*.*\s*\\end{verbatim})'
insertion: ''

Of course, don't nail me down on that regex pattern which I just improvised, but I think you get the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants