[Checkins] SVN: grok/trunk/ Make generation of website a bit easier: the generation script is now

Philipp von Weitershausen philikon at philikon.de
Thu Jul 12 12:00:33 EDT 2007


Log message for revision 77765:
  Make generation of website a bit easier: the generation script is now
  packaged in a (development) egg which is included in the buildout (you
  can run it via bin/grok2html). You no longer have to have an installed
  Zope3, it simply uses the same eggs that grok does.
  

Changed:
  U   grok/trunk/buildout.cfg
  U   grok/trunk/doc/grok2html.py
  A   grok/trunk/doc/setup.py

-=-
Modified: grok/trunk/buildout.cfg
===================================================================
--- grok/trunk/buildout.cfg	2007-07-12 15:58:04 UTC (rev 77764)
+++ grok/trunk/buildout.cfg	2007-07-12 16:00:33 UTC (rev 77765)
@@ -1,8 +1,12 @@
 [buildout]
-develop = . grokwiki ldapaddressbook
-parts = grokwiki instance data test
+develop = . doc grokwiki ldapaddressbook
+parts = docs grokwiki instance data test
 find-links = http://download.zope.org/distribution/
 
+[docs]
+recipe = zc.recipe.egg
+eggs = grokdocs
+
 [zope3]
 # this dead chicken is needed by some other recipe(s)
 location =

Modified: grok/trunk/doc/grok2html.py
===================================================================
--- grok/trunk/doc/grok2html.py	2007-07-12 15:58:04 UTC (rev 77764)
+++ grok/trunk/doc/grok2html.py	2007-07-12 16:00:33 UTC (rev 77765)
@@ -2,8 +2,6 @@
 import codecs
 import sys
 
-sys.path.append('/opt/odd-bobs/Zope3/src')
-
 import docutils.core
 from docutils.writers.html4css1 import Writer
 
@@ -22,9 +20,11 @@
             'halt_level': 6,
             'input_encoding': 'utf8',
             'output_encoding': 'utf8',
-            'initial_header_level': 2
+            'initial_header_level': 2,
+            # don't try to include the stylesheet (docutils gets hiccups)
+            'stylesheet_path': '',
         }
-            # 'output_encoding': 'utf8',
+
         writer = Writer()
         writer.translator_class = ZopeTranslator
         html = docutils.core.publish_string(
@@ -113,14 +113,19 @@
         {'href':'/minitutorials/index.html','title':u'How Tos','klass':''},
         ]
 
-if __name__ == '__main__':
-    source_dir = '.'
-    www_dir = '/opt/odd-bobs/grok-www'
+def main(argv=None):
+    if argv is None:
+        argv = sys.argv[1:]
+
+    if not len(argv) == 1:
+        print "Usage: grok2html OUTDIR"
+        sys.exit(1)
+
+    source_dir = os.path.dirname(__file__)
+    os.chdir(source_dir)
+    www_dir = argv[0]
+
     rest_files = []
-    if www_dir == '':
-        print 'Please define the target directory for html files'
-        import sys
-        sys.exit()
     rest_files.append(RestFile('index', 
                               os.path.join(source_dir, 'index.txt'),
                               os.path.join(www_dir, 'index.html')))
@@ -142,3 +147,5 @@
     template = PageTemplateFile(os.path.join(source_dir, 'template.pt'))
     create_html(rest_files, template)
 
+if __name__ == '__main__':
+    main()

Added: grok/trunk/doc/setup.py
===================================================================
--- grok/trunk/doc/setup.py	                        (rev 0)
+++ grok/trunk/doc/setup.py	2007-07-12 16:00:33 UTC (rev 77765)
@@ -0,0 +1,14 @@
+from setuptools import setup, find_packages
+
+setup(
+    name='grokdocs',
+    install_requires=['docutils',
+                      'zope.pagetemplate',
+                      'zope.app.renderer'
+                      ],
+    py_modules = ['grok2html'],
+    entry_points="""
+    [console_scripts]
+    grok2html = grok2html:main
+    """
+    )


Property changes on: grok/trunk/doc/setup.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list