mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 10:16:32 +00:00
Changed all writers to handle new Math block element.
This allows TeX element to be handled differently (and in many output formats, simply ignored). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1118 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
@@ -271,6 +271,7 @@ inlineToConTeXt EmDash = return $ text "---"
|
||||
inlineToConTeXt EnDash = return $ text "--"
|
||||
inlineToConTeXt Ellipses = return $ text "\\ldots{}"
|
||||
inlineToConTeXt (Str str) = return $ text $ stringToConTeXt str
|
||||
inlineToConTeXt (Math str) = return $ char '$' <> text str <> char '$'
|
||||
inlineToConTeXt (TeX str) = return $ text str
|
||||
inlineToConTeXt (HtmlInline str) = return empty
|
||||
inlineToConTeXt (LineBreak) = return $ text "\\crlf\n"
|
||||
|
||||
@@ -274,7 +274,8 @@ inlineToDocbook opts EmDash = text "—"
|
||||
inlineToDocbook opts EnDash = text "–"
|
||||
inlineToDocbook opts (Code str) =
|
||||
inTagsSimple "literal" $ text (escapeStringForXML str)
|
||||
inlineToDocbook opts (TeX str) = inlineToDocbook opts (Code str)
|
||||
inlineToDocbook opts (Math str) = inlineToDocbook opts (Code str)
|
||||
inlineToDocbook opts (TeX str) = empty
|
||||
inlineToDocbook opts (HtmlInline str) = empty
|
||||
inlineToDocbook opts LineBreak = text $ "<literallayout></literallayout>"
|
||||
inlineToDocbook opts Space = char ' '
|
||||
|
||||
@@ -230,6 +230,7 @@ inlineListToIdentifier (x:xs) =
|
||||
Apostrophe -> ""
|
||||
Ellipses -> ""
|
||||
LineBreak -> "-"
|
||||
Math _ -> ""
|
||||
TeX _ -> ""
|
||||
HtmlInline _ -> ""
|
||||
Link lst _ -> inlineListToIdentifier lst
|
||||
@@ -396,9 +397,11 @@ inlineToHtml opts inline =
|
||||
primHtmlChar "rdquo")
|
||||
in do contents <- inlineListToHtml opts lst
|
||||
return $ leftQuote +++ contents +++ rightQuote
|
||||
(TeX str) -> (if writerUseASCIIMathML opts
|
||||
(Math str) -> (if writerUseASCIIMathML opts
|
||||
then modify (\st -> st {stMath = True})
|
||||
else return ()) >> return (stringToHtml str)
|
||||
else return ()) >>
|
||||
return (stringToHtml ("$" ++ str ++ "$"))
|
||||
(TeX str) -> return noHtml
|
||||
(HtmlInline str) -> return $ primHtml str
|
||||
(Link [Code str] (src,tit)) | "mailto:" `isPrefixOf` src ->
|
||||
return $ obfuscateLink opts str src
|
||||
|
||||
@@ -290,6 +290,7 @@ inlineToLaTeX EmDash = return $ text "---"
|
||||
inlineToLaTeX EnDash = return $ text "--"
|
||||
inlineToLaTeX Ellipses = return $ text "\\ldots{}"
|
||||
inlineToLaTeX (Str str) = return $ text $ stringToLaTeX str
|
||||
inlineToLaTeX (Math str) = return $ char '$' <> text str <> char '$'
|
||||
inlineToLaTeX (TeX str) = return $ text str
|
||||
inlineToLaTeX (HtmlInline str) = return empty
|
||||
inlineToLaTeX (LineBreak) = return $ text "\\\\"
|
||||
|
||||
@@ -268,7 +268,8 @@ inlineToMan opts Ellipses = return $ text "\\&..."
|
||||
inlineToMan opts (Code str) =
|
||||
return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"
|
||||
inlineToMan opts (Str str) = return $ text $ escapeString str
|
||||
inlineToMan opts (TeX str) = return $ text $ escapeCode str
|
||||
inlineToMan opts (Math str) = return $ text $ escapeCode str
|
||||
inlineToMan opts (TeX str) = return empty
|
||||
inlineToMan opts (HtmlInline str) = return $ text $ escapeCode str
|
||||
inlineToMan opts (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"
|
||||
inlineToMan opts Space = return $ char ' '
|
||||
|
||||
@@ -337,6 +337,7 @@ inlineToMarkdown opts (Code str) =
|
||||
spacer = if (longest == 0) then "" else " " in
|
||||
return $ text (marker ++ spacer ++ str ++ spacer ++ marker)
|
||||
inlineToMarkdown opts (Str str) = return $ text $ escapeString str
|
||||
inlineToMarkdown opts (Math str) = return $ char '$' <> text str <> char '$'
|
||||
inlineToMarkdown opts (TeX str) = return $ text str
|
||||
inlineToMarkdown opts (HtmlInline str) = return $ text str
|
||||
inlineToMarkdown opts (LineBreak) = return $ text " \n"
|
||||
|
||||
@@ -151,9 +151,10 @@ blockToRST :: WriterOptions -- ^ Options
|
||||
-> State WriterState Doc
|
||||
blockToRST opts Null = return empty
|
||||
blockToRST opts (Plain inlines) = wrappedRST opts inlines
|
||||
blockToRST opts (Para [TeX str]) =
|
||||
blockToRST opts (Para [Math str]) =
|
||||
let str' = if "\n" `isSuffixOf` str then str ++ "\n" else str ++ "\n\n" in
|
||||
return $ hang (text "\n.. raw:: latex\n") 3 $ vcat $ map text (lines str')
|
||||
return $ hang (text "\n.. raw:: latex\n") 3 $ text "\\[" <>
|
||||
(vcat $ map text (lines str')) <> text "\\]"
|
||||
blockToRST opts (Para inlines) = do
|
||||
contents <- wrappedRST opts inlines
|
||||
return $ contents <> text "\n"
|
||||
@@ -285,7 +286,8 @@ inlineToRST opts Apostrophe = return $ char '\''
|
||||
inlineToRST opts Ellipses = return $ text "..."
|
||||
inlineToRST opts (Code str) = return $ text $ "``" ++ str ++ "``"
|
||||
inlineToRST opts (Str str) = return $ text $ escapeString str
|
||||
inlineToRST opts (TeX str) = return $ text str
|
||||
inlineToRST opts (Math str) = return $ char '$' <> text str <> char '$'
|
||||
inlineToRST opts (TeX str) = return empty
|
||||
inlineToRST opts (HtmlInline str) = return empty
|
||||
inlineToRST opts (LineBreak) = return $ char ' ' -- RST doesn't have linebreaks
|
||||
inlineToRST opts Space = return $ char ' '
|
||||
|
||||
@@ -272,7 +272,8 @@ inlineToRTF EmDash = "\\u8212-"
|
||||
inlineToRTF EnDash = "\\u8211-"
|
||||
inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "} "
|
||||
inlineToRTF (Str str) = stringToRTF str
|
||||
inlineToRTF (TeX str) = latexToRTF str
|
||||
inlineToRTF (Math str) = latexToRTF str
|
||||
inlineToRTF (TeX str) = ""
|
||||
inlineToRTF (HtmlInline str) = ""
|
||||
inlineToRTF (LineBreak) = "\\line "
|
||||
inlineToRTF Space = " "
|
||||
|
||||
Reference in New Issue
Block a user