summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschrieveslaach <schrieveslaach@online.de>2017-05-06 15:09:29 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-05-06 15:09:29 +0200
commitddf2524477e2a59b36fd37f7e5957ebb3b37c265 (patch)
treee6b82fea51097749d2c4bd78b232bec4d194cd91
parentf4220001979b4b640a31231673833e0ed1176bce (diff)
Fix keyval funtion: pandoc did not parse options in braces correctly.… (#3642)
* Fix keyval funtion: pandoc did not parse options in braces correctly. Additionally, dot, dash, and colon were no valid characters * Add | as possible option value * Improved code
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs2
-rw-r--r--test/command/lstlisting.md25
2 files changed, 26 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index b88b6eae4..1ce92a4a2 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -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 <|> oneOf ".:-|\\"))
skipMany spaceChar
optional (char ',')
skipMany spaceChar
diff --git a/test/command/lstlisting.md b/test/command/lstlisting.md
new file mode 100644
index 000000000..d928cc702
--- /dev/null
+++ b/test/command/lstlisting.md
@@ -0,0 +1,25 @@
+```
+% pandoc -f latex -t native
+\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}
+^D
+[CodeBlock ("lst:Hello-World",["java"],[("language","Java"),("caption","Java Example"),("label","lst:Hello-World")]) "public class World {\n public static void main(String[] args) {\n System.out.println(\"Hello World\");\n }\n}"]
+```
+
+```
+% pandoc -f latex -t native
+\begin{lstlisting}[language=Java, escapechar=|, caption={Java Example}, label=lst:Hello-World]
+public class World {
+ public static void main(String[] args) {
+ System.out.println("Hello World");
+ }
+}
+\end{lstlisting}
+^D
+[CodeBlock ("lst:Hello-World",["java"],[("language","Java"),("escapechar","|"),("caption","Java Example"),("label","lst:Hello-World")]) "public class World {\n public static void main(String[] args) {\n System.out.println(\"Hello World\");\n }\n}"]
+```