### config_option(config, name, value)
+* name: the option name
+* value: the option value
+
Called when rawdog encounters a config file option that it doesn't
-recognise with the given name and value. The rawdoglib.rawdog.parse_*
-functions will probably be useful when dealing with config options. You
-can raise ValueError to have rawdog print an appropriate error message.
-You should return False from this hook if name is an option you
-recognise.
+recognise. The rawdoglib.rawdog.parse_* functions will probably be
+useful when dealing with config options. You can raise ValueError to
+have rawdog print an appropriate error message. You should return False
+from this hook if name is an option you recognise.
Note that using config.log in this hook will probably not do what you
want, because the verbose flag may not yet have been turned on.
+### output_filter(rawdog, config, articles)
+
+* articles: the mutable list of Article objects
+
+Called before rawdog sorts the list of articles to write. This hook can
+be used to remove articles that shouldn't be written.
+
+### output_sort(rawdog, config, articles)
+
+* articles: the mutable list of Article objects
+
+Called after rawdog has sorted the list of articles to write. This hook
+can be used to reorder (or completely resort) the list of articles to
+write.
+
+### output_write(rawdog, config, articles)
+
+* articles: the mutable list of Article objects
+
+Called just before rawdog starts writing the HTML output. This hook can
+be used to implement alternative output methods.
+
+### output_items_begin(rawdog, config, f)
+
+* f: a writable file object (__items__)
+
+Called before rawdog starts expanding the items template. This set of
+hooks can be used to implement alternative date (or other section)
+headings.
+
+### output_items_heading(rawdog, config, f, article, date)
+
+* f: a writable file object (__items__)
+* article: the Article object about to be written
+* date: the Article's date for sorting purposes
+
+Called before each item is written.
+
+### output_items_end(rawdog, config, f)
+
+* f: a writable file object (__items__)
+
+Called after all items are written.
+
else:
article_dates[a] = a.added
numarticles = len(articles)
+
def compare(a, b):
"""Compare two articles to decide how they
should be sorted. Sort by added date, then
if i != 0:
return i
return cmp(a.hash, b.hash)
+ plugins.call_hook("output_filter", self, config, articles)
articles.sort(compare)
+ plugins.call_hook("output_sort", self, config, articles)
+
if config["maxarticles"] != 0:
articles = articles[:config["maxarticles"]]
+ plugins.call_hook("output_write", self, config, articles)
+
f = StringIO()
itemtemplate = self.get_itemtemplate(config)
dw = DayWriter(f, config)
+ plugins.call_hook("output_items_begin", self, config, f)
seen_links = {}
seen_guids = {}
count += 1
dw.time(article_dates[article])
+ plugins.call_hook("output_items_heading", self, config, f, article, article_dates[article])
itembits = {}
for name, value in feed.args.items():
f.write(fill_template(itemtemplate, itembits))
dw.close()
+ plugins.call_hook("output_items_end", self, config, f)
+
bits["items"] = f.getvalue()
bits["num_items"] = str(numarticles)
config.log("Selected ", count, " of ", numarticles, " articles to write; ignored ", dup_count, " duplicates")