summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Gateley <christopher.gateley@gmail.com>2010-12-04 07:10:28 -0600
committerU-Chris-PC\Chris <Chris@Chris-PC.(none)>2010-12-04 07:11:34 -0600
commitb58bee05ebaf36b24edf45689094b63265267551 (patch)
tree8de95a03c4d605408413eeef644979b34333eea5
parent9376e354d6b53042a51dd9af15de5bd3f7d91f36 (diff)
downloadpycco-b58bee05ebaf36b24edf45689094b63265267551.tar.gz
Added support for multiple header levels. Previously only h3 was allowed.
-rw-r--r--pycco/main.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pycco/main.py b/pycco/main.py
index f9e5fa4..18bf085 100644
--- a/pycco/main.py
+++ b/pycco/main.py
@@ -171,12 +171,13 @@ def preprocess(comment, section_nr, preserve_paths=True, outdir=None):
outdir=outdir)))
def replace_section_name(match):
- return '### <span id="%(id)s" href="%(id)s">%(name)s</span>' % {
- "id" : sanitize_section_name(match.group(1)),
- "name" : match.group(1)
+ return '%(lvl)s <span id="%(id)s" href="%(id)s">%(name)s</span>' % {
+ "lvl" : re.sub('=', '#', match.group(1)),
+ "id" : sanitize_section_name(match.group(2)),
+ "name" : match.group(2)
}
- comment = re.sub('^===(.+)===\\n', replace_section_name, comment)
+ comment = re.sub('^([=]+)([^=]+)[=]*\\n', replace_section_name, comment)
comment = re.sub('[^`]\[\[(.+)\]\]', replace_crossref, comment)
return comment