commit 712b216a525618b255dac50e1c2f3f6527cfe67d
parent 273a7068f8df472d96e8785150d754a2cbb4f95c
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Wed, 1 Jul 2015 20:45:52 +0200
Split generateRSS into two functions.
The first one generates the Heading (title, url, etc.), the other one fills this
Rootnode with the entries.
Diffstat:
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/Fb2RSS.d b/Fb2RSS.d
@@ -249,21 +249,30 @@ class FBStream : RandomFiniteAssignable!(Post){
}
/**
- * Generates an XML-Document which validates as an Atom-Feed corresponding
- * to the Facebookpage found in #fetch_url, or the document in #document.
+ * Generates an XML-Document template to be filled with entries.
* @return The root-node of the Atom-Feed
*/
- private XmlNode generateRSS(){
+ public XmlNode getRSSRoot(){
XmlNode rss = new XmlNode("feed");
rss.setAttribute("xmlns","http://www.w3.org/2005/Atom");
rss.addChild(new XmlNode("id").addCData(url));
rss.addChild(new XmlNode("title").addCData(title));
+ return rss;
+ }
+
+ /**
+ * Generates an XML-Document which validates as an Atom-Feed corresponding
+ * to the Facebookpage found in #fetch_url, or the document in #document.
+ * @return The root-node of the Atom-Feed
+ */
+ public XmlNode generateRSS(){
+ XmlNode rss = getRSSRoot();
foreach(ref Post p; posts){
rss.addChild(p.getEntry());
}
return rss;
}
-
+
/**
* Writes a valid Atom-Feed xmlfile to the file specified
* @param into The file to write the feed to