aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-11-03 13:50:57 +0100
committercedricbonhomme <devnull@localhost>2010-11-03 13:50:57 +0100
commitd2680fdbf04aaa17809b9b812b0ce82b9031d033 (patch)
treec8a0c1ed10f6c6898648148bead72d39e17df9ca
parentRelease 2.1. Better export of articles in HTML format. Lot of improvements. N... (diff)
downloadnewspipe-d2680fdbf04aaa17809b9b812b0ce82b9031d033.tar.gz
newspipe-d2680fdbf04aaa17809b9b812b0ce82b9031d033.tar.bz2
newspipe-d2680fdbf04aaa17809b9b812b0ce82b9031d033.zip
Export of the base of articles for 'dokuwiki'. Example: http://wiki.cedricbonhomme.org/doku.php/news-archives .
-rwxr-xr-xpyAggr3g470r.py15
-rwxr-xr-xvar/feed.lst2
2 files changed, 15 insertions, 2 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")
diff --git a/var/feed.lst b/var/feed.lst
index 997243ae..bf742b68 100755
--- a/var/feed.lst
+++ b/var/feed.lst
@@ -1,6 +1,6 @@
-http://cedric.bonhomme.free.fr/blog/index.php/feed/
http://feeds2.feedburner.com/diveintomark/all
http://www.foo.be/cgi-bin/wiki.pl?action=journal&tile=AdulauMessyDesk
+http://blog.cedricbonhomme.org/feed/
http://blog.bnjgat.fr/index.php?feed/rss2
http://standblog.org/blog/feed/atom
http://www.haypocalc.com/blog/rss.php
bgstack15