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

Fix keyval funtion: pandoc did not parse options in braces correctly.… #3642

Merged
merged 3 commits into from
May 6, 2017
Merged

Fix keyval funtion: pandoc did not parse options in braces correctly.… #3642

merged 3 commits into from
May 6, 2017

Conversation

schrieveslaach
Copy link
Contributor

… Additionally, dot, dash, and colon were no valid characters. Therefore, options, for example, of the lstlsiting won't be parsed correctly. See following LaTeX code

\begin{lstlisting}[language=Java, caption={Java Example}, label=lst:Hello-World]
public class World {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
\end{lstlisting}

The resulting CodeBlock did not contain label and caption as attributes.

This PR fixes this issue.

@@ -1095,7 +1095,7 @@ parseListingsOptions options =
keyval :: PandocMonad m => LP m (String, String)
keyval = try $ do
key <- many1 alphaNum
val <- option "" $ char '=' >> many1 (alphaNum <|> char '.' <|> char '\\')
val <- option "" $ char '=' >> (braced) <|> (many1 (alphaNum <|> char '.' <|> char ':' <|> char '-' <|> char '\\'))
skipMany spaceChar
Copy link
Owner

@jgm jgm May 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More idiomatic:

  val <- option "" $ char '=' >> braced <|> (many1 (alphaNum <|> oneOf ".:-|\\"))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jgm jgm merged commit ddf2524 into jgm:master May 6, 2017
@jgm
Copy link
Owner

jgm commented May 6, 2017

Thanks!

@schrieveslaach schrieveslaach deleted the fix-keyval-function branch May 6, 2017 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants