aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index b656dd90..40e00a4d 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -267,6 +267,7 @@ class Root:
html += """<form method=get action="/export/"><select name="export_method">\n"""
html += """\t<option value="export_HTML" selected='selected'>HTML</option>\n"""
html += """\t<option value="export_TXT">Text</option>\n"""
+ html += """\t<option value="export_dokuwiki">DokuWiki</option>\n"""
html += """</select><input type="submit" value="Export"></form>\n"""
html += "<hr />\n\n"
@@ -1036,7 +1037,7 @@ class Root:
"""
for rss_feed_id in self.feeds.keys():
folder = utils.path + "/var/export/" + \
- utils.normalize_filename(self.feeds[rss_feed_id][3].strip().encode("utf-8"))
+ utils.normalize_filename(self.feeds[rss_feed_id][3].strip().encode("utf-8").replace(':', '').lower())
try:
os.makedirs(folder)
except OSError:
@@ -1057,6 +1058,18 @@ class Root:
content += article[4].encode('utf-8')
content += "</div>\n<hr />\n"
content += htmlfooter
+ # Export for dokuwiki
+ # example: http://wiki.cedricbonhomme.org/doku.php/news-archives
+ if export_method == "export_dokuwiki":
+ name = os.path.normpath(folder + "/" + name.replace(':', '-') + ".txt")
+ f = open(name, "w")
+ content = "<html>"
+ content += '\n<div style="width: 50%; overflow:hidden; text-align: justify; margin:0 auto">\n'
+ content += """<h1><a href="%s">%s</a></h1><br />""" % \
+ (article[3].encode('utf-8'), article[2].encode('utf-8'))
+ content += article[4].encode('utf-8')
+ content += "</div></html>\n<hr />\n"
+ content += htmlfooter
# Export all articles in raw text
elif export_method == "export_TXT":
name = os.path.normpath(folder + "/" + name + ".txt")
bgstack15