aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-10-08 21:36:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-10-08 21:36:08 -0700
commit2d4214fa3141f4a1cbde67f4e170a5bc5e639f32 (patch)
tree3555399b8053740be5dd92fada7f10e3e849b067 /src
parentf19286cf120f259c51a89b1b3643d437ede70a94 (diff)
downloadpandoc-2d4214fa3141f4a1cbde67f4e170a5bc5e639f32.tar.gz
Extend fix to #6719 to JATS reader
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 69d597212..c638da519 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -26,7 +26,7 @@ import Text.HTML.TagSoup.Entity (lookupEntity)
import Text.Pandoc.Builder
import Text.Pandoc.Class.PandocMonad (PandocMonad)
import Text.Pandoc.Options
-import Text.Pandoc.Shared (crFilter, safeRead)
+import Text.Pandoc.Shared (crFilter, safeRead, extractSpaces)
import Text.TeXMath (readMathML, writeTeX)
import Text.XML.Light
import qualified Data.Set as S (fromList, member)
@@ -460,14 +460,14 @@ parseInline (CRef ref) =
return . text . maybe (T.toUpper $ T.pack ref) T.pack $ lookupEntity ref
parseInline (Elem e) =
case qName (elName e) of
- "italic" -> emph <$> innerInlines
- "bold" -> strong <$> innerInlines
- "strike" -> strikeout <$> innerInlines
- "sub" -> subscript <$> innerInlines
- "sup" -> superscript <$> innerInlines
- "underline" -> underline <$> innerInlines
+ "italic" -> innerInlines emph
+ "bold" -> innerInlines strong
+ "strike" -> innerInlines strikeout
+ "sub" -> innerInlines subscript
+ "sup" -> innerInlines superscript
+ "underline" -> innerInlines underline
"break" -> return linebreak
- "sc" -> smallcaps <$> innerInlines
+ "sc" -> innerInlines smallcaps
"code" -> codeWithLang
"monospace" -> codeWithLang
@@ -477,14 +477,14 @@ parseInline (Elem e) =
qt <- gets jatsQuoteType
let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
modify $ \st -> st{ jatsQuoteType = qt' }
- contents <- innerInlines
+ contents <- innerInlines id
modify $ \st -> st{ jatsQuoteType = qt }
return $ if qt == SingleQuote
then singleQuoted contents
else doubleQuoted contents
"xref" -> do
- ils <- innerInlines
+ ils <- innerInlines id
let rid = attrValue "rid" e
let rids = T.words rid
let refType = ("ref-type",) <$> maybeAttrValue "ref-type" e
@@ -501,7 +501,7 @@ parseInline (Elem e) =
ils
else linkWith attr ("#" <> rid) "" ils
"ext-link" -> do
- ils <- innerInlines
+ ils <- innerInlines id
let title = fromMaybe "" $ findAttrText (QName "title" (Just "http://www.w3.org/1999/xlink") Nothing) e
let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
Just h -> T.pack h
@@ -520,8 +520,8 @@ parseInline (Elem e) =
"uri" -> return $ link (textContent e) "" $ str $ textContent e
"fn" -> note . mconcat <$>
mapM parseBlock (elContent e)
- _ -> innerInlines
- where innerInlines = trimInlines . mconcat <$>
+ _ -> innerInlines id
+ where innerInlines f = extractSpaces f . mconcat <$>
mapM parseInline (elContent e)
mathML x =
case readMathML . T.pack . showElement $ everywhere (mkT removePrefix) x of