git.iko.soy/typeable/pandoc
on master help sign in
Added `writerHtmlQTags` and `--html-q-tags` option.

The previous default was to use `<q>` tags in HTML5. But `<q>` tags are also valid HTML4, and they are not very robust in HTML5. Some user agents don't support them, and some CSS resets prevent pandoc's quotes CSS from working properly (e.g. bootstrap). It seems a better default just to insert quote characters, but the option is provided for those who have gotten used to using `<q>` tags.

commiteebed6bc48c2e1b8c2da2e5b198e0164f76c0ab5 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 15 Jan 2013, 18:50 (14 years ago) parent93b373d
5 files changed+17−2
README+3 data/templates+1−1 pandoc.hs+10 src/Text/Pandoc/Options.hs+2 src/Text/Pandoc/Writers/HTML.hs+1−1
README+3
@@ -359,6 +359,9 @@ Options affecting specific writers
359359: Produce HTML5 instead of HTML4. This option has no effect for writers
360360 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
361361
362+`--html-q-tags`
363+: Use `<q>` tags for quotes in HTML.
364+
362365`--ascii`
363366: Use only ascii characters in output. Currently supported only
364367 for HTML output (which uses numerical entities instead of
data/templates+1−1

Submodule changed.

pandoc.hs+10
@@ -105,6 +105,7 @@ data Opt = Opt
105105 , optSmart :: Bool -- ^ Use smart typography
106106 , optOldDashes :: Bool -- ^ Parse dashes like pandoc <=1.8.2.1
107107 , optHtml5 :: Bool -- ^ Produce HTML5 in HTML
108+ , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
108109 , optHighlight :: Bool -- ^ Highlight source code
109110 , optHighlightStyle :: Style -- ^ Style to use for highlighted code
110111 , optChapters :: Bool -- ^ Use chapter for top-level sects
@@ -159,6 +160,7 @@ defaultOpts = Opt
159160 , optSmart = False
160161 , optOldDashes = False
161162 , optHtml5 = False
163+ , optHtmlQTags = False
162164 , optHighlight = True
163165 , optHighlightStyle = pygments
164166 , optChapters = False
@@ -431,6 +433,12 @@ options =
431433 return opt { optHtml5 = True }))
432434 "" -- "Produce HTML5 in HTML output"
433435
436+ , Option "" ["html-q-tags"]
437+ (NoArg
438+ (\opt -> do
439+ return opt { optHtmlQTags = True }))
440+ "" -- "Use <q> tags for quotes in HTML"
441+
434442 , Option "" ["ascii"]
435443 (NoArg
436444 (\opt -> return opt { optAscii = True }))
@@ -816,6 +824,7 @@ main = do
816824 , optSmart = smart
817825 , optOldDashes = oldDashes
818826 , optHtml5 = html5
827+ , optHtmlQTags = htmlQTags
819828 , optHighlight = highlight
820829 , optHighlightStyle = highlightStyle
821830 , optChapters = chapters
@@ -1009,6 +1018,7 @@ main = do
10091018 writerSourceDirectory = sourceDir,
10101019 writerUserDataDir = datadir,
10111020 writerHtml5 = html5,
1021+ writerHtmlQTags = htmlQTags,
10121022 writerChapters = chapters,
10131023 writerListings = listings,
10141024 writerBeamer = False,
src/Text/Pandoc/Options.hs+2
@@ -262,6 +262,7 @@ data WriterOptions = WriterOptions
262262 , writerCiteMethod :: CiteMethod -- ^ How to print cites
263263 , writerBiblioFiles :: [FilePath] -- ^ Biblio files to use for citations
264264 , writerHtml5 :: Bool -- ^ Produce HTML5
265+ , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
265266 , writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show
266267 , writerSlideLevel :: Maybe Int -- ^ Force header level of slides
267268 , writerChapters :: Bool -- ^ Use "chapter" for top-level sects
@@ -303,6 +304,7 @@ instance Default WriterOptions where
303304 , writerCiteMethod = Citeproc
304305 , writerBiblioFiles = []
305306 , writerHtml5 = False
307+ , writerHtmlQTags = False
306308 , writerBeamer = False
307309 , writerSlideLevel = Nothing
308310 , writerChapters = False
src/Text/Pandoc/Writers/HTML.hs+1−1
@@ -618,7 +618,7 @@ inlineToHtml opts inline =
618618 strToHtml "’")
619619 DoubleQuote -> (strToHtml "“",
620620 strToHtml "”")
621− in if writerHtml5 opts
621+ in if writerHtmlQTags opts
622622 then do
623623 modify $ \st -> st{ stQuotes = True }
624624 H.q `fmap` inlineListToHtml opts lst