diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-05 07:28:45 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-05 07:28:45 +0000 |
commit | 90c335c463f4fb706aa34e543476ea0263b5b308 (patch) | |
tree | b43459a1714da0803e9e7e3dcfce180a0ceb2e82 | |
parent | 8671bc5a1be38f6555e34d7ccc542ebbe91f69fd (diff) | |
download | pandoc-90c335c463f4fb706aa34e543476ea0263b5b308.tar.gz |
Added stripTags to Text.Pandoc.XML.
This is used in the HTML writer.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1647 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/XML.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs index 14e2eebbb..a5d0202e5 100644 --- a/src/Text/Pandoc/XML.hs +++ b/src/Text/Pandoc/XML.hs @@ -27,7 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Functions for escaping and formatting XML. -} -module Text.Pandoc.XML ( escapeCharForXML, +module Text.Pandoc.XML ( stripTags, + escapeCharForXML, escapeStringForXML, inTags, selfClosingTag, @@ -35,6 +36,16 @@ module Text.Pandoc.XML ( escapeCharForXML, inTagsIndented ) where import Text.PrettyPrint.HughesPJ +-- | Remove everything between <...> +stripTags :: String -> String +stripTags ('<':xs) = + let (_,rest) = break (=='>') xs + in if null rest + then "" + else stripTags (tail rest) -- leave off > +stripTags (x:xs) = x : stripTags xs +stripTags [] = [] + -- | Escape one character as needed for XML. escapeCharForXML :: Char -> String escapeCharForXML x = case x of |