Commits

Ronald Oussoren  committed 7f9dfb7

A first attempt at a global template for the website, based on the PHP template.

This doesn't really work yet, relative URLs currently only work for
examples/index.html. Also need work to give the navigation menu the right
contents.

It would be nice if we could replace the table-based layout by a cleaner
layout, but that can wait.

  • Participants
  • Parent commits ee1633b
  • Branches pyobjc-ancient

Comments (0)

Files changed (24)

File pyobjc-website/ReadMe.txt

   the lists of examples) and readme.txt (a longer description). The readme.txt
   is optional.
 - (Examples) The summary should be extracted from the readme file
+- (Examples) Somehow create an RSS feed with the most recent samples 
+  (the last month, adding older examples so ensure there are at least 10
+  samples in the feed)
 - Use the current website to create better template files
+  (WIP, a problem is that the current site sucks: it uses table-based layout)
 - Home page and news
+- RSS feed for news items
 - Extract documentation for pyobjc-core and framework wrappers
 - Download page
 - The current L&F on pyobjc.sf.net sucks, find something better

File pyobjc-website/lib/samples.py

 
 from docutils.core import publish_parts
 
-from genshi.template import MarkupTemplate
+from genshi.template import MarkupTemplate, TemplateLoader
 
 from distutils import log
 
 gTemplateDir = os.path.join(
         os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
         'templates')
+gTemplateLoader = TemplateLoader(gTemplateDir)
 
 def zipDirectory(outputname, inputdir):
     """
         readme = "A PyObjC Example without documentation"
 
     tmpl = MarkupTemplate(
-            open(os.path.join(gTemplateDir, "sample-index.html"), 'r').read())
+            open(os.path.join(gTemplateDir, "sample-index.html"), 'r').read(),
+            loader=gTemplateLoader)
     stream = tmpl.generate(
             title=name,
             sources=[item[:2] for item in coloredFiles],
             zipname=zipname,
-            readme=readme)
+            readme=readme,
+            )
     fp = open(os.path.join(outputdir, "index.html"), 'w')
     fp.write(stream.render('html'))
     fp.close()
 
 
     tmpl = MarkupTemplate(
-            open(os.path.join(gTemplateDir, "sample-source.html"), 'r').read())
+            open(os.path.join(gTemplateDir, "sample-source.html"), 'r').read(),
+            loader=gTemplateLoader)
     for realpath, htmlpath, style, body in coloredFiles:
         sources=[item[:2] for item in coloredFiles if item[1] != htmlpath]
         sources.insert(0, (realpath, htmlpath))
 
     if samples:
         tmpl = MarkupTemplate(
-            open(os.path.join(gTemplateDir, "sample-framework-index.html"), 'r').read())
+            open(os.path.join(gTemplateDir, "sample-framework-index.html"), 'r').read(),
+            loader=gTemplateLoader)
         stream = tmpl.generate(
             title="Examples for %s" % (title,),
             samples=samples)
                 outputdir)
 
         if listing:
-            print allSamples
             allSamples.append((title, nm, listing))
 
     if allSamples:
         tmpl = MarkupTemplate(
-            open(os.path.join(gTemplateDir, "sample-global-index.html"), 'r').read())
+            open(os.path.join(gTemplateDir, "sample-global-index.html"), 'r').read(),
+            loader=gTemplateLoader)
         stream = tmpl.generate(
             samplelist=allSamples)
         fp = open(os.path.join(outputdir, "index.html"), 'w')

File pyobjc-website/resources/css/layout.css

+.banner {
+	background-image: url("../img/stripes.gif");
+}
+
+span.headbanner {
+	font-family: "Trebuchet MS",arial,helvetica,sans-serif;
+	font-size: 48pt;
+	font-weight: bold;
+}
+
+span.subbanner {
+	font-family: "Trebuchet MS",arial,helvetica,sans-serif;
+	font-size: medium;
+	font-weight: bold;
+}
+
+.news {
+        font-style: italic;
+        color: #6666cc;
+        font-size:small;
+}
+
+body {
+  color:black;
+  background-color:white;
+  font-family:"Trebuchet MS",sans-serif;
+}
+
+a:link {
+  color:rgb(0,0,240);
+}
+a:visited {
+  color:rgb(128,0,128);
+}
+a:active {
+  color:rgb(255,51,51);
+}
+
+p,ul,ol,li,dl,dt,dd,td,th {
+  color:black;
+  font-family:"Trebuchet MS",sans-serif;
+  font-size:11pt;
+}
+
+td.layout {
+  font-size:0px;
+}
+
+h1 {
+  color:black;
+  font-family:"Trebuchet MS",sans-serif;
+  font-size:18pt;
+  font-weight:bold;
+}
+
+h2 {
+  color:black;
+  font-family:"Trebuchet MS",sans-serif;
+  font-size:12pt;
+  font-weight:bold;
+}
+
+.default {
+  color:black;
+  font-family:"Trebuchet MS",sans-serif;
+  font-size:11pt;
+}
+
+.attention {
+  color:red;
+}
+
+.nav {
+  color:black;
+  font-family:Verdana,Helvetica,Arial,sans-serif;
+  font-size:8pt;
+}
+
+.footer {
+  color:black;
+  font-family:"Trebuchet MS",sans-serif;
+  font-size:10pt;
+}
+
+.news_date {
+  color:rgb(96,96,96);
+  font-size:10pt;
+  font-weight:bold;
+}
+
+.news_headline {
+  font-size:10pt;
+  font-weight:bold;
+}
+
+input {
+  color:black;
+  font-family:Courier,"Courier New",monospace;
+  font-size:10pt;
+}
+
+tt {
+  color:black;
+  font-family:Courier,"Courier New",monospace;
+  font-size:10pt;
+}
+
+pre {
+  color:black;
+  background-color:rgb(230,230,255);
+  padding:4px;
+  padding-left:8px;
+  margin-left:16px;
+  margin-right:16px;
+  font-family:Courier,"Courier New",monospace;
+  font-size:10pt;
+}
+
+img {
+  border:0;
+}

File pyobjc-website/resources/img/back.gif

Added
New image

File pyobjc-website/resources/img/blank.gif

Added
New image

File pyobjc-website/resources/img/compressed.gif

Added
New image

File pyobjc-website/resources/img/dogsnake.jpg

Added
New image

File pyobjc-website/resources/img/folder.gif

Added
New image

File pyobjc-website/resources/img/grey_pixel.gif

Added
New image

File pyobjc-website/resources/img/nav-downicon.gif

Added
New image

File pyobjc-website/resources/img/nav-head.gif

Added
New image

File pyobjc-website/resources/img/nav-normicon.gif

Added
New image

File pyobjc-website/resources/img/sect-head.gif

Added
New image

File pyobjc-website/resources/img/shim.gif

Added
New image

File pyobjc-website/resources/img/stripes.gif

Added
New image

File pyobjc-website/resources/img/title2-2.gif

Added
New image

File pyobjc-website/resources/img/top-line.gif

Added
New image

File pyobjc-website/resources/img/unknown.gif

Added
New image

File pyobjc-website/setup.py

                     "Run me in a complete checkout of the pyobjc trunk")
 
         frameworkList = [dn for dn in os.listdir('..') if dn.startswith('pyobjc-framework') ]
+        frameworkList = ['pyobjc-framework-Cocoa']
 
 
         samples.generateSamples('..', 'htdocs/examples', frameworkList)
             publish=publishsite,
         ),
         setup_requires = [
-            'docutils',
-            'Genshi',
+            'docutils >=0.4',
+            'Genshi >=0.4',
             'Pygments',
         ]
 )

File pyobjc-website/templates/layout.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/" py:strip="">
+    <head py:match="head" once="true" py:attrs="select('@*')">
+        <title py:with="title = list(select('title/text()'))">
+            ${title}
+        </title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <link rel="stylesheet" href="../css/layout.css" type="text/css" />
+        <link rel="start" href="/index.html" />
+        <link rel="copyright" href="/legal.html" />
+    </head>
+    <body>
+        <p>
+            ${select('*[local-name()!="title"]')}
+        </p>
+        <table border="0" cellpadding="0" cellspacing="0" width="100%">
+            <tr valign="bottom">
+                <td width="150" valign="middle" bgcolor="#FFFFFF" class="corner">
+                    <center>
+                        <a href="../index.html"><img src="../img/dogsnake.jpg" width="125" height="86" border="0" alt="PyObjC" /></a>
+                    </center>
+                </td>
+                <td class="banner" width="15">
+                    &nbsp;&nbsp;
+                </td>
+                <td align="left" class="banner" width="90%">
+                    <span class="headbanner">PyObjC</span> <span class="subbanner">The Python &lt;-&gt; Objective-C Bridge</span>
+                </td>
+            </tr>
+            <tr valign="top">
+                <td width="150" align="left" style="background-image:url(../img/top-line.gif)" class="banner">
+                    <img src="../img/title2-2.gif" width="125" height="8" border="0" alt="" />
+                </td>
+                <td colspan="2" width="90%" style="background-image:url(../img/top-line.gif)" class="banner">
+                    <img src="../img/shim.gif" width="1" height="8" border="0" alt="" />
+                </td>
+            </tr>
+        </table>
+        <table border="0" cellpadding="0" cellspacing="0" width="100%">
+            <tr valign="top">
+                <td align="left" width="120" bgcolor="#EEEEEE" class="layout">
+                    <table border="0" cellpadding="0" cellspacing="0" width="120">
+                        <tr align="left">
+                            <td colspan="2" bgcolor="#DDDDDD" class="layout">
+                                <img src="../img/sect-head.gif" width="120" height="26" border="0" alt="Sections:" />
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2">
+                                <a href="../index.html">Home</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2">
+                                <a href="../doc/index.html">Documentation</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2">
+                                <a href="../development/index.html">Development</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2">
+                                <a href="../software/index.html">Download</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2" bgcolor="#87B9E7">
+                                <a href="../examples/index.html">Examples</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2">
+                                <a href="http://sourceforge.net/mail/?group_id=14534">Mailing Lists</a>
+                            </td>
+                        </tr>
+                        <tr align="left">
+                            <td height="3" colspan="2" bgcolor="#999999" class="layout"></td>
+                        </tr>
+                        <tr align="left">
+                            <td colspan="2" bgcolor="#DDDDDD" class="layout">
+                                <img src="../img/nav-head.gif" width="120" height="26" border="0" alt="Navigation:" />
+                            </td>
+                        </tr>
+                        <tr class="layout" align="left" valign="middle" bgcolor="#87B9E7">
+                            <td class="layout">
+                                <img src="../img/nav-downicon.gif" width="18" height="15" border="0" alt="- " />
+                            </td>
+                            <td bgcolor="#87B9E7" class="layout">
+                                <span class="nav">Examples</span>
+                            </td>
+                        </tr>
+                        <tr class="layout" bgcolor="#FFFFFF">
+                            <td class="layout" height="1"></td>
+                            <td class="layout" height="1"></td>
+                        </tr>
+                        <tr align="left">
+                            <td height="3" colspan="2" bgcolor="#999999" class="layout"></td>
+                        </tr>
+                        <tr>
+                            <td>
+                                &nbsp;
+                            </td>
+                        </tr>
+                    </table>
+                    <p>
+                        We're hosted on:<br />
+                        <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=14534&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
+                    </p>
+                    <p>
+                        Subversion hosting<br />
+                        <a href="http://www.red-bean.com/"><img src="http://www.red-bean.com/images/bean-brought.jpg" width="100" /></a>
+                    </p>
+                </td>
+                <td align="left" width="100%">
+                    ${select('*|text()')}
+                </td>
+            </tr>
+            <tr valign="middle" align="left">
+                <td bgcolor="#EEEEEE" align="center" width="120" style="background-image:url(../img/stripes.gif)">
+                    <a href="../legal.php" style="text-decoration:none;color:black;font-size:10pt;">Copyright&nbsp;©&nbsp;2003, 2004 The&nbsp;PyObjC&nbsp;Project</a>
+                </td>
+                <td class="layout">
+                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+                        <tr>
+                            <td>
+                                &nbsp;
+                            </td>
+                        </tr>
+                        <tr>
+                            <td width="100%">
+                                <div class="footer" align="center"></div>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td height="7" class="layout">
+                                <img src="../img/shim.gif" width="1" height="7" border="0" alt="" />
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
+        </table>
+    </body>
+</html>

File pyobjc-website/templates/sample-framework-index.html

-<html xmlns:py="http://genshi.edgewall.org/">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:py="http://genshi.edgewall.org/"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html" />
   <head>
     <title py:content="title">Sample name</title>
   </head>

File pyobjc-website/templates/sample-global-index.html

-<html xmlns:py="http://genshi.edgewall.org/">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:py="http://genshi.edgewall.org/"
+  xmlns:xi="http://www.w3.org/2001/XInclude" >
+  <xi:include href="layout.html" />
   <head>
     <title>PyObjC Examples</title>
   </head>
     <div py:for="title, subpath, samples in samplelist">
       <a href="${subpath}/index.html"><h2>${title}</h2></a>
       <div py:for="path, name, summary in samples">
-        <a href="${path}/index.html"><h3>${name}</h3></a>
+        <a href="${subpath}/${path}/index.html"><h3>${name}</h3></a>
         <p py:if="summary">Markup(${summary})</p>
       </div>
     </div>

File pyobjc-website/templates/sample-index.html

-<html xmlns:py="http://genshi.edgewall.org/">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:py="http://genshi.edgewall.org/"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html" />
   <head>
     <title py:content="title">Sample name</title>
 
     </script>
   </head>
 
-  <body>
+  <body class="index">
     <h1 py:content="title">Sample name</h1>
 
     <p><a href="${zipname}">Download the sample</a></p>

File pyobjc-website/templates/sample-source.html

-<html xmlns:py="http://genshi.edgewall.org/">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:py="http://genshi.edgewall.org/"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html" />
   <head>
     <title py:content="title">Sample name</title>
     <style py:content="Markup(style)"><!-- style goes here --></style>