aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorDaniele D'Orazio <d.dorazio96@gmail.com>2019-10-09 10:10:08 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-15 09:49:09 -0700
commit1425bf9a6549da00ca87832dc6f19d59269a6a83 (patch)
tree5afee855bf9c867ed2fce0edfd6ecf14fb04c02a /src/Text/Pandoc/Shared.hs
parenta1977dd2d67e6ccbafaf7ac25f941bdd399469fa (diff)
downloadpandoc-1425bf9a6549da00ca87832dc6f19d59269a6a83.tar.gz
Add support for reading and writing <kbd> elements
* Text.Pandoc.Shared: export `htmlSpanLikeElements` [API change] This commit also introduces a mapping of HTML span like elements that are internally represented as a Span with a single class, but that are converted back to the original element by the html writer. As of now, only the kbd element is handled this way. Ideally these elements should be handled as plain AST values, but since that would be a breaking change with a large impact, we revert to this stop-gap solution. Fixes https://github.com/jgm/pandoc/issues/5796.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index bcaa48ea1..765bc0826 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -67,6 +67,7 @@ module Text.Pandoc.Shared (
makeMeta,
eastAsianLineBreakFilter,
underlineSpan,
+ htmlSpanLikeElements,
splitSentences,
filterIpynbOutput,
-- * TagSoup HTML handling
@@ -694,6 +695,11 @@ eastAsianLineBreakFilter = bottomUp go
underlineSpan :: Inlines -> Inlines
underlineSpan = B.spanWith ("", ["underline"], [])
+-- | Set of HTML elements that are represented as Span with a class equal as
+-- the element tag itself.
+htmlSpanLikeElements :: Set.Set T.Text
+htmlSpanLikeElements = Set.fromList [T.pack "kbd"]
+
-- | Returns the first sentence in a list of inlines, and the rest.
breakSentence :: [Inline] -> ([Inline], [Inline])
breakSentence [] = ([],[])