commit 73ce6e4704e63f76b6980069e2d12f22cf0901ce
parent 3cb58ac6ab49bd8bce1309e7036ce56973728ba8
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Tue, 4 Aug 2015 22:24:54 +0200
Render: Change associative Array to Tuple!(string,string)
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drss/render.d b/drss/render.d
@@ -1,19 +1,21 @@
module drss.render;
import kxml.xml;
import drss.rss;
+import std.typecons;
+import std.range;
-alias DRSS_Headers=string[string];
+public alias DRSS_Header=Tuple!(string, string);
-XmlNode getRSSRoot(DRSS_Headers h){
+XmlNode getRSSRoot(DRSS_Header h[]){
XmlNode rss = new XmlNode("feed");
rss.setAttribute("xmlns","http://www.w3.org/2005/Atom");
- foreach(string id, string value; h){
- rss.addChild(new XmlNode(id).addCData(value));
+ foreach(DRSS_Header hh; h){
+ rss.addChild(new XmlNode(hh[0]).addCData(hh[1]));
}
return rss;
}
-XmlNode generateRSS(T)(DRSS!(T) rss, DRSS_Headers h){
+XmlNode generateRSS(T)(DRSS!(T) rss, DRSS_Header h[]){
XmlNode root = getRSSRoot(h);
foreach(ref T p; rss.entries){
root.addChild(p.toXML());