summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiogo Laginha <dmachado@ipn.pt>2011-12-17 18:36:41 +0000
committerDiogo Laginha <dmachado@ipn.pt>2011-12-17 18:36:41 +0000
commit816bcd84b2b65fbec038861dac894f9a19959503 (patch)
tree997c23dd7ba58b8a9b0a9e6e1343a3dfa5eab7bb
parent1f1d0c5bf48ea7cb2ff73b6a0e98d4a788aa7338 (diff)
downloadpycco-816bcd84b2b65fbec038861dac894f9a19959503.tar.gz
generate html using -a (get-all-files) option
-rw-r--r--pycco/main.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pycco/main.py b/pycco/main.py
index d1fbacf..ab82cb7 100644
--- a/pycco/main.py
+++ b/pycco/main.py
@@ -46,9 +46,9 @@ def generate_documentation(source, outdir=None, preserve_paths=True):
if not outdir:
raise TypeError("Missing the required 'outdir' keyword argument.")
- fh = open(source, "r")
- sections = parse(source, fh.read())
- highlight(source, sections, preserve_paths=preserve_paths, outdir=outdir)
+ fh = open(source.name, "r")
+ sections = parse(source.name, fh.read())
+ highlight(source.name, sections, preserve_paths=preserve_paths, outdir=outdir)
return generate_html(source, sections, preserve_paths=preserve_paths, outdir=outdir)
def parse(source, code):
@@ -238,18 +238,18 @@ def generate_html(source, sections, preserve_paths=True, outdir=None):
if not outdir:
raise TypeError("Missing the required 'outdir' keyword argument")
- title = path.basename(source)
- dest = destination(source, preserve_paths=preserve_paths, outdir=outdir)
+
+ dest = destination(source.save_path(), 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,
+ "title" : source.title,
"stylesheet" : csspath,
"sections" : sections,
- "source" : source,
+ "source" : source.name,
"path" : path,
"destination" : destination
})
@@ -413,7 +413,7 @@ def process(sources, preserve_paths=True, outdir=None):
with open(dest, "w") as f:
f.write(generate_documentation(s, preserve_paths=preserve_paths, outdir=outdir))
- print "pycco = %s -> %s" % (s, dest)
+ print "pycco = %s -> %s" % (s.name, dest)
__all__ = ("process", "generate_documentation")