Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18603067
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Paladox
May 29 2018, 10:00 PM
2018-05-29 22:00:55 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
root@planet-hotdog:/home/paladox# diff -u /usr/lib/python2.7/dist-packages/rawdoglib/rawdog.py /home/paladox/rawdog/rawdog-2.22/rawdoglib/rawdog.py
--- /usr/lib/python2.7/dist-packages/rawdoglib/rawdog.py 2016-10-11 18:38:18.000000000 +0000
+++ /home/paladox/rawdog/rawdog-2.22/rawdoglib/rawdog.py 2018-05-29 21:47:56.993239342 +0000
@@ -16,7 +16,7 @@
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA, or see http://www.gnu.org/.
-VERSION = "2.22"
+VERSION = "2.22-wmf1"
HTTP_AGENT = "rawdog/" + VERSION
STATE_VERSION = 2
@@ -898,6 +898,7 @@
"feeddefaults" : {},
"defines" : {},
"outputfile" : "output.html",
+ "oldpages" : 7,
"maxarticles" : 200,
"maxage" : 0,
"expireage" : 24 * 60 * 60,
@@ -1011,6 +1012,8 @@
load_plugins(dir, self)
elif l[0] == "outputfile":
self["outputfile"] = l[1]
+ elif l[0] == "oldpages":
+ self["oldpages"] = l[1]
elif l[0] == "maxarticles":
self["maxarticles"] = int(l[1])
elif l[0] == "maxage":
@@ -1736,7 +1739,7 @@
return bits
- def write_output_file(self, articles, article_dates, config):
+ def write_output_file(self, articles, article_dates, config, oldpage=0):
"""Write a regular rawdog HTML output file."""
f = StringIO()
dw = DayWriter(f, config)
@@ -1751,13 +1754,24 @@
dw.close()
call_hook("output_items_end", self, config, f)
+ if oldpage != config["oldpages"]:
+ filename = config["outputfile"].split("/")[-1:][0] # get the filename only
+ filename = filename.split(".html")
+ outputfile = filename[0] + str(oldpage+1) + ".html"
+ f.write('<p><a class="btn btn-mat" href="'+outputfile+'">Older blog entries</a></p>')
+
+
bits = self.get_main_template_bits(config)
bits["items"] = f.getvalue()
f.close()
bits["num_items"] = str(len(articles))
call_hook("output_bits", self, config, bits)
s = fill_template(self.get_template(config, "page"), bits)
- outputfile = config["outputfile"]
+ if oldpage > 0:
+ filename = config["outputfile"].split(".html")
+ outputfile = filename[0] + str(oldpage) + ".html"
+ else:
+ outputfile = config["outputfile"]
if outputfile == "-":
write_ascii(sys.stdout, s, config)
else:
@@ -1787,8 +1801,8 @@
if not call_hook("output_sort_articles", self, config, article_list):
article_list.sort()
- if config["maxarticles"] != 0:
- article_list = article_list[:config["maxarticles"]]
+ # if config["maxarticles"] != 0:
+ # article_list = article_list[:config["maxarticles"]]
if config["splitstate"]:
wanted = {}
@@ -1828,8 +1842,13 @@
config.log("Selected ", len(articles), " of ", numarticles, " articles to write; ignored ", dup_count, " duplicates")
- if not call_hook("output_write_files", self, config, articles, article_dates):
- self.write_output_file(articles, article_dates, config)
+ for page in range(0, config["oldpages"]+1):
+ print "on page: " + str(page)
+ if config["maxarticles"] != 0:
+ pageArticles = articles[config["maxarticles"]*page:config["maxarticles"]*(page+1)]
+
+ if not call_hook("output_write_files", self, config, pageArticles, article_dates):
+ self.write_output_file(pageArticles, article_dates, config, page)
config.log("Finished write")
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5853305
Default Alt Text
(3 KB)
Attached To
Mode
P7179 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment