[z3-checkins] r5560 - z3/util/trunk
faassen at codespeak.net
faassen at codespeak.net
Wed Jul 14 17:06:22 MEST 2004
Author: faassen
Date: Wed Jul 14 17:06:21 2004
New Revision: 5560
Modified:
z3/util/trunk/mkwebsite.py
Log:
Clean up website creation script.
Modified: z3/util/trunk/mkwebsite.py
==============================================================================
--- z3/util/trunk/mkwebsite.py (original)
+++ z3/util/trunk/mkwebsite.py Wed Jul 14 17:06:21 2004
@@ -7,91 +7,130 @@
'http://codespeak.net/svn/z3/%s/trunk/%s' % (package, path)),
name)
-website = publish.Website('/home/faassen/tmp/testwebsite')
+def createWebSite(path):
+ """Create the website from various resources, and save.
-main_layouter = publish.FileSimpleLayouter(
- 'layout/main_layout.html',
- style='style.css',
- banner='five-head.png',
- site_links=[('Z3 Base', 'index.html'),
- ('Five', 'five'),
- ]
- )
-
-page_site_links = [
- ('Z3 Base', '..'),
- ('Five', '../five'),
- ]
-
-page_layouter = publish.FileSimpleLayouter(
- 'layout/layout.html',
- style='../style.css',
- banner='../five-head.png',
- site_links=page_site_links,
- )
-
-redirect_layouter = publish.FileSimpleLayouter(
- 'layout/redirect.html',
- style='style.css',
- banner='five-head.png',
- site_links=page_site_links,
- )
-
-website.registerPages(
- [
- Z3Page('www', 'index.txt'),
- ],
- main_layouter,
- '.',
- quick_links=[
- ('svn (the code)', 'http://codespeak.net/svn/z3/'),
- ('z3-checkins mailing list', 'http://codespeak.net/mailman/listinfo/z3-checkins'),
- ]
- )
-
-five_nav_links = [
- ('Five main', 'index.html'),
- ('Features', 'features.html'),
- ('Directives', 'directives.html'),
- ('Manual', 'manual.html')
- ]
-
-website.registerPages(
- [
- Z3Page('Five', 'doc/main.txt', 'index'),
- Z3Page('Five', 'doc/features.txt'),
- Z3Page('Five', 'doc/directives.txt'),
- Z3Page('Five', 'doc/manual.txt'),
- ],
- page_layouter,
- 'five',
- quick_links=[
- ('svn (the code)', 'http://codespeak.net/svn/z3/Five/'),
- ('z3-five mailing list', 'http://codespeak.net/mailman/listinfo/z3-five'),
- ('z3-checkins mailing list', 'http://codespeak.net/mailman/listinfo/z3-checkins'),
- ],
- nav_links=five_nav_links,
- )
-
-# redirect old five page
-website.registerPages(
- [
- publish.SimplePage('five'),
- ],
- redirect_layouter,
- '.',
- url='http://codespeak.net/z3/five',
- )
-
-# register essential resources
-website.registerResources(
- [
- publish.FileResource('resource/style.css'),
- publish.FileResource('resource/five-head.png'),
- publish.FileResource('resource/h4_rightmenu.gif'),
- publish.FileResource('resource/pattern.png'),
- ],
- '.',
- )
+ path - directory to store the created website.
+ """
-website.save()
+ # the project links
+ main_project_links = [
+ ('Z3 Base', 'index.html'),
+ ('Five', 'five'),
+ ]
+
+ # layouter for pages in the website root
+ main_layouter = publish.FileSimpleLayouter(
+ 'layout/main_layout.html',
+ style='style.css',
+ banner='five-head.png',
+ site_links=main_project_links,
+ )
+
+ # construct project links for pages under main from main_project_links
+ project_links = []
+ for name, link in main_project_links:
+ if link == 'index.html':
+ link = '..'
+ else:
+ link = '../' + link
+ project_links.append((name, link))
+
+ # layouter for pages in directories under root
+ page_layouter = publish.FileSimpleLayouter(
+ 'layout/layout.html',
+ style='../style.css',
+ banner='../five-head.png',
+ site_links=project_links,
+ )
+
+ # layouter for redirect pages
+ redirect_layouter = publish.FileSimpleLayouter(
+ 'layout/redirect.html',
+ style='style.css',
+ banner='five-head.png',
+ site_links=project_links,
+ )
+
+ # create a website object
+ website = publish.Website(path)
+
+ # register essential resources in root of site
+ website.registerResources(
+ [
+ publish.FileResource('resource/style.css'),
+ publish.FileResource('resource/five-head.png'),
+ publish.FileResource('resource/h4_rightmenu.gif'),
+ publish.FileResource('resource/pattern.png'),
+ ],
+ '.',
+ )
+
+ # register pages for root of site
+ main_quick_links = [
+ ('svn (the code)',
+ 'http://codespeak.net/svn/z3/'),
+
+ ('z3-checkins mailing list',
+ 'http://codespeak.net/mailman/listinfo/z3-checkins'),
+ ]
+
+ website.registerPages(
+ [
+ Z3Page('www', 'index.txt'),
+ ],
+ main_layouter,
+ '.',
+ quick_links=main_quick_links,
+ )
+
+ # redirect old five page
+ website.registerPages(
+ [
+ publish.SimplePage('five'),
+ ],
+ redirect_layouter,
+ '.',
+ url='http://codespeak.net/z3/five',
+ )
+
+ # construct five subsite
+ five_nav_links = [
+ ('Five main', 'index.html'),
+ ('Features', 'features.html'),
+ ('Directives', 'directives.html'),
+ ('Manual', 'manual.html')
+ ]
+
+ five_quick_links = [
+ ('svn (the code)',
+ 'http://codespeak.net/svn/z3/Five/'),
+
+ ('z3-five mailing list',
+ 'http://codespeak.net/mailman/listinfo/z3-five'),
+
+ ('z3-checkins mailing list',
+ 'http://codespeak.net/mailman/listinfo/z3-checkins'),
+ ]
+
+ website.registerPages(
+ [
+ Z3Page('Five', 'doc/main.txt', 'index'),
+ Z3Page('Five', 'doc/features.txt'),
+ Z3Page('Five', 'doc/directives.txt'),
+ Z3Page('Five', 'doc/manual.txt'),
+ ],
+ page_layouter,
+ 'five',
+ nav_links=five_nav_links,
+ quick_links=five_quick_links,
+ )
+
+ # finally, save website
+ website.save()
+
+def main():
+ createWebSite('/home/faassen/tmp/testwebsite')
+
+if __name__ == '__main__':
+ main()
More information about the z3-checkins
mailing list