@@ -27,7 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2727
2828Functions for escaping and formatting XML.
2929-}
30−module Text.Pandoc.XML ( escapeCharForXML,
30+module Text.Pandoc.XML ( stripTags,
31+ escapeCharForXML,
3132 escapeStringForXML,
3233 inTags,
3334 selfClosingTag,
@@ -35,6 +36,16 @@ module Text.Pandoc.XML ( escapeCharForXML,
3536 inTagsIndented ) where
3637import Text.PrettyPrint.HughesPJ
3738
39+-- | Remove everything between <...>
40+stripTags :: String -> String
41+stripTags ('<':xs) =
42+ let (_,rest) = break (=='>') xs
43+ in if null rest
44+ then ""
45+ else stripTags (tail rest) -- leave off >
46+stripTags (x:xs) = x : stripTags xs
47+stripTags [] = []
48+
3849-- | Escape one character as needed for XML.
3950escapeCharForXML :: Char -> String
4051escapeCharForXML x = case x of