Use renderTags' for all tag rendering.
This properly handles tags that should be self-closing. Previously `<hr/>` would appear in EPUB output as `<hr></hr>`. Closes #1420.
This commit is contained in:
parent
3516d9d09b
commit
cb62cd08e0
3 changed files with 5 additions and 5 deletions
|
@ -948,7 +948,7 @@ rawVerbatimBlock = try $ do
|
|||
["pre", "style", "script"])
|
||||
(const True))
|
||||
contents <- manyTill anyChar (htmlTag (~== TagClose tag))
|
||||
return $ open ++ contents ++ renderTags [TagClose tag]
|
||||
return $ open ++ contents ++ renderTags' [TagClose tag]
|
||||
|
||||
rawTeXBlock :: MarkdownParser (F Blocks)
|
||||
rawTeXBlock = do
|
||||
|
|
|
@ -784,7 +784,7 @@ transformBlock opts mediaRef (RawBlock fmt raw)
|
|||
| fmt == Format "html" = do
|
||||
let tags = parseTags raw
|
||||
tags' <- mapM (transformTag opts mediaRef) tags
|
||||
return $ RawBlock fmt (renderTags tags')
|
||||
return $ RawBlock fmt (renderTags' tags')
|
||||
transformBlock _ _ b = return b
|
||||
|
||||
transformInline :: WriterOptions
|
||||
|
@ -804,7 +804,7 @@ transformInline opts mediaRef (RawInline fmt raw)
|
|||
| fmt == Format "html" = do
|
||||
let tags = parseTags raw
|
||||
tags' <- mapM (transformTag opts mediaRef) tags
|
||||
return $ RawInline fmt (renderTags tags')
|
||||
return $ RawInline fmt (renderTags' tags')
|
||||
transformInline _ _ x = return x
|
||||
|
||||
writeHtmlInline :: WriterOptions -> Inline -> String
|
||||
|
|
|
@ -46,7 +46,7 @@ import Control.Monad.State
|
|||
import qualified Data.Set as Set
|
||||
import Text.Pandoc.Writers.HTML (writeHtmlString)
|
||||
import Text.Pandoc.Readers.TeXMath (readTeXMath')
|
||||
import Text.HTML.TagSoup (renderTags, parseTags, isTagText, Tag(..))
|
||||
import Text.HTML.TagSoup (parseTags, isTagText, Tag(..))
|
||||
import Network.URI (isURI)
|
||||
import Data.Default
|
||||
import Data.Yaml (Value(Object,String,Array,Bool,Number))
|
||||
|
@ -471,7 +471,7 @@ addMarkdownAttribute :: String -> String
|
|||
addMarkdownAttribute s =
|
||||
case span isTagText $ reverse $ parseTags s of
|
||||
(xs,(TagOpen t attrs:rest)) ->
|
||||
renderTags $ reverse rest ++ (TagOpen t attrs' : reverse xs)
|
||||
renderTags' $ reverse rest ++ (TagOpen t attrs' : reverse xs)
|
||||
where attrs' = ("markdown","1"):[(x,y) | (x,y) <- attrs,
|
||||
x /= "markdown"]
|
||||
_ -> s
|
||||
|
|
Loading…
Add table
Reference in a new issue