hg site extension
 
(Arne Babenhauserheide)
2012-11-04: src highlighting works in lower levels in the tree, too.

src highlighting works in lower levels in the tree, too.

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -1,5 +1,5 @@
 push all bookmarks too                                       | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:0661fcb89dfedcd564bdb2d4865d41b58494ac2e, time:1320547191.52
-add sourcecode coloring to the src files.                    | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:09715a67cfabe2de0901f0472610c2285626e0e7, time:1319147685.11
+add sourcecode coloring to the src files.                    | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:09715a67cfabe2de0901f0472610c2285626e0e7, time:1319147685.11
 offer different and customizeable ways to parse a site, including to just call an external applications. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:0ed55f757a6352bc3b2674153a3dc8eda91db843, time:1332932026.35
 Add a list of branches, heads and tags to the summary page.  | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:0fde104c4206be8245ff0716ee2e91ea3971db8f, time:1319147651.17
 if b is used: a bugtracker: issue/<id>/<name>                | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:1d631d51ff06b3bdca50e21da3d6a00bcb801c85, time:1319147632.52
diff --git a/staticsite.py b/staticsite.py
--- a/staticsite.py
+++ b/staticsite.py
@@ -690,6 +690,7 @@ def writesourcetree(ui, repo, target, na
                     f.write(filectx.data())
             # then write it as html
             _filenameescaped = escapename(filectx.path())
+            numberofslashes = len([i for i in _filenameescaped if i == "/"])
             filepath = srcpath(target,ctx,_filenameescaped)
             if not force and os.path.isfile(filepath):
                 continue
@@ -697,7 +698,7 @@ def writesourcetree(ui, repo, target, na
                 os.makedirs(os.path.dirname(filepath))
             except OSError: pass # exists
             with open(filepath, "w") as f:
-                f.write(templates["srchead"].replace("{filetitle}", name+": " + filename))
+                f.write(templates["srchead"].replace("{filetitle}", name+": " + filename).replace("href=\"../../", "href=\"../../" + "../"*numberofslashes))
                 f.write(parsesrcdata(filectx.data()))
                 f.write(templates["foot"].replace("{reponame}", name))
     # then write manifests for all commits