aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-17 15:15:56 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-17 15:15:56 -0700
commitb371e83d7362c6ffc6e4dd98b7288ddd7f23f46a (patch)
treeba6588d2e7a1fdfa6bfedefe3d6dbde0c9f4140a /src/Text
parent59272e4d99668ddc48f07eb761979c2f49cf76d5 (diff)
downloadpandoc-b371e83d7362c6ffc6e4dd98b7288ddd7f23f46a.tar.gz
Highlighting: Let .numberLines work even if no language given.
Closes #1287, jgm/highlighting-kate#40.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Highlighting.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs
index 2e7a9f648..7f975d4c6 100644
--- a/src/Text/Pandoc/Highlighting.hs
+++ b/src/Text/Pandoc/Highlighting.hs
@@ -74,7 +74,12 @@ highlight formatter (_, classes, keyvals) rawCode =
["number","numberLines", "number-lines"]) classes }
lcclasses = map (map toLower) classes
in case find (`elem` lcLanguages) lcclasses of
- Nothing -> Nothing
+ Nothing
+ | numberLines fmtOpts -> Just
+ $ formatter fmtOpts{ codeClasses = [],
+ containerClasses = classes }
+ $ map (\ln -> [(NormalTok, ln)]) $ lines rawCode
+ | otherwise -> Nothing
Just language -> Just
$ formatter fmtOpts{ codeClasses = [language],
containerClasses = classes }