@@ -26,7 +26,7 @@ import Text.Pandoc.Builder
2626import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
2727import Text.Pandoc.Options
2828import Text.Pandoc.Logging (LogMessage(..))
29−import Text.Pandoc.Shared (crFilter, safeRead)
29+import Text.Pandoc.Shared (crFilter, safeRead, extractSpaces)
3030import Text.TeXMath (readMathML, writeTeX)
3131import Text.XML.Light
3232
@@ -1065,19 +1065,19 @@ parseInline (Elem e) =
10651065 let ident = attrValue "id" e
10661066 let classes = T.words $ attrValue "class" e
10671067 if ident /= "" || classes /= []
1068− then spanWith (ident,classes,[]) <$> innerInlines
1069− else innerInlines
1068+ then innerInlines (spanWith (ident,classes,[]))
1069+ else innerInlines id
10701070 "equation" -> equation e displayMath
10711071 "informalequation" -> equation e displayMath
10721072 "inlineequation" -> equation e math
1073− "subscript" -> subscript <$> innerInlines
1074− "superscript" -> superscript <$> innerInlines
1073+ "subscript" -> innerInlines subscript
1074+ "superscript" -> innerInlines superscript
10751075 "inlinemediaobject" -> getMediaobject e
10761076 "quote" -> do
10771077 qt <- gets dbQuoteType
10781078 let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
10791079 modify $ \st -> st{ dbQuoteType = qt' }
1080− contents <- innerInlines
1080+ contents <- innerInlines id
10811081 modify $ \st -> st{ dbQuoteType = qt }
10821082 return $ if qt == SingleQuote
10831083 then singleQuoted contents
@@ -1098,7 +1098,7 @@ parseInline (Elem e) =
10981098 "replaceable" -> do x <- getInlines e
10991099 return $ str "<" <> x <> str ">"
11001100 "markup" -> codeWithLang
1101− "wordasword" -> emph <$> innerInlines
1101+ "wordasword" -> innerInlines emph
11021102 "command" -> codeWithLang
11031103 "varname" -> codeWithLang
11041104 "function" -> codeWithLang
@@ -1126,21 +1126,21 @@ parseInline (Elem e) =
11261126 "email" -> return $ link ("mailto:" <> T.pack (strContent e)) ""
11271127 $ str $ T.pack $ strContent e
11281128 "uri" -> return $ link (T.pack $ strContent e) "" $ str $ T.pack $ strContent e
1129− "ulink" -> link (attrValue "url" e) "" <$> innerInlines
1129+ "ulink" -> innerInlines (link (attrValue "url" e) "")
11301130 "link" -> do
1131− ils <- innerInlines
1131+ ils <- innerInlines id
11321132 let href = case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
11331133 Just h -> T.pack h
11341134 _ -> "#" <> attrValue "linkend" e
11351135 let ils' = if ils == mempty then str href else ils
11361136 let attr = (attrValue "id" e, T.words $ attrValue "role" e, [])
11371137 return $ linkWith attr href "" ils'
1138− "foreignphrase" -> emph <$> innerInlines
1138+ "foreignphrase" -> innerInlines emph
11391139 "emphasis" -> case attrValue "role" e of
1140− "bold" -> strong <$> innerInlines
1141− "strong" -> strong <$> innerInlines
1142− "strikethrough" -> strikeout <$> innerInlines
1143− _ -> emph <$> innerInlines
1140+ "bold" -> innerInlines strong
1141+ "strong" -> innerInlines strong
1142+ "strikethrough" -> innerInlines strikeout
1143+ _ -> innerInlines emph
11441144 "footnote" -> note . mconcat <$>
11451145 mapM parseBlock (elContent e)
11461146 "title" -> return mempty
@@ -1149,12 +1149,12 @@ parseInline (Elem e) =
11491149 -- <?asciidor-br?> to in handleInstructions, above. A kludge to
11501150 -- work around xml-light's inability to parse an instruction.
11511151 "br" -> return linebreak
1152− _ -> skip >> innerInlines
1152+ _ -> skip >> innerInlines id
11531153 where skip = do
11541154 lift $ report $ IgnoredElement $ T.pack $ qName (elName e)
11551155 return mempty
11561156
1157− innerInlines = trimInlines . mconcat <$>
1157+ innerInlines f = extractSpaces f . mconcat <$>
11581158 mapM parseInline (elContent e)
11591159 codeWithLang = do
11601160 let classes' = case attrValue "language" e of