git.iko.soy/typeable/pandoc
on master help sign in
Add preliminary support for SmallCaps inline element. (Andrea Rossato)

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1327 788f1e2b-df1e-0410-8736-df70ead52e1b

commit2637e3595afef05cbd67a69b8d79682ebc7a716a authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 15 Jul 2008, 23:25 (18 years ago) parent7c35c0b
11 files changed+25−10
Text/Pandoc/Definition.hs+1 Text/Pandoc/Writers/ConTeXt.hs+1 Text/Pandoc/Writers/Docbook.hs+1 Text/Pandoc/Writers/HTML.hs+3 Text/Pandoc/Writers/LaTeX.hs+1 Text/Pandoc/Writers/Man.hs+1 Text/Pandoc/Writers/Markdown.hs+1 Text/Pandoc/Writers/OpenDocument.hs+12−10 Text/Pandoc/Writers/RST.hs+1 Text/Pandoc/Writers/RTF.hs+1 Text/Pandoc/Writers/Texinfo.hs+2
Text/Pandoc/Definition.hs+1
@@ -104,6 +104,7 @@ data Inline
104104 | Superscript [Inline] -- ^ Superscripted text (list of inlines)
105105 | Subscript [Inline] -- ^ Subscripted text (list of inlines)
106106 | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines)
107+ | SmallCaps [Inline] -- ^ Small caps text (list of inlines)
107108 | Code String -- ^ Inline code (literal)
108109 | Space -- ^ Inter-word space
109110 | EmDash -- ^ Em dash
Text/Pandoc/Writers/ConTeXt.hs+1
@@ -263,6 +263,7 @@ inlineToConTeXt (Quoted SingleQuote lst) = do
263263inlineToConTeXt (Quoted DoubleQuote lst) = do
264264 contents <- inlineListToConTeXt lst
265265 return $ text "\\quotation{" <> contents <> char '}'
266+inlineToConTeXt (SmallCaps lst) = inlineListToConTeXt lst
266267inlineToConTeXt Apostrophe = return $ char '\''
267268inlineToConTeXt EmDash = return $ text "---"
268269inlineToConTeXt EnDash = return $ text "--"
Text/Pandoc/Writers/Docbook.hs+1
@@ -225,6 +225,7 @@ inlineToDocbook opts (Subscript lst) =
225225 inTagsSimple "subscript" $ inlinesToDocbook opts lst
226226inlineToDocbook opts (Quoted _ lst) =
227227 inTagsSimple "quote" $ inlinesToDocbook opts lst
228+inlineToDocbook opts (SmallCaps lst) = inlinesToDocbook opts lst
228229inlineToDocbook _ Apostrophe = char '\''
229230inlineToDocbook _ Ellipses = text "&#8230;"
230231inlineToDocbook _ EmDash = text "&#8212;"
Text/Pandoc/Writers/HTML.hs+3
@@ -241,6 +241,7 @@ inlineListToIdentifier' (x:xs) =
241241 Emph lst -> inlineListToIdentifier' lst
242242 Strikeout lst -> inlineListToIdentifier' lst
243243 Superscript lst -> inlineListToIdentifier' lst
244+ SmallCaps lst -> inlineListToIdentifier' lst
244245 Subscript lst -> inlineListToIdentifier' lst
245246 Strong lst -> inlineListToIdentifier' lst
246247 Quoted _ lst -> inlineListToIdentifier' lst
@@ -426,6 +427,8 @@ inlineToHtml opts inline =
426427 (Code str) -> return $ thecode << str
427428 (Strikeout lst) -> inlineListToHtml opts lst >>=
428429 return . (thespan ! [thestyle "text-decoration: line-through;"])
430+ (SmallCaps lst) -> inlineListToHtml opts lst >>=
431+ return . (thespan ! [thestyle "font-variant: small-caps;"])
429432 (Superscript lst) -> inlineListToHtml opts lst >>= return . sup
430433 (Subscript lst) -> inlineListToHtml opts lst >>= return . sub
431434 (Quoted quoteType lst) ->
Text/Pandoc/Writers/LaTeX.hs+1
@@ -290,6 +290,7 @@ inlineToLaTeX (Quoted DoubleQuote lst) = do
290290 then text "\\,"
291291 else empty
292292 return $ text "``" <> s1 <> contents <> s2 <> text "''"
293+inlineToLaTeX (SmallCaps lst) = inlineListToLaTeX lst
293294inlineToLaTeX Apostrophe = return $ char '\''
294295inlineToLaTeX EmDash = return $ text "---"
295296inlineToLaTeX EnDash = return $ text "--"
Text/Pandoc/Writers/Man.hs+1
@@ -262,6 +262,7 @@ inlineToMan opts (Quoted SingleQuote lst) = do
262262inlineToMan opts (Quoted DoubleQuote lst) = do
263263 contents <- inlineListToMan opts lst
264264 return $ text "\\[lq]" <> contents <> text "\\[rq]"
265+inlineToMan opts (SmallCaps lst) = inlineListToMan opts lst
265266inlineToMan _ EmDash = return $ text "\\[em]"
266267inlineToMan _ EnDash = return $ text "\\[en]"
267268inlineToMan _ Apostrophe = return $ char '\''
Text/Pandoc/Writers/Markdown.hs+1
@@ -323,6 +323,7 @@ inlineToMarkdown opts (Quoted SingleQuote lst) = do
323323inlineToMarkdown opts (Quoted DoubleQuote lst) = do
324324 contents <- inlineListToMarkdown opts lst
325325 return $ char '"' <> contents <> char '"'
326+inlineToMarkdown opts (SmallCaps lst) = inlineListToMarkdown opts lst
326327inlineToMarkdown _ EmDash = return $ text "--"
327328inlineToMarkdown _ EnDash = return $ char '-'
328329inlineToMarkdown _ Apostrophe = return $ char '\''
Text/Pandoc/Writers/OpenDocument.hs+12−10
@@ -369,6 +369,7 @@ inlineToOpenDocument o ils
369369 | Strikeout l <- ils = withTextStyle Strike $ inlinesToOpenDocument o l
370370 | Superscript l <- ils = withTextStyle Sup $ inlinesToOpenDocument o l
371371 | Subscript l <- ils = withTextStyle Sub $ inlinesToOpenDocument o l
372+ | SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
372373 | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
373374 | Code s <- ils = preformatted s
374375 | Math s <- ils = inlinesToOpenDocument o (readTeXMath s)
@@ -508,19 +509,20 @@ paraTableStyles t s (a:xs)
508509 [ ("fo:text-align", x)
509510 , ("style:justify-single-word", "false")]
510511
511−data TextStyle = Italic | Bold | Strike | Sub | Sup deriving ( Eq )
512+data TextStyle = Italic | Bold | Strike | Sub | Sup | SmallC deriving ( Eq )
512513
513514textStyleAttr :: TextStyle -> [(String,String)]
514515textStyleAttr s
515− | Italic <- s = [("fo:font-style" ,"italic" )
516− ,("style:font-style-asian" ,"italic" )
517− ,("style:font-style-complex" ,"italic" )]
518− | Bold <- s = [("fo:font-weight" ,"bold" )
519− ,("style:font-weight-asian" ,"bold" )
520− ,("style:font-weight-complex" ,"bold" )]
521− | Strike <- s = [("style:text-line-through-style", "solid" )]
522− | Sub <- s = [("style:text-position" ,"sub 58%" )]
523− | Sup <- s = [("style:text-position" ,"super 58%")]
516+ | Italic <- s = [("fo:font-style" ,"italic" )
517+ ,("style:font-style-asian" ,"italic" )
518+ ,("style:font-style-complex" ,"italic" )]
519+ | Bold <- s = [("fo:font-weight" ,"bold" )
520+ ,("style:font-weight-asian" ,"bold" )
521+ ,("style:font-weight-complex" ,"bold" )]
522+ | Strike <- s = [("style:text-line-through-style", "solid" )]
523+ | Sub <- s = [("style:text-position" ,"sub 58%" )]
524+ | Sup <- s = [("style:text-position" ,"super 58%" )]
525+ | SmallC <- s = [("fo:font-variant" ,"small-caps")]
524526 | otherwise = []
525527
526528openDocumentNameSpaces :: [(String, String)]
Text/Pandoc/Writers/RST.hs+1
@@ -282,6 +282,7 @@ inlineToRST (Quoted SingleQuote lst) = do
282282inlineToRST (Quoted DoubleQuote lst) = do
283283 contents <- inlineListToRST lst
284284 return $ char '"' <> contents <> char '"'
285+inlineToRST (SmallCaps lst) = inlineListToRST lst
285286inlineToRST EmDash = return $ text "--"
286287inlineToRST EnDash = return $ char '-'
287288inlineToRST Apostrophe = return $ char '\''
Text/Pandoc/Writers/RTF.hs+1
@@ -268,6 +268,7 @@ inlineToRTF (Quoted SingleQuote lst) =
268268 "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'"
269269inlineToRTF (Quoted DoubleQuote lst) =
270270 "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\""
271+inlineToRTF (SmallCaps lst) = inlineListToRTF lst
271272inlineToRTF Apostrophe = "\\u8217'"
272273inlineToRTF Ellipses = "\\u8230?"
273274inlineToRTF EmDash = "\\u8212-"
Text/Pandoc/Writers/Texinfo.hs+2
@@ -356,6 +356,7 @@ inlineForNode (Superscript lst) = inlineListForNode lst
356356inlineForNode (Subscript lst) = inlineListForNode lst
357357inlineForNode (Quoted _ lst) = inlineListForNode lst
358358inlineForNode (Code str) = inlineForNode (Str str)
359+inlineForNode (SmallCaps lst) = inlineListForNode lst
359360inlineForNode Space = return $ char ' '
360361inlineForNode EmDash = return $ text "---"
361362inlineForNode EnDash = return $ text "--"
@@ -425,6 +426,7 @@ inlineToTexinfo (Quoted DoubleQuote lst) = do
425426 contents <- inlineListToTexinfo lst
426427 return $ text "``" <> contents <> text "''"
427428
429+inlineToTexinfo (SmallCaps lst) = inlineListToTexinfo lst
428430inlineToTexinfo Apostrophe = return $ char '\''
429431inlineToTexinfo EmDash = return $ text "---"
430432inlineToTexinfo EnDash = return $ text "--"