diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-07-15 23:26:06 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-07-15 23:26:06 +0000 |
commit | dbdd37acaa8ecacfae7925dbc7018f4cf444f41f (patch) | |
tree | d56f08a6e7cf99055595e1a75f7804a30c0713e6 /Text | |
parent | 2637e3595afef05cbd67a69b8d79682ebc7a716a (diff) | |
download | pandoc-dbdd37acaa8ecacfae7925dbc7018f4cf444f41f.tar.gz |
More work on smallcaps support.
+ Added to refsMatch in Shared.
+ Supported all writers to the extent possible.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1328 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text')
-rw-r--r-- | Text/Pandoc/Definition.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Shared.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/ConTeXt.hs | 4 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Docbook.hs | 4 | ||||
-rw-r--r-- | Text/Pandoc/Writers/LaTeX.hs | 3 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Man.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Markdown.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/RST.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/RTF.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Texinfo.hs | 6 |
10 files changed, 19 insertions, 10 deletions
diff --git a/Text/Pandoc/Definition.hs b/Text/Pandoc/Definition.hs index e17b1b788..0a14705f2 100644 --- a/Text/Pandoc/Definition.hs +++ b/Text/Pandoc/Definition.hs @@ -103,8 +103,8 @@ data Inline | Strikeout [Inline] -- ^ Strikeout text (list of inlines) | Superscript [Inline] -- ^ Superscripted text (list of inlines) | Subscript [Inline] -- ^ Subscripted text (list of inlines) - | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines) | SmallCaps [Inline] -- ^ Small caps text (list of inlines) + | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines) | Code String -- ^ Inline code (literal) | Space -- ^ Inter-word space | EmDash -- ^ Em dash diff --git a/Text/Pandoc/Shared.hs b/Text/Pandoc/Shared.hs index fa3d86770..05289d6a6 100644 --- a/Text/Pandoc/Shared.hs +++ b/Text/Pandoc/Shared.hs @@ -690,6 +690,8 @@ refsMatch ((Superscript x):restx) ((Superscript y):resty) = refsMatch x y && refsMatch restx resty refsMatch ((Subscript x):restx) ((Subscript y):resty) = refsMatch x y && refsMatch restx resty +refsMatch ((SmallCaps x):restx) ((SmallCaps y):resty) = + refsMatch x y && refsMatch restx resty refsMatch ((Quoted t x):restx) ((Quoted u y):resty) = t == u && refsMatch x y && refsMatch restx resty refsMatch ((Code x):restx) ((Code y):resty) = diff --git a/Text/Pandoc/Writers/ConTeXt.hs b/Text/Pandoc/Writers/ConTeXt.hs index 4f171f2ce..7fe41c792 100644 --- a/Text/Pandoc/Writers/ConTeXt.hs +++ b/Text/Pandoc/Writers/ConTeXt.hs @@ -256,6 +256,9 @@ inlineToConTeXt (Superscript lst) = do inlineToConTeXt (Subscript lst) = do contents <- inlineListToConTeXt lst return $ text "\\low{" <> contents <> char '}' +inlineToConTeXt (SmallCaps lst) = do + contents <- inlineListToConTeXt lst + return $ text "{\\sc " <> contents <> char '}' inlineToConTeXt (Code str) = return $ text $ "\\type{" ++ str ++ "}" inlineToConTeXt (Quoted SingleQuote lst) = do contents <- inlineListToConTeXt lst @@ -263,7 +266,6 @@ inlineToConTeXt (Quoted SingleQuote lst) = do inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ text "\\quotation{" <> contents <> char '}' -inlineToConTeXt (SmallCaps lst) = inlineListToConTeXt lst inlineToConTeXt Apostrophe = return $ char '\'' inlineToConTeXt EmDash = return $ text "---" inlineToConTeXt EnDash = return $ text "--" diff --git a/Text/Pandoc/Writers/Docbook.hs b/Text/Pandoc/Writers/Docbook.hs index 6621c3d1d..bd261caf0 100644 --- a/Text/Pandoc/Writers/Docbook.hs +++ b/Text/Pandoc/Writers/Docbook.hs @@ -223,9 +223,11 @@ inlineToDocbook opts (Superscript lst) = inTagsSimple "superscript" $ inlinesToDocbook opts lst inlineToDocbook opts (Subscript lst) = inTagsSimple "subscript" $ inlinesToDocbook opts lst +inlineToDocbook opts (SmallCaps lst) = + inTags False "emphasis" [("role", "smallcaps")] $ + inlinesToDocbook opts lst inlineToDocbook opts (Quoted _ lst) = inTagsSimple "quote" $ inlinesToDocbook opts lst -inlineToDocbook opts (SmallCaps lst) = inlinesToDocbook opts lst inlineToDocbook _ Apostrophe = char '\'' inlineToDocbook _ Ellipses = text "…" inlineToDocbook _ EmDash = text "—" diff --git a/Text/Pandoc/Writers/LaTeX.hs b/Text/Pandoc/Writers/LaTeX.hs index 9b235c53a..57c763bdc 100644 --- a/Text/Pandoc/Writers/LaTeX.hs +++ b/Text/Pandoc/Writers/LaTeX.hs @@ -265,6 +265,8 @@ inlineToLaTeX (Subscript lst) = do -- so we have to define it (using a different name so as not to conflict with memoir class): addToHeader "\\newcommand{\\textsubscr}[1]{\\ensuremath{_{\\scriptsize\\textrm{#1}}}}" return $ inCmd "textsubscr" contents +inlineToLaTeX (SmallCaps lst) = + inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsc" inlineToLaTeX (Code str) = do st <- get if stInNote st @@ -290,7 +292,6 @@ inlineToLaTeX (Quoted DoubleQuote lst) = do then text "\\," else empty return $ text "``" <> s1 <> contents <> s2 <> text "''" -inlineToLaTeX (SmallCaps lst) = inlineListToLaTeX lst inlineToLaTeX Apostrophe = return $ char '\'' inlineToLaTeX EmDash = return $ text "---" inlineToLaTeX EnDash = return $ text "--" diff --git a/Text/Pandoc/Writers/Man.hs b/Text/Pandoc/Writers/Man.hs index 4ea28e5f5..4fd3dc8c2 100644 --- a/Text/Pandoc/Writers/Man.hs +++ b/Text/Pandoc/Writers/Man.hs @@ -256,13 +256,13 @@ inlineToMan opts (Superscript lst) = do inlineToMan opts (Subscript lst) = do contents <- inlineListToMan opts lst return $ char '~' <> contents <> char '~' +inlineToMan opts (SmallCaps lst) = inlineListToMan opts lst -- not supported inlineToMan opts (Quoted SingleQuote lst) = do contents <- inlineListToMan opts lst return $ char '`' <> contents <> char '\'' inlineToMan opts (Quoted DoubleQuote lst) = do contents <- inlineListToMan opts lst return $ text "\\[lq]" <> contents <> text "\\[rq]" -inlineToMan opts (SmallCaps lst) = inlineListToMan opts lst inlineToMan _ EmDash = return $ text "\\[em]" inlineToMan _ EnDash = return $ text "\\[en]" inlineToMan _ Apostrophe = return $ char '\'' diff --git a/Text/Pandoc/Writers/Markdown.hs b/Text/Pandoc/Writers/Markdown.hs index 76b57343d..2c99109a5 100644 --- a/Text/Pandoc/Writers/Markdown.hs +++ b/Text/Pandoc/Writers/Markdown.hs @@ -317,13 +317,13 @@ inlineToMarkdown opts (Subscript lst) = do contents <- inlineListToMarkdown opts lst let contents' = text $ substitute " " "\\ " $ render contents return $ char '~' <> contents' <> char '~' +inlineToMarkdown opts (SmallCaps lst) = inlineListToMarkdown opts lst inlineToMarkdown opts (Quoted SingleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ char '\'' <> contents <> char '\'' inlineToMarkdown opts (Quoted DoubleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ char '"' <> contents <> char '"' -inlineToMarkdown opts (SmallCaps lst) = inlineListToMarkdown opts lst inlineToMarkdown _ EmDash = return $ text "--" inlineToMarkdown _ EnDash = return $ char '-' inlineToMarkdown _ Apostrophe = return $ char '\'' diff --git a/Text/Pandoc/Writers/RST.hs b/Text/Pandoc/Writers/RST.hs index 0c172ad54..4b9f3da10 100644 --- a/Text/Pandoc/Writers/RST.hs +++ b/Text/Pandoc/Writers/RST.hs @@ -276,13 +276,13 @@ inlineToRST (Superscript lst) = do inlineToRST (Subscript lst) = do contents <- inlineListToRST lst return $ text "\\ :sub:`" <> contents <> text "`\\ " +inlineToRST (SmallCaps lst) = inlineListToRST lst inlineToRST (Quoted SingleQuote lst) = do contents <- inlineListToRST lst return $ char '\'' <> contents <> char '\'' inlineToRST (Quoted DoubleQuote lst) = do contents <- inlineListToRST lst return $ char '"' <> contents <> char '"' -inlineToRST (SmallCaps lst) = inlineListToRST lst inlineToRST EmDash = return $ text "--" inlineToRST EnDash = return $ char '-' inlineToRST Apostrophe = return $ char '\'' diff --git a/Text/Pandoc/Writers/RTF.hs b/Text/Pandoc/Writers/RTF.hs index b95b218e9..db3b9f538 100644 --- a/Text/Pandoc/Writers/RTF.hs +++ b/Text/Pandoc/Writers/RTF.hs @@ -264,11 +264,11 @@ inlineToRTF (Strong lst) = "{\\b " ++ (inlineListToRTF lst) ++ "}" inlineToRTF (Strikeout lst) = "{\\strike " ++ (inlineListToRTF lst) ++ "}" inlineToRTF (Superscript lst) = "{\\super " ++ (inlineListToRTF lst) ++ "}" inlineToRTF (Subscript lst) = "{\\sub " ++ (inlineListToRTF lst) ++ "}" +inlineToRTF (SmallCaps lst) = "{\\scaps " ++ (inlineListToRTF lst) ++ "}" inlineToRTF (Quoted SingleQuote lst) = "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'" inlineToRTF (Quoted DoubleQuote lst) = "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\"" -inlineToRTF (SmallCaps lst) = inlineListToRTF lst inlineToRTF Apostrophe = "\\u8217'" inlineToRTF Ellipses = "\\u8230?" inlineToRTF EmDash = "\\u8212-" diff --git a/Text/Pandoc/Writers/Texinfo.hs b/Text/Pandoc/Writers/Texinfo.hs index e08448813..8cc27b585 100644 --- a/Text/Pandoc/Writers/Texinfo.hs +++ b/Text/Pandoc/Writers/Texinfo.hs @@ -354,9 +354,9 @@ inlineForNode (Strong lst) = inlineListForNode lst inlineForNode (Strikeout lst) = inlineListForNode lst inlineForNode (Superscript lst) = inlineListForNode lst inlineForNode (Subscript lst) = inlineListForNode lst +inlineForNode (SmallCaps lst) = inlineListForNode lst inlineForNode (Quoted _ lst) = inlineListForNode lst inlineForNode (Code str) = inlineForNode (Str str) -inlineForNode (SmallCaps lst) = inlineListForNode lst inlineForNode Space = return $ char ' ' inlineForNode EmDash = return $ text "---" inlineForNode EnDash = return $ text "--" @@ -415,6 +415,9 @@ inlineToTexinfo (Subscript lst) = do contents <- inlineListToTexinfo lst return $ text "@textsubscript{" <> contents <> char '}' +inlineToTexinfo (SmallCaps lst) = + inlineListToTexinfo lst >>= return . inCmd "sc" + inlineToTexinfo (Code str) = do return $ text $ "@code{" ++ stringToTexinfo str ++ "}" @@ -426,7 +429,6 @@ inlineToTexinfo (Quoted DoubleQuote lst) = do contents <- inlineListToTexinfo lst return $ text "``" <> contents <> text "''" -inlineToTexinfo (SmallCaps lst) = inlineListToTexinfo lst inlineToTexinfo Apostrophe = return $ char '\'' inlineToTexinfo EmDash = return $ text "---" inlineToTexinfo EnDash = return $ text "--" |