diff options
| author | Elliot Bobrow <77182873+ebobrow@users.noreply.github.com> | 2022-07-06 13:10:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-06 22:10:24 +0200 |
| commit | 7fdc01ac0d91a037b48847939b762654174b4125 (patch) | |
| tree | 427d3c4cfc26e67e6a72ead286f75ed1738cfe5f /src/Text/Pandoc/Readers/HTML.hs | |
| parent | befa9d130181ff99d155a6df454c40fba0d9736a (diff) | |
Use `formatCode` from #7525 in HTML and MediaWiki (#8162)
Move formatting from inside inline code elements to the outside in order
to retain formatting.
Diffstat (limited to 'src/Text/Pandoc/Readers/HTML.hs')
| -rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 47b6af193..dd0e54c27 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -63,7 +63,7 @@ import Text.Pandoc.Options ( import Text.Pandoc.Parsing hiding ((<|>)) import Text.Pandoc.Shared ( addMetaField, blocksToInlines', escapeURI, extractSpaces, - htmlSpanLikeElements, renderTags', safeRead, tshow) + htmlSpanLikeElements, renderTags', safeRead, tshow, formatCode) import Text.Pandoc.Walk import Text.Parsec.Error import Text.TeXMath (readMathML, writeTeX) @@ -786,18 +786,20 @@ pSvg = do pCodeWithClass :: PandocMonad m => Text -> Text -> TagParser m Inlines pCodeWithClass name class' = try $ do TagOpen open attr' <- pSatisfy $ tagOpen (== name) (const True) - result <- manyTill pAny (pCloses open) let (ids,cs,kvs) = toAttr attr' cs' = class' : cs - return . B.codeWith (ids,cs',kvs) . - T.unwords . T.lines . innerText $ result + code open (ids,cs',kvs) pCode :: PandocMonad m => TagParser m Inlines pCode = try $ do (TagOpen open attr') <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True) let attr = toAttr attr' - result <- manyTill pAny (pCloses open) - return $ B.codeWith attr $ T.unwords $ T.lines $ innerText result + code open attr + +code :: PandocMonad m => Text -> Attr -> TagParser m Inlines +code open attr = do + result <- mconcat <$> manyTill inline (pCloses open) + return $ formatCode attr result -- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo -- Bidirectional Text Override |
