aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2010-06-29 21:02:51 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2010-06-29 21:02:51 -0700
commitd22799ca1d63e55d88fe0a3adf4c71904a591012 (patch)
tree4524a95d453030b9089ae96d8849d0b303ab24bb
parent92b749cfa26fafb3765aeb0be5486a16f9faa83d (diff)
downloadpycco-d22799ca1d63e55d88fe0a3adf4c71904a591012.tar.gz
pycco-d22799ca1d63e55d88fe0a3adf4c71904a591012.zip
Making pocco.py standalone, don't need the bin script
-rwxr-xr-xbin/pocco10
-rwxr-xr-x[-rw-r--r--]pocco.py10
2 files changed, 8 insertions, 12 deletions
diff --git a/bin/pocco b/bin/pocco
deleted file mode 100755
index 884d538..0000000
--- a/bin/pocco
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-
-lib = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
-cmd = "python %s %s" % (os.path.join(lib, 'pocco.py'),
- " ".join(sys.argv[1:]))
-
-print os.popen(cmd).read(),
diff --git a/pocco.py b/pocco.py
index 40e4691..667238e 100644..100755
--- a/pocco.py
+++ b/pocco.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# **Pocco** is a Python port of [Docco](http://jashkenas.github.com/docco/ ):
# the original quick-and-dirty, hundred-line-long, literate-programming-style
# documentation generator. It produces HTML that displays your comments
@@ -43,6 +45,8 @@ def generate_documentation(source):
#
def parse(source, code):
lines = code.split("\n")
+ if lines[0].startswith("#!"):
+ lines.pop(0)
sections = []
language = get_language(source)
has_code = docs_text = code_text = ""
@@ -168,10 +172,12 @@ def template(source):
return lambda context: pystache.render(source, context)
# Create the template that we will use to generate the Pocco HTML page.
-pocco_template = template(open(path.dirname(__file__) + "/resources/pocco.html").read())
+pocco_template = template(open(path.join(path.dirname(__file__),
+ "resources/pocco.html")).read())
# The CSS styles we"d like to apply to the documentation.
-pocco_styles = open(path.dirname(__file__) + "/resources/pocco.css").read()
+pocco_styles = open(path.join(path.dirname(__file__),
+ "resources/pocco.css")).read()
# The start of each Pygments highlight block.
highlight_start = "<div class=\"highlight\"><pre>"