mp4096 / indentex

An indentation-based superset of LaTeX
MIT License
9 stars 2 forks source link

Unwanted transpilation within listings #45

Closed mp4096 closed 5 years ago

mp4096 commented 7 years ago

So I've just encountered this bug.

Consider the following Indentex code with the following listing:

\begin{lstlisting}
# TODO: Code stuff
def spam():
    return 0
\end{lstlisting}

I want it to be left unchanged. However, the Python comment gets transpiled:

\begin{lstlisting}
\TODO{Code stuff}
def spam():
    return 0
\end{lstlisting}

One obvious workaround would be to import listings from files instead of writing code directly in the Indentex document:

\lstinputlisting{./sources/spam.py}

Otherwise, I think there's just no solution at all for this problem. We do promise that Indentex is a strict superset of LaTeX, but we just cannot promise it's a strict superset of all other stuff that can come up within verbatim or listing environments. :crying_cat_face:

syxolk commented 7 years ago

Can we introduce our own verbatim environment? Something like #! lstinputlisting

mp4096 commented 7 years ago

Hm, we probably could, but then again we cannot exclude cases when the user wants to use the plain LaTeX environment. And I really do not want to force anyone use an Indentex command instead of plain LaTeX, plain LaTeX should always be a possibility.

mp4096 commented 7 years ago

Ugh, re-reading the comment I just realise I sound like Trump, with all that repetitions. Sad!

syxolk commented 7 years ago

We gonna introduce this environment and the users gonna pay for it. It's gonna be a yuge success.

But I see your point that it doesn't solve the superset problem.

Another idea would be to escape the number sign like this: ## Todo:. Identex will replace any occurrence of two consecutive number signs with one.

On Wed, Aug 30, 2017, 21:53 Mikhail Pak notifications@github.com wrote:

Ugh, re-reading the comment I just realise I sound like Trump, with all that repetitions. Sad!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mp4096/indentex/issues/45#issuecomment-326116100, or mute the thread https://github.com/notifications/unsubscribe-auth/AGW3T4AO97kA3HfF8yo5ctKuLiS2fjIOks5sdcu6gaJpZM4PF67S .

mp4096 commented 7 years ago

I'm pretty sure there are people out there who use ## TODO: in their Python code. Hey, Yelp had an all-hardtabs Python codebase :scream:!

Also, see obligatory xkcd reference.

I think it's a real no-fix.

syxolk commented 7 years ago

Oh, and my first idea breaks included bash scripts with a shebang: #!/bin/bash

On Thu, Aug 31, 2017, 08:31 Mikhail Pak notifications@github.com wrote:

I'm pretty sure there are people out there who use ## TODO: in their Python code. Hey, Yelp had an all-hardtabs Python codebase https://eev.ee/blog/2016/06/04/converting-a-git-repo-from-tabs-to-spaces/ 😱!

Also, see obligatory xkcd reference https://xkcd.com/1172/.

I think it's a real no-fix.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mp4096/indentex/issues/45#issuecomment-326214486, or mute the thread https://github.com/notifications/unsubscribe-auth/AGW3Tx7_o3zANcE90MUbHUvBVy8lsrCtks5sdmE-gaJpZM4PF67S .

mp4096 commented 7 years ago

I recall a recent saying by a certain statesman:

Now, I have to tell you, it's an unbelievably complex subject. Nobody knew health care could be so complicated

mp4096 commented 5 years ago

Closing this issue as it's a defect-by-design. ¯\_(ツ)_/¯