pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

minted: Bug in mintinline with unbalanced braces #42

Closed QuLogic closed 5 years ago

QuLogic commented 5 years ago

Consider the following text:

C uses `{` and `}` to delimit scopes.

which converts to the following LaTeX:

C uses \mintinline[]{text}{{} and \mintinline[]{text}{}} to delimit scopes.

For \mintinline, if using braces for the final parameter, it extends to balanced braces. The resulting PDF looks something like:

C uses {} and \mintinline[]{text}{} to delimit scopes.

For these cases, \mintinline works like \verb in that it can accept almost any other character as a delimiter, e.g., \mintinline[]{text}|{| and \mintinline[]{text}|}| would work in this case. I opened a PR to the Python version of this filter nick-ulle/pandoc-minted#8 just before I found this one. Unfortunately, I'm not as familiar with Lua so I can't do the same here.

cc @svenevs

QuLogic commented 5 years ago

I took a stab at fixing this in the above PR, though I'm not sure if it's the most idiomatic Lua code.