From 0e64b7c0933a1993dc3d31770c1550cea4d10f04 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 9 Jul 2010 11:49:17 -0700 Subject: [PATCH] Moving the resources in to their own module to ensure that setup.py installs them correctly. --- pycco | 9 ++-- pycco_resources/{pycco.css => __init__.py} | 53 +++++++++++++++++++++- pycco_resources/pycco.html | 46 ------------------- setup.py | 1 + 4 files changed, 58 insertions(+), 51 deletions(-) rename pycco_resources/{pycco.css => __init__.py} (86%) delete mode 100644 pycco_resources/pycco.html diff --git a/pycco b/pycco index bc1ce3f..e9a4866 100755 --- a/pycco +++ b/pycco @@ -110,6 +110,9 @@ def generate_html(source, sections): #### Helpers & Setup +# This module contains all of our static resources. +import pycco_resources + # Import our external dependencies. import pygments import pystache @@ -188,12 +191,10 @@ def template(source): return lambda context: pystache.render(source, context) # Create the template that we will use to generate the Pycco HTML page. -pycco_template = template(open(path.join(path.dirname(__file__), - "resources/pycco.html")).read()) +pycco_template = template(pycco_resources.html) # The CSS styles we"d like to apply to the documentation. -pycco_styles = open(path.join(path.dirname(__file__), - "resources/pycco.css")).read() +pycco_styles = pycco_resources.css # The start of each Pygments highlight block. highlight_start = "
"
diff --git a/pycco_resources/pycco.css b/pycco_resources/__init__.py
similarity index 86%
rename from pycco_resources/pycco.css
rename to pycco_resources/__init__.py
index 921633b..a7b8cd9 100644
--- a/pycco_resources/pycco.css
+++ b/pycco_resources/__init__.py
@@ -1,3 +1,4 @@
+css = """\
 /*--------------------- Layout and Typography ----------------------------*/
 body {
   font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
@@ -182,4 +183,54 @@ body .bp { color: #954121 }                     /* Name.Builtin.Pseudo */
 body .vc { color: #19469D }                     /* Name.Variable.Class */
 body .vg { color: #19469D }                     /* Name.Variable.Global */
 body .vi { color: #19469D }                     /* Name.Variable.Instance */
-body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
\ No newline at end of file
+body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
+"""
+
+html = """\
+
+
+
+  
+  {{ title }}
+  
+
+
+
+
+ {{#sources?}} +
+ Jump To … +
+
+ {{#sources}} + {{ basename }} + {{/sources}} +
+
+
+ {{/sources?}} + + + + + + + + + {{#sections}} + + + + + {{/sections}} +

{{ title }}

+
+ # +
+ {{{ docs_html }}} +
+
{{{ code_html }}}
+
+
+ +""" diff --git a/pycco_resources/pycco.html b/pycco_resources/pycco.html deleted file mode 100644 index 67ba4e0..0000000 --- a/pycco_resources/pycco.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - {{ title }} - - - -
-
- {{#sources?}} -
- Jump To … -
-
- {{#sources}} - {{ basename }} - {{/sources}} -
-
-
- {{/sources?}} - - - - - - - - - {{#sections}} - - - - - {{/sections}} -

{{ title }}

-
- # -
- {{{ docs_html }}} -
-
{{{ code_html }}}
-
-
- diff --git a/setup.py b/setup.py index 135657f..c7c0b5a 100644 --- a/setup.py +++ b/setup.py @@ -7,4 +7,5 @@ setup(name="Pycco", author="Nick Fitzgerald", author_email="fitzgen@gmail.com", url="http://fitzgen.github.com/pocco", + packages=["pycco_resources"], scripts=["pycco"]) -- 2.43.0