HTML writer: Further performance improvements.

This commit is contained in:
John MacFarlane 2022-03-30 09:48:56 -07:00
parent 4a54ca5b0b
commit bb5f0f7b76

View file

@ -991,7 +991,7 @@ blockToHtmlInner opts (Header level (ident,classes,kvs) lst) = do
let contents' = if writerNumberSections opts && not (T.null secnum) let contents' = if writerNumberSections opts && not (T.null secnum)
&& "unnumbered" `notElem` classes && "unnumbered" `notElem` classes
then (H.span ! A.class_ "header-section-number" then (H.span ! A.class_ "header-section-number"
$ toHtml secnum) >> strToHtml " " >> contents $ toHtml secnum) >> toHtml ' ' >> contents
else contents else contents
html5 <- gets stHtml5 html5 <- gets stHtml5
let kvs' = if html5 let kvs' = if html5
@ -1373,14 +1373,14 @@ inlineToHtml opts inline = do
html5 <- gets stHtml5 html5 <- gets stHtml5
case inline of case inline of
(Str str) -> return $ strToHtml str (Str str) -> return $ strToHtml str
Space -> return $ strToHtml " " Space -> return $ toHtml ' '
SoftBreak -> return $ case writerWrapText opts of SoftBreak -> return $ case writerWrapText opts of
WrapNone -> " " WrapNone -> toHtml ' '
WrapAuto -> " " WrapAuto -> toHtml ' '
WrapPreserve -> nl WrapPreserve -> toHtml '\n'
LineBreak -> return $ do LineBreak -> return $ do
if html5 then H5.br else H.br if html5 then H5.br else H.br
strToHtml "\n" toHtml '\n'
(Span ("",[cls],[]) ils) (Span ("",[cls],[]) ils)
| cls == "csl-block" || cls == "csl-left-margin" || | cls == "csl-block" || cls == "csl-left-margin" ||
cls == "csl-right-inline" || cls == "csl-indent" cls == "csl-right-inline" || cls == "csl-indent"
@ -1449,10 +1449,10 @@ inlineToHtml opts inline = do
(Subscript lst) -> H.sub <$> inlineListToHtml opts lst (Subscript lst) -> H.sub <$> inlineListToHtml opts lst
(Quoted quoteType lst) -> (Quoted quoteType lst) ->
let (leftQuote, rightQuote) = case quoteType of let (leftQuote, rightQuote) = case quoteType of
SingleQuote -> (strToHtml "", SingleQuote -> (toHtml '',
strToHtml "") toHtml '')
DoubleQuote -> (strToHtml "", DoubleQuote -> (toHtml '“',
strToHtml "") toHtml '”')
in if writerHtmlQTags opts in if writerHtmlQTags opts
then do then do