git.iko.soy/typeable/pandoc
on master help sign in
Add preliminary support for SmallCaps inline element. (Andrea Rossato)
2637e35fiddlosopher
Text/Pandoc/Definition.hs+1
@@ -104,6 +104,7 @@ data Inline
104 | Superscript [Inline] -- ^ Superscripted text (list of inlines)
104 | Superscript [Inline] -- ^ Superscripted text (list of inlines)
105 | Subscript [Inline] -- ^ Subscripted text (list of inlines)
105 | Subscript [Inline] -- ^ Subscripted text (list of inlines)
106 | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines)
106 | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines)
107+ | SmallCaps [Inline] -- ^ Small caps text (list of inlines)
107 | Code String -- ^ Inline code (literal)
108 | Code String -- ^ Inline code (literal)
108 | Space -- ^ Inter-word space
109 | Space -- ^ Inter-word space
109 | EmDash -- ^ Em dash
110 | EmDash -- ^ Em dash
Text/Pandoc/Writers/ConTeXt.hs+1
@@ -263,6 +263,7 @@ inlineToConTeXt (Quoted SingleQuote lst) = do
263inlineToConTeXt (Quoted DoubleQuote lst) = do
263inlineToConTeXt (Quoted DoubleQuote lst) = do
264 contents <- inlineListToConTeXt lst
264 contents <- inlineListToConTeXt lst
265 return $ text "\\quotation{" <> contents <> char '}'
265 return $ text "\\quotation{" <> contents <> char '}'
266+inlineToConTeXt (SmallCaps lst) = inlineListToConTeXt lst
266inlineToConTeXt Apostrophe = return $ char '\''
267inlineToConTeXt Apostrophe = return $ char '\''
267inlineToConTeXt EmDash = return $ text "---"
268inlineToConTeXt EmDash = return $ text "---"
268inlineToConTeXt EnDash = return $ text "--"
269inlineToConTeXt EnDash = return $ text "--"
Text/Pandoc/Writers/Docbook.hs+1
@@ -225,6 +225,7 @@ inlineToDocbook opts (Subscript lst) =
225 inTagsSimple "subscript" $ inlinesToDocbook opts lst
225 inTagsSimple "subscript" $ inlinesToDocbook opts lst
226inlineToDocbook opts (Quoted _ lst) =
226inlineToDocbook opts (Quoted _ lst) =
227 inTagsSimple "quote" $ inlinesToDocbook opts lst
227 inTagsSimple "quote" $ inlinesToDocbook opts lst
228+inlineToDocbook opts (SmallCaps lst) = inlinesToDocbook opts lst
228inlineToDocbook _ Apostrophe = char '\''
229inlineToDocbook _ Apostrophe = char '\''
229inlineToDocbook _ Ellipses = text "&#8230;"
230inlineToDocbook _ Ellipses = text "&#8230;"
230inlineToDocbook _ EmDash = text "&#8212;"
231inlineToDocbook _ EmDash = text "&#8212;"
Text/Pandoc/Writers/HTML.hs+3
@@ -241,6 +241,7 @@ inlineListToIdentifier' (x:xs) =
241 Emph lst -> inlineListToIdentifier' lst
241 Emph lst -> inlineListToIdentifier' lst
242 Strikeout lst -> inlineListToIdentifier' lst
242 Strikeout lst -> inlineListToIdentifier' lst
243 Superscript lst -> inlineListToIdentifier' lst
243 Superscript lst -> inlineListToIdentifier' lst
244+ SmallCaps lst -> inlineListToIdentifier' lst
244 Subscript lst -> inlineListToIdentifier' lst
245 Subscript lst -> inlineListToIdentifier' lst
245 Strong lst -> inlineListToIdentifier' lst
246 Strong lst -> inlineListToIdentifier' lst
246 Quoted _ lst -> inlineListToIdentifier' lst
247 Quoted _ lst -> inlineListToIdentifier' lst
@@ -426,6 +427,8 @@ inlineToHtml opts inline =
426 (Code str) -> return $ thecode << str
427 (Code str) -> return $ thecode << str
427 (Strikeout lst) -> inlineListToHtml opts lst >>=
428 (Strikeout lst) -> inlineListToHtml opts lst >>=
428 return . (thespan ! [thestyle "text-decoration: line-through;"])
429 return . (thespan ! [thestyle "text-decoration: line-through;"])
430+ (SmallCaps lst) -> inlineListToHtml opts lst >>=
431+ return . (thespan ! [thestyle "font-variant: small-caps;"])
429 (Superscript lst) -> inlineListToHtml opts lst >>= return . sup
432 (Superscript lst) -> inlineListToHtml opts lst >>= return . sup
430 (Subscript lst) -> inlineListToHtml opts lst >>= return . sub
433 (Subscript lst) -> inlineListToHtml opts lst >>= return . sub
431 (Quoted quoteType lst) ->
434 (Quoted quoteType lst) ->
Text/Pandoc/Writers/LaTeX.hs+1
@@ -290,6 +290,7 @@ inlineToLaTeX (Quoted DoubleQuote lst) = do
290 then text "\\,"
290 then text "\\,"
291 else empty
291 else empty
292 return $ text "``" <> s1 <> contents <> s2 <> text "''"
292 return $ text "``" <> s1 <> contents <> s2 <> text "''"
293+inlineToLaTeX (SmallCaps lst) = inlineListToLaTeX lst
293inlineToLaTeX Apostrophe = return $ char '\''
294inlineToLaTeX Apostrophe = return $ char '\''
294inlineToLaTeX EmDash = return $ text "---"
295inlineToLaTeX EmDash = return $ text "---"
295inlineToLaTeX EnDash = return $ text "--"
296inlineToLaTeX EnDash = return $ text "--"
Text/Pandoc/Writers/Man.hs+1
@@ -262,6 +262,7 @@ inlineToMan opts (Quoted SingleQuote lst) = do
262inlineToMan opts (Quoted DoubleQuote lst) = do
262inlineToMan opts (Quoted DoubleQuote lst) = do
263 contents <- inlineListToMan opts lst
263 contents <- inlineListToMan opts lst
264 return $ text "\\[lq]" <> contents <> text "\\[rq]"
264 return $ text "\\[lq]" <> contents <> text "\\[rq]"
265+inlineToMan opts (SmallCaps lst) = inlineListToMan opts lst
265inlineToMan _ EmDash = return $ text "\\[em]"
266inlineToMan _ EmDash = return $ text "\\[em]"
266inlineToMan _ EnDash = return $ text "\\[en]"
267inlineToMan _ EnDash = return $ text "\\[en]"
267inlineToMan _ Apostrophe = return $ char '\''
268inlineToMan _ Apostrophe = return $ char '\''
Text/Pandoc/Writers/Markdown.hs+1
@@ -323,6 +323,7 @@ inlineToMarkdown opts (Quoted SingleQuote lst) = do
323inlineToMarkdown opts (Quoted DoubleQuote lst) = do
323inlineToMarkdown opts (Quoted DoubleQuote lst) = do
324 contents <- inlineListToMarkdown opts lst
324 contents <- inlineListToMarkdown opts lst
325 return $ char '"' <> contents <> char '"'
325 return $ char '"' <> contents <> char '"'
326+inlineToMarkdown opts (SmallCaps lst) = inlineListToMarkdown opts lst
326inlineToMarkdown _ EmDash = return $ text "--"
327inlineToMarkdown _ EmDash = return $ text "--"
327inlineToMarkdown _ EnDash = return $ char '-'
328inlineToMarkdown _ EnDash = return $ char '-'
328inlineToMarkdown _ Apostrophe = return $ char '\''
329inlineToMarkdown _ Apostrophe = return $ char '\''
Text/Pandoc/Writers/OpenDocument.hs+12−10
@@ -369,6 +369,7 @@ inlineToOpenDocument o ils
369 | Strikeout l <- ils = withTextStyle Strike $ inlinesToOpenDocument o l
369 | Strikeout l <- ils = withTextStyle Strike $ inlinesToOpenDocument o l
370 | Superscript l <- ils = withTextStyle Sup $ inlinesToOpenDocument o l
370 | Superscript l <- ils = withTextStyle Sup $ inlinesToOpenDocument o l
371 | Subscript l <- ils = withTextStyle Sub $ inlinesToOpenDocument o l
371 | Subscript l <- ils = withTextStyle Sub $ inlinesToOpenDocument o l
372+ | SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
372 | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
373 | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
373 | Code s <- ils = preformatted s
374 | Code s <- ils = preformatted s
374 | Math s <- ils = inlinesToOpenDocument o (readTeXMath s)
375 | Math s <- ils = inlinesToOpenDocument o (readTeXMath s)
@@ -508,19 +509,20 @@ paraTableStyles t s (a:xs)
508 [ ("fo:text-align", x)
509 [ ("fo:text-align", x)
509 , ("style:justify-single-word", "false")]
510 , ("style:justify-single-word", "false")]
510
511
511−data TextStyle = Italic | Bold | Strike | Sub | Sup deriving ( Eq )
512+data TextStyle = Italic | Bold | Strike | Sub | Sup | SmallC deriving ( Eq )
512
513
513textStyleAttr :: TextStyle -> [(String,String)]
514textStyleAttr :: TextStyle -> [(String,String)]
514textStyleAttr s
515textStyleAttr s
515− | Italic <- s = [("fo:font-style" ,"italic" )
516+ | Italic <- s = [("fo:font-style" ,"italic" )
516− ,("style:font-style-asian" ,"italic" )
517+ ,("style:font-style-asian" ,"italic" )
517− ,("style:font-style-complex" ,"italic" )]
518+ ,("style:font-style-complex" ,"italic" )]
518− | Bold <- s = [("fo:font-weight" ,"bold" )
519+ | Bold <- s = [("fo:font-weight" ,"bold" )
519− ,("style:font-weight-asian" ,"bold" )
520+ ,("style:font-weight-asian" ,"bold" )
520− ,("style:font-weight-complex" ,"bold" )]
521+ ,("style:font-weight-complex" ,"bold" )]
521− | Strike <- s = [("style:text-line-through-style", "solid" )]
522+ | Strike <- s = [("style:text-line-through-style", "solid" )]
522− | Sub <- s = [("style:text-position" ,"sub 58%" )]
523+ | Sub <- s = [("style:text-position" ,"sub 58%" )]
523− | Sup <- s = [("style:text-position" ,"super 58%")]
524+ | Sup <- s = [("style:text-position" ,"super 58%" )]
525+ | SmallC <- s = [("fo:font-variant" ,"small-caps")]
524 | otherwise = []
526 | otherwise = []
525
527
526openDocumentNameSpaces :: [(String, String)]
528openDocumentNameSpaces :: [(String, String)]
Text/Pandoc/Writers/RST.hs+1
@@ -282,6 +282,7 @@ inlineToRST (Quoted SingleQuote lst) = do
282inlineToRST (Quoted DoubleQuote lst) = do
282inlineToRST (Quoted DoubleQuote lst) = do
283 contents <- inlineListToRST lst
283 contents <- inlineListToRST lst
284 return $ char '"' <> contents <> char '"'
284 return $ char '"' <> contents <> char '"'
285+inlineToRST (SmallCaps lst) = inlineListToRST lst
285inlineToRST EmDash = return $ text "--"
286inlineToRST EmDash = return $ text "--"
286inlineToRST EnDash = return $ char '-'
287inlineToRST EnDash = return $ char '-'
287inlineToRST Apostrophe = return $ char '\''
288inlineToRST Apostrophe = return $ char '\''
Text/Pandoc/Writers/RTF.hs+1
@@ -268,6 +268,7 @@ inlineToRTF (Quoted SingleQuote lst) =
268 "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'"
268 "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'"
269inlineToRTF (Quoted DoubleQuote lst) =
269inlineToRTF (Quoted DoubleQuote lst) =
270 "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\""
270 "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\""
271+inlineToRTF (SmallCaps lst) = inlineListToRTF lst
271inlineToRTF Apostrophe = "\\u8217'"
272inlineToRTF Apostrophe = "\\u8217'"
272inlineToRTF Ellipses = "\\u8230?"
273inlineToRTF Ellipses = "\\u8230?"
273inlineToRTF EmDash = "\\u8212-"
274inlineToRTF EmDash = "\\u8212-"
Text/Pandoc/Writers/Texinfo.hs+2
@@ -356,6 +356,7 @@ inlineForNode (Superscript lst) = inlineListForNode lst
356inlineForNode (Subscript lst) = inlineListForNode lst
356inlineForNode (Subscript lst) = inlineListForNode lst
357inlineForNode (Quoted _ lst) = inlineListForNode lst
357inlineForNode (Quoted _ lst) = inlineListForNode lst
358inlineForNode (Code str) = inlineForNode (Str str)
358inlineForNode (Code str) = inlineForNode (Str str)
359+inlineForNode (SmallCaps lst) = inlineListForNode lst
359inlineForNode Space = return $ char ' '
360inlineForNode Space = return $ char ' '
360inlineForNode EmDash = return $ text "---"
361inlineForNode EmDash = return $ text "---"
361inlineForNode EnDash = return $ text "--"
362inlineForNode EnDash = return $ text "--"
@@ -425,6 +426,7 @@ inlineToTexinfo (Quoted DoubleQuote lst) = do
425 contents <- inlineListToTexinfo lst
426 contents <- inlineListToTexinfo lst
426 return $ text "``" <> contents <> text "''"
427 return $ text "``" <> contents <> text "''"
427
428
429+inlineToTexinfo (SmallCaps lst) = inlineListToTexinfo lst
428inlineToTexinfo Apostrophe = return $ char '\''
430inlineToTexinfo Apostrophe = return $ char '\''
429inlineToTexinfo EmDash = return $ text "---"
431inlineToTexinfo EmDash = return $ text "---"
430inlineToTexinfo EnDash = return $ text "--"
432inlineToTexinfo EnDash = return $ text "--"