From e4652b267a04401b528b4c19fa81da6dcbc32ff1 Mon Sep 17 00:00:00 2001 From: John Conway Date: Fri, 10 May 2019 11:09:16 +0100 Subject: [Atom, RSS] More tests, CDATA fix --- src/feednim/atom.nim | 36 +++++++++++++++++++++--------------- src/feednim/rss.nim | 15 ++++++++++----- 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'src/feednim') diff --git a/src/feednim/atom.nim b/src/feednim/atom.nim index a432844..bbdcbe9 100644 --- a/src/feednim/atom.nim +++ b/src/feednim/atom.nim @@ -12,7 +12,7 @@ import streams import sugar type - AtomCommon = ref object of RootObj # These properties aren't gathered yet + AtomCommon = ref object of RootObj # These properties aren't'gathered xmlbase*: string xmllang*: string @@ -92,7 +92,7 @@ type # Promotes text node to the top of an AtomText object if caller expects a string -converter atomToString*(obj: AtomText): string = +converter toString*(obj: AtomText): string = return obj.text @@ -140,13 +140,26 @@ func parseLink ( node: XmlNode ): AtomLink = if node.attr("length") != "": link.length = node.attr("length") return link +func parseText ( node: XmlNode ): string = + if node.attr("type") == "xhtml" or node.attr("type") == "html": + var content = "" + for item in node.items: + content = content & $item + # Strip CDATA + if content[0 .. 8] == "