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.
This commit is contained in:
parent
93b373d4eb
commit
eebed6bc48
5 changed files with 17 additions and 2 deletions
3
README
3
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
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b49608bf92ad66f255cd3371da834ddb7bee5211
|
||||
Subproject commit 25386101d5428eedca69089ab8e5373f0a079bff
|
10
pandoc.hs
10
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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue