Source

hgblog / hooks.patch

# HG changeset patch
# Parent 9f22f388d2b183eac9896ec340cd816649acac8b

diff --git a/hgblog/__init__.py b/hgblog/__init__.py
new file mode 100644
diff --git a/hgblog/generate_html.py b/hgblog/generate_html.py
new file mode 100644
--- /dev/null
+++ b/hgblog/generate_html.py
@@ -0,0 +1,19 @@
+from mercurial.match import match
+from sphinx.cmdline import main as sphinxify
+
+def htmlize_articles(ui, repo, **kwargs):
+    """Calls on Sphinx to turn our .rst files into pretty HTML"""
+
+    # find all .rst files that Mercurial is currently tracking
+    m = match(repo.root, repo.getcwd(), ('*.rst',), default='relglob')
+    files_to_consider = repo[None].walk(m)
+
+    # tell Sphinx to HTML-ize the .rst files we found
+    args = [
+        '-bdirhtml',
+        '-dbuild/doctrees',
+        'source',
+        'build/html',
+    ] + files_to_consider
+    sphinxify(args)
+