hg site extension
 
(Arne Babenhauserheide)
2012-10-30: write all bugs to simple files in the style of the commits. write-bug-details-1d631d51ff06b3bdca50e21da3d6a00bcb801c85

write all bugs to simple files in the style of the commits.

diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -558,20 +558,34 @@ def writebugs(ui, repo, target, name):
     # create the bugs folder
     if not os.path.isdir(bugdir):
         os.makedirs(bugdir)
-
+        
     # get all bugs
     openbugs, resolvedbugs = getbugs(ui, repo)
-    # write the bugs file
+    # write the bugs list
     bugslist = os.path.join(bugdir, "index.html")
     content = "<h2>Open Bugs</h2>\n<ul>"
     for bug in openbugs:
         content += "<li><a href=\"" + bug.fullid + ".html\">" + bug.shortid + "</a> - " + bug.description + "</li>\n"
+    content += "</ul>\n"
+    content += "<h2>Resolved Bugs</h2>\n<ul>"
+    for bug in resolvedbugs:
+        content += "<li><a href=\"" + bug.fullid + ".html\">" + bug.shortid + "</a> - " + bug.description + "</li>\n"
+    content += "</ul>\n"
     with open(bugslist, "w") as f:
         f.write(templates["head"].replace("{reponame}", "<a href='../'>"+name+"</a>").replace("{title}", name))
         f.write(content)
         f.write(templates["foot"].replace("{reponame}", "<a href='../'>"+name+"</a>"))
-    
-
+    # write all bug details
+    for bug in openbugs + resolvedbugs:
+        bugsfile = bugslist = os.path.join(bugdir, bug.fullid + ".html")
+        content = "<h2>" + bug.description + "</h2>\n"
+        content += "<pre>" + bug.details + "</pre>\n"
+        content += "<hr>"
+        content += "- <a href=\"index.html\">" + _("all bugs") + "</a> -"
+        with open(bugsfile, "w") as bf:
+            bf.write(templates["head"].replace("{reponame}", "<a href='../'>"+name+"</a>").replace("{title}", name))
+            bf.write(content)
+            bf.write(templates["foot"].replace("{reponame}", "<a href='../'>"+name+"</a>"))
 
 def escapename(filename):
     """escape index.html as .index.html and .ind… as ..ind… and so fort."""