aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-03-07 19:11:03 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-03-07 19:11:03 +0300
commitf8608b418afcb1cfe8ccb55abf31f33f7bc7efb3 (patch)
treee8b84353bf541bf079623f5e944449b77c6ef551 /src/Text/Pandoc/Writers
parentf8e255053de09786c6c251e38387663750ddd3ac (diff)
downloadpandoc-f8608b418afcb1cfe8ccb55abf31f33f7bc7efb3.tar.gz
Muse writer: expand Cite before list normalization
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 7a9bc8130..156958ab7 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -292,11 +292,16 @@ conditionalEscapeString s =
then escapeString s
else s
--- Expand Math before normalizing inline list
+-- Expand Math and Cite before normalizing inline list
preprocessInlineList :: PandocMonad m
=> [Inline]
-> m [Inline]
preprocessInlineList (Math t str:xs) = (++) <$> texMathToInlines t str <*> preprocessInlineList xs
+-- Amusewiki does not support <cite> tag,
+-- and Emacs Muse citation support is limited
+-- (https://www.gnu.org/software/emacs-muse/manual/html_node/Citations.html#Citation)
+-- so just fallback to expanding inlines.
+preprocessInlineList (Cite _ lst:xs) = (lst ++) <$> preprocessInlineList xs
preprocessInlineList (x:xs) = (x:) <$> preprocessInlineList xs
preprocessInlineList [] = return []
@@ -371,11 +376,8 @@ inlineToMuse (Quoted SingleQuote lst) = do
inlineToMuse (Quoted DoubleQuote lst) = do
contents <- inlineListToMuse lst
return $ "“" <> contents <> "”"
--- Amusewiki does not support <cite> tag,
--- and Emacs Muse citation support is limited
--- (https://www.gnu.org/software/emacs-muse/manual/html_node/Citations.html#Citation)
--- so just fallback to expanding inlines.
-inlineToMuse (Cite _ lst) = inlineListToMuse lst
+inlineToMuse (Cite {}) =
+ fail "Citations should be expanded before normalization"
inlineToMuse (Code _ str) = return $
"<code>" <> text (substitute "</code>" "<</code><code>/code>" str) <> "</code>"
inlineToMuse Math{} =