diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-03 08:27:44 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-03-03 08:29:01 -0800 |
commit | 40133e8a7dc3759cfce20380299f121e7ab0b251 (patch) | |
tree | 9b1c281cade07080617aabbb539ba42c43ca3d6e | |
parent | e6a03cdd4bd36cb3baceb226125b89a422ab0a09 (diff) | |
download | pandoc-40133e8a7dc3759cfce20380299f121e7ab0b251.tar.gz |
Use <q> tags for Quoted items for HTML5 output.
The quote style can be changed by modifying the template
or including a css file. A default quote style is included.
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 15 | ||||
m--------- | templates | 10 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 9dd29f183..b1fd9c56f 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -59,12 +59,14 @@ import Data.Monoid (mempty, mconcat) data WriterState = WriterState { stNotes :: [Html] -- ^ List of notes , stMath :: Bool -- ^ Math is used in document + , stQuotes :: Bool -- ^ <q> tag is used , stHighlighting :: Bool -- ^ Syntax highlighting is used , stSecNum :: [Int] -- ^ Number of current section } defaultWriterState :: WriterState -defaultWriterState = WriterState {stNotes= [], stMath = False, stHighlighting = False, stSecNum = []} +defaultWriterState = WriterState {stNotes= [], stMath = False, stQuotes = False, + stHighlighting = False, stSecNum = []} -- Helpers to render HTML with the appropriate function. @@ -156,7 +158,8 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do let newvars = [("highlighting-css", styleToCss $ writerHighlightStyle opts) | stHighlighting st] ++ - [("math", renderHtml math) | stMath st] + [("math", renderHtml math) | stMath st] ++ + [("quotes", "yes") | stQuotes st] return (tit, auths, authsMeta, date, toc, thebody, newvars) -- | Prepare author for meta tag, converting notes into @@ -581,8 +584,12 @@ inlineToHtml opts inline = strToHtml "’") DoubleQuote -> (strToHtml "“", strToHtml "”") - in do contents <- inlineListToHtml opts lst - return $ leftQuote >> contents >> rightQuote + in if writerHtml5 opts + then do + modify $ \st -> st{ stQuotes = True } + H.q `fmap` inlineListToHtml opts lst + else (\x -> leftQuote >> x >> rightQuote) + `fmap` inlineListToHtml opts lst (Math t str) -> modify (\st -> st {stMath = True}) >> (case writerHTMLMathMethod opts of LaTeXMathML _ -> diff --git a/templates b/templates -Subproject 4594c7eeaee4e82237d4c52f011441143ad321d +Subproject cc0e845c187fb98ebd2343750cfbacd1ab39fc5 |