aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-01-15 18:50:36 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-01-15 18:50:36 -0800
commiteebed6bc48c2e1b8c2da2e5b198e0164f76c0ab5 (patch)
tree4117fce2210b2fe9e10d2413d0d6177946356248
parent93b373d4eb39c0ec13a563ee48ec2e0c9adf63a2 (diff)
downloadpandoc-eebed6bc48c2e1b8c2da2e5b198e0164f76c0ab5.tar.gz
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.
-rw-r--r--README3
m---------data/templates10
-rw-r--r--pandoc.hs10
-rw-r--r--src/Text/Pandoc/Options.hs2
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs2
5 files changed, 21 insertions, 6 deletions
diff --git a/README b/README
index 615b0c7b9..bd252ac13 100644
--- a/README
+++ b/README
@@ -359,6 +359,9 @@ Options affecting specific writers
: Produce HTML5 instead of HTML4. This option has no effect for writers
other than `html`. (*Deprecated:* Use the `html5` output format instead.)
+`--html-q-tags`
+: Use `<q>` tags for quotes in HTML.
+
`--ascii`
: Use only ascii characters in output. Currently supported only
for HTML output (which uses numerical entities instead of
diff --git a/data/templates b/data/templates
-Subproject b49608bf92ad66f255cd3371da834ddb7bee521
+Subproject 25386101d5428eedca69089ab8e5373f0a079bf
diff --git a/pandoc.hs b/pandoc.hs
index 20278d2d0..61499ad69 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -105,6 +105,7 @@ data Opt = Opt
, optSmart :: Bool -- ^ Use smart typography
, optOldDashes :: Bool -- ^ Parse dashes like pandoc <=1.8.2.1
, optHtml5 :: Bool -- ^ Produce HTML5 in HTML
+ , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
, optHighlight :: Bool -- ^ Highlight source code
, optHighlightStyle :: Style -- ^ Style to use for highlighted code
, optChapters :: Bool -- ^ Use chapter for top-level sects
@@ -159,6 +160,7 @@ defaultOpts = Opt
, optSmart = False
, optOldDashes = False
, optHtml5 = False
+ , optHtmlQTags = False
, optHighlight = True
, optHighlightStyle = pygments
, optChapters = False
@@ -431,6 +433,12 @@ options =
return opt { optHtml5 = True }))
"" -- "Produce HTML5 in HTML output"
+ , Option "" ["html-q-tags"]
+ (NoArg
+ (\opt -> do
+ return opt { optHtmlQTags = True }))
+ "" -- "Use <q> tags for quotes in HTML"
+
, Option "" ["ascii"]
(NoArg
(\opt -> return opt { optAscii = True }))
@@ -816,6 +824,7 @@ main = do
, optSmart = smart
, optOldDashes = oldDashes
, optHtml5 = html5
+ , optHtmlQTags = htmlQTags
, optHighlight = highlight
, optHighlightStyle = highlightStyle
, optChapters = chapters
@@ -1009,6 +1018,7 @@ main = do
writerSourceDirectory = sourceDir,
writerUserDataDir = datadir,
writerHtml5 = html5,
+ writerHtmlQTags = htmlQTags,
writerChapters = chapters,
writerListings = listings,
writerBeamer = False,
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 0471161e0..c659b652d 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -262,6 +262,7 @@ data WriterOptions = WriterOptions
, writerCiteMethod :: CiteMethod -- ^ How to print cites
, writerBiblioFiles :: [FilePath] -- ^ Biblio files to use for citations
, writerHtml5 :: Bool -- ^ Produce HTML5
+ , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
, writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show
, writerSlideLevel :: Maybe Int -- ^ Force header level of slides
, writerChapters :: Bool -- ^ Use "chapter" for top-level sects
@@ -303,6 +304,7 @@ instance Default WriterOptions where
, writerCiteMethod = Citeproc
, writerBiblioFiles = []
, writerHtml5 = False
+ , writerHtmlQTags = False
, writerBeamer = False
, writerSlideLevel = Nothing
, writerChapters = False
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 3b9a1eae6..3111cbecb 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -618,7 +618,7 @@ inlineToHtml opts inline =
strToHtml "’")
DoubleQuote -> (strToHtml "“",
strToHtml "”")
- in if writerHtml5 opts
+ in if writerHtmlQTags opts
then do
modify $ \st -> st{ stQuotes = True }
H.q `fmap` inlineListToHtml opts lst