(Arne Babenhauserheide)
2011-10-20: prepared an indexregexp for rewriting all filenames if they are in prepared an indexregexp for rewriting all filenames if they are in the way of index.html for manifests.
diff --git a/static.py b/static.py --- a/static.py +++ b/static.py @@ -16,10 +16,16 @@ without the interactivity). * Create the static-dir in the repo: - Overview: Readme + commits + template ✔ - Changes: Commit-Log + each commit as commit/<hex> ✔ - - source: a filetree, shown as sourcecode: src/<path> and raw/<path> + - source: a filetree, shown as sourcecode: src/<hex>/<path> and raw/<hex>/<path> + with linenumbers as HTML (src) and as plain files (raw) + file-links in revision infos: link to the latest change in the file. + → manifest ⇒ filelog ⇒ revision before the current. + src/<hex>/index.html: manifest with file-links. + - Upload it to ftp - if b is used: a bugtracker: issue/<id>/<name> - fork-/clone-info for each entry in [paths] with its incoming data (if it has some): - clone/<pathname>/ → commit log + possibly an associated issue in b. + clone/<pathname>/ → incoming log (commits) + possibly an associated issue in b. + - More complex Readme parsing. * Usage: - hg static [--name] [-r] [folder] → parse the static folder for the current revision. @@ -35,6 +41,7 @@ without the interactivity). import os from os.path import join, isdir, isfile, basename import shutil +import re import mercurial from mercurial import cmdutil from mercurial import commands @@ -58,6 +65,8 @@ templates = { "printstyle": """ """ } +_indexregexp = re.compile("^\\.*index.html$") + def parsereadme(filepath): """Parse the readme file""" @@ -165,6 +174,20 @@ def writecommits(ui, repo, target, name, cf.write(templates["foot"].replace("{reponame}", name)) +def escapename(filename): + """escape index.html as .index.html and .ind… as ..ind… and so fort.""" + if _indexregexp.match(filename) is not None: + return "." + filename + + +def writesourcetree(ui, repo, target, name): + """Write manifests for all commits and websites for all files. + + * For each file, write sites for all revisions where the file was changed: under src/<hex>/path as html site (with linenumbers and maybe colored source), under raw/<hex>/<path> as plain files. If there is an index.html file, write it as .index.html. If there also is .index.html, turn it to ..index.html, … + * For each commit write an index with links to the included files at their latest revisions before/at the commit. + """ + pass + def parsesite(ui, repo, target, **opts): """Create the static folder.""" idfile = join(target, _staticidentifier)