summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrey Hunner <treyhunner@gmail.com>2011-09-30 13:09:38 -0700
committerTrey Hunner <treyhunner@gmail.com>2011-09-30 13:09:38 -0700
commitfa778aab02f29a1371790088b58d3a5f70f233d1 (patch)
treec7701762faa67ca6447a229a1ea8d19b68fca672
parent84decc5d5e4ec0f3bd2ffa5bd8b4467ee1b329a5 (diff)
parent9b42946fae23601a755ca9d60161a0cf2d6c2eec (diff)
downloadpycco-fa778aab02f29a1371790088b58d3a5f70f233d1.tar.gz
Merge pull request #27 from mdornseif/master
Fix CSS Paths and escape regex match
-rw-r--r--pycco/main.py6
-rw-r--r--testcases/python.py9
2 files changed, 12 insertions, 3 deletions
diff --git a/pycco/main.py b/pycco/main.py
index d058fcb..98cd581 100644
--- a/pycco/main.py
+++ b/pycco/main.py
@@ -235,14 +235,14 @@ def generate_html(source, sections, preserve_paths=True, outdir=None):
raise TypeError("Missing the required 'outdir' keyword argument")
title = path.basename(source)
dest = destination(source, preserve_paths=preserve_paths, outdir=outdir)
+ csspath = path.relpath(path.join(outdir, "pycco.css"), path.split(dest)[0])
for sect in sections:
sect["code_html"] = re.sub(r"\{\{", r"__DOUBLE_OPEN_STACHE__", sect["code_html"])
rendered = pycco_template({
"title" : title,
- "stylesheet" : path.relpath(path.join(path.dirname(dest), "pycco.css"),
- path.split(dest)[0]),
+ "stylesheet" : csspath,
"sections" : sections,
"source" : source,
"path" : path,
@@ -393,7 +393,7 @@ def process(sources, preserve_paths=True, outdir=None):
pass
with open(destination(s, preserve_paths=preserve_paths, outdir=outdir), "w") as f:
- f.write(generate_documentation(s, outdir=outdir))
+ f.write(generate_documentation(s, preserve_paths=preserve_paths, outdir=outdir))
print "pycco = %s -> %s" % (s, dest)
diff --git a/testcases/python.py b/testcases/python.py
new file mode 100644
index 0000000..e225b18
--- /dev/null
+++ b/testcases/python.py
@@ -0,0 +1,9 @@
+import datetime
+
+# Comment 1
+class Class(object):
+ """Docstring 1"""
+ def get(self):
+ """Docstring 2"""
+ # Comment 2 - pycco puts the function into the documntation not the code
+ datum = datetime.date.today()