[glade-web] Trying out new automated website.



commit 30965eb5d686a44971c68bfbce87d19d8e8947f2
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Tue Jul 21 13:31:28 2009 -0400

    Trying out new automated website.

 .htaccess                  |    2 +
 Makefile                   |   63 +++++++++++++++
 default.css                |   24 ++++++
 feed.py                    |  139 +++++++++++++++++++++++++++++++++
 foot.src                   |    6 ++
 head.src                   |   59 ++++++++++++++
 images/feed-icon-14x14.png |  Bin 0 -> 689 bytes
 images/gnome-64.png        |  Bin 0 -> 1680 bytes
 index.html                 |  185 --------------------------------------------
 index.src                  |   37 +++++++++
 news.rss                   |   44 +++++++++++
 news.src                   |   11 +++
 newsitems-index.src        |   12 +++
 newsitems.py               |   25 ++++++
 newsitems.src              |   12 +++
 sources.src                |   14 ++++
 stp.py                     |   54 +++++++++++++
 17 files changed, 502 insertions(+), 185 deletions(-)
---
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..5f14196
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,2 @@
+AddType application/xml;charset=utf-8 .rss
+AddDefaultCharset utf-8
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7c222fc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,63 @@
+WEBDIR ?= ${HOME}/www/glade-web
+IMGDIR = ${WEBDIR}/images
+DISTDIR = ${WEBDIR}/dist
+DOCSDIR = ${WEBDIR}/docs
+
+#using python2.4 now (2007/04/19)
+PYTHON = python
+PROCESSOR = ${PYTHON} stp.py
+
+SRC_PAGES = 			\
+	sources.src 		\
+	index.src 		\
+	news.src
+
+HTML_PAGES = $(patsubst %.src, ${WEBDIR}/%.html, ${SRC_PAGES})
+COMMON_PAGES = head.src foot.src newsitems.py feed.py
+CSS_FILES = default.css
+
+all: start_log pages finish_log
+
+html: ${HTML_PAGES}
+
+pages: dirs news.rss ${HTML_PAGES} extras
+
+dirs: ${WEBDIR} ${IMGDIR} ${DISTDIR} ${DOCSDIR}
+
+start_log:
+	echo 'Starting to build the Glade web'
+
+finish_log:
+	echo 'Glade web finished'
+
+${WEBDIR}:
+	mkdir -p ${WEBDIR}
+
+${IMGDIR}:
+	mkdir -p ${IMGDIR}
+
+${DISTDIR}:
+	mkdir -p ${DISTDIR}
+
+${DOCSDIR}:
+	mkdir -p ${DOCSDIR}
+
+${HTML_PAGES}: ${SRC_PAGES} ${COMMON_PAGES}
+
+${WEBDIR}/%.html: %.src
+	${PROCESSOR} $< > $@
+
+news.rss: newsitems.py feed.py
+	${PYTHON} feed.py
+
+extras: ${CSS_FILES} images/*.png
+	cp ${CSS_FILES} ${WEBDIR}
+	cp images/*.png ${IMGDIR}
+	cp news.rss ${WEBDIR}
+	cp .htaccess ${WEBDIR}/.htaccess
+
+clean:
+	rm -f ${HTML_PAGES}
+
+.PHONY:	all dirs extras pages start_log finish_log
+
diff --git a/default.css b/default.css
index 51e5e01..129555f 100644
--- a/default.css
+++ b/default.css
@@ -63,6 +63,30 @@ a:active {
 #hdr h2 {
     font-size: 120%;
 }
+/* News */
+
+.news * {
+    font-size:90%;
+    margin: 0.1em;
+    padding:0px;
+}
+
+.news h4 {
+    font-size: 120%;
+    border-width:1px 0 0 0;
+    border-style:dotted;
+    margin: 0.3em 0.1em;
+    padding:0px;
+}
+
+.news h4 a {
+    color:black;
+}
+
+.news h5 {
+    font-size:75%;
+    color:gray;
+}
 
 /* Sidebar */
 
diff --git a/feed.py b/feed.py
new file mode 100644
index 0000000..5c4c326
--- /dev/null
+++ b/feed.py
@@ -0,0 +1,139 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+# Copyright (C) 2004 R. Sridhar <sridharinfinity users sf net>.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time, cgi
+
+#
+# Convenience function imported by newsitems.py; this is essentially a
+# circular import but it's not really important and uses less files
+#
+def setup_rss_item(index, title, date, desc, author='Anonymous'):
+    ret = {}
+    ret['link'] = 'http://glade.gnome.org/news.html#item%d' % index
+    ret['title'] = cgi.escape(title)
+    date = time.strptime("%s %s %s" % date, "%Y %m %d")
+    # XXX someday the time and GMT hack will bite us in the rear
+    ret['pubDate'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", date)
+    ret['description'] = cgi.escape(desc)
+    return ret
+
+def setup_item(index, title, date, desc, author='Anonymous'):
+    ret = {}
+    ret['anchor'] = "item%d" % index
+    ret['title'] = title
+    date = time.strptime("%s %s %s" % date, "%Y %m %d")
+    ret['pubDate'] = time.strftime("%A %d %B %Y", date)
+    ret['description'] = desc
+    ret['author'] = author
+    return ret
+
+# RSS generation; note that the <xml bits *must* come at the very top of
+# the document, no whitespace before it allowed.
+# http://www.feedvalidator.org/ can be used to check validity of the RSS.
+
+rss_header = r"""<?xml version="1.0"?>
+<rss version="2.0">
+
+  <channel>
+    <title>Glade News</title>
+    <description>Glade is a RAD tool to enable quick and easy development
+    of user interfaces for the GTK+ toolkit and the GNOME desktop environment,
+    released under the GNU GPL License.
+
+    The user interfaces designed in Glade are saved as XML, and by using the
+    GtkBuilder GTK+ object these can be loaded by applications dynamically as
+    needed.
+
+    By using GtkBuilder, Glade XML files can be used in numerous programming
+    languages including C, C++, Vala, Java, Perl, Python, C#, Pike, Ruby,
+    Haskell, Objective Caml and Scheme.
+    </description>
+    <language>en-us</language>
+    <link>http://glade.gnome.org</link>
+    <copyright> © 2003 by The GNOME Project</copyright>
+    <webMaster>glade-web glade gnome org</webMaster>
+"""
+
+rss_footer = r"""
+  </channel>
+</rss>
+"""
+
+rss_image = r"""
+  <image>
+    <title>Glade</title>
+    <url>http://glade.gnome.org/images/gnome-64.png</url>
+    <link>http://glade.gnome.org</link>
+  </image>
+"""
+
+rss_item_template = r"""
+  <item>
+    <title>%(title)s</title>
+    <link>%(link)s</link>
+    <pubDate>%(pubDate)s</pubDate>
+    <description>%(description)s</description>
+  </item>
+"""
+
+def write_rss(fp, items):
+    sections = [rss_header, rss_image]
+    n_items = len(items)
+    for index in range(len(items)):
+        item = items[index]
+        sections.append(rss_item_template % setup_rss_item(n_items - index,
+                                                           *item))
+    sections.append(rss_footer)
+    fp.write(''.join(sections))
+
+# STP .src generation
+
+src_item_template = r"""
+<div class="news">
+<h4><a name="%(anchor)s">%(title)s</a></h4>
+<h5>%(pubDate)s by %(author)s</h5>
+<div>%(description)s</div>
+</div>
+"""
+
+def write_src(fp, items):
+    sections = []
+    n_items = len(items)
+    for index in range(len(items)):
+        item = items[index]
+        sections.append(src_item_template % setup_item(n_items - index, *item))
+    fp.write(''.join(sections))
+
+def items_to_rss(items, rss_file, maxitems=0):
+    "Convert items to rss file"
+    if maxitems:
+        items = items[:maxitems]
+    write_rss(file(rss_file, 'w'), items)
+
+def items_to_src(items, src_file, maxitems=0):
+    "Convert items to STP src file"
+    if maxitems:
+        items = items[:maxitems]
+    write_src(file(src_file, 'w'), items)
+
+if __name__ == "__main__":
+    from newsitems import items
+    items_to_rss(items, 'news.rss', 10)
+    items_to_src(items, 'newsitems-index.src', 5)
+    items_to_src(items, 'newsitems.src')
+
diff --git a/foot.src b/foot.src
new file mode 100644
index 0000000..8dc3132
--- /dev/null
+++ b/foot.src
@@ -0,0 +1,6 @@
+
+    <div id="bottom">
+        <div id="copyright">Copyright 2009, The Glade project <br /> (Design by Nemiver developers, thank you! ;)) <br /><br /> <a href="http://validator.w3.org/check?uri=referer";><img src="http://www.w3.org/Icons/valid-xhtml10"; alt="Valid XHTML 1.0 Strict" height="31" width="88"/></a></div>
+    </div>
+</body>
+</html>
diff --git a/head.src b/head.src
new file mode 100644
index 0000000..e9bf784
--- /dev/null
+++ b/head.src
@@ -0,0 +1,59 @@
+<!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"; xml:lang="fr">
+<head>
+       <title>Glade - A User Interface Designer</title>
+
+       <meta http-equiv="Content-Type"
+             content="text/html; charset=utf-8"/>
+       <link rel="stylesheet"
+             media="screen"
+             type="text/css"
+             title="default.css"
+             href="default.css"/>
+</head>
+
+<body>
+
+    <div id="hdr">
+        <img alt="logo" src="images/glade.png" />
+        <h1>Glade - A User Interface Designer</h1>
+
+    </div>
+    <div id="sidebar">
+        <h3>Downloads</h3>
+        <ul id="link">
+          <li>Current Version: <strong>3.6</strong></li>
+          <li><a href="http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/3.6/";>Windows binaries</a></li>
+          <li><a href="http://ftp.gnome.org/pub/GNOME/binaries/mac/glade3/3.6/";>MacOSX binaries</a></li>
+          <li><a href="http://glade.gnome.org/sources.html";>Download Sources</a></li>
+          <li><a href="http://git.gnome.org/cgit/glade3";>Browse Sources</a></li>
+        </ul>
+        <h3>Documentation</h3>
+          <ul>
+            <li><a href="http://live.gnome.org/Glade/Tutorials";>Tutorials</a></li>
+            <li><a href="http://library.gnome.org/devel/gladeui/3.6/";>API Reference</a></li>
+          </ul>
+        <h3>Help</h3>
+          <ul>
+            <li><a href="http://lists.ximian.com/mailman/listinfo/glade-users";>Users mailing list</a></li>
+            <li><a href="http://bugzilla.gnome.org/enter_bug.cgi?product=glade3";>File a bug</a></li>
+          </ul>
+        <h3>Development</h3>
+          <ul id="link">
+            <li><a href="http://lists.ximian.com/mailman/listinfo/glade-devel";>Developers mailing list</a></li>
+            <li><a href="http://bugzilla.gnome.org/buglist.cgi?query_format=advanced&product=glade3&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&bug_severity=enhancement";>Bug list</a></li>
+            <li><a href="http://live.gnome.org/Glade/Roadmap";>Roadmap</a></li>
+            <li><a href="http://live.gnome.org/Glade";>Wiki</a></li>
+          </ul>
+          <ul>
+            <li><strong>IRC</strong></li>
+            <li><b>server : </b>irc.gimp.net</li>
+            <li><b>channel : </b>#glade3</li>
+          </ul>
+        <h3>Related tools</h3>
+          <ul>
+            <li><a href="http://projects.gnome.org/anjuta/";>Anjuta IDE</a></li>
+            <li><a href="http://projects.gnome.org/nemiver/";>Nemiver Debugger</a></li>
+            <li><a href="http://live.gnome.org/devhelp";>Devhelp documentation browser</a></li>
+          </ul>
+    </div>
diff --git a/images/feed-icon-14x14.png b/images/feed-icon-14x14.png
new file mode 100644
index 0000000..b3c949d
Binary files /dev/null and b/images/feed-icon-14x14.png differ
diff --git a/images/gnome-64.png b/images/gnome-64.png
new file mode 100644
index 0000000..6db2d08
Binary files /dev/null and b/images/gnome-64.png differ
diff --git a/index.src b/index.src
new file mode 100644
index 0000000..0ee7f62
--- /dev/null
+++ b/index.src
@@ -0,0 +1,37 @@
+<!--stp:include('head.src') -->
+
+    <div id="body">
+
+    <p class="thumb">
+    <a class="thumb" href="images/glade-main-page.png">
+        <img style="float: left; margin-right: 20px;" src="images/glade-main-page-thumb.png"
+        alt="glade main page"/></a>
+    </p>
+
+    <h2>What is Glade?</h2>
+	<p>Glade is a RAD tool to enable quick &amp; easy development of user
+	   interfaces for the <a href="http://www.gtk.org/";>GTK+</a> toolkit and
+	   the <a href="http://www.gnome.org/";>GNOME</a> desktop environment.
+	</p>
+	<p>
+	   The user interfaces designed in Glade are saved as XML, and by using the
+	   <a href="http://library.gnome.org/devel/gtk/stable/GtkBuilder.html";>GtkBuilder</a> GTK+ object
+	   these can be loaded by applications dynamically as needed.
+	</p>
+	<p>
+	   By using GtkBuilder, Glade XML files can be used in numerous programming languages
+	   including C, C++, C#, Vala, Java, Perl, Python,and others.
+	</p>
+    <p>Glade is Free software released under the
+	  <a href="http://www.fsf.org/licensing/licenses/gpl.html";>GNU GPL License</a>
+    </p>
+
+    <h2>Latest news</h2>
+    <div>
+        <a href="http://glade.gnome.org/news.rss";><img src="images/feed-icon-14x14.png" alt="RSS" title="RSS feed" /></a>
+        <a href="http://glade.gnome.org/news.html";><small>Old stories</small></a>
+    </div>
+<!--stp:include('newsitems-index.src') -->
+    </div>
+
+<!--stp:include('foot.src') -->
diff --git a/news.rss b/news.rss
new file mode 100644
index 0000000..ca0226d
--- /dev/null
+++ b/news.rss
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<rss version="2.0">
+
+  <channel>
+    <title>Glade News</title>
+    <description>Glade is a RAD tool to enable quick and easy development
+    of user interfaces for the GTK+ toolkit and the GNOME desktop environment,
+    released under the GNU GPL License.
+
+    The user interfaces designed in Glade are saved as XML, and by using the
+    GtkBuilder GTK+ object these can be loaded by applications dynamically as
+    needed.
+
+    By using GtkBuilder, Glade XML files can be used in numerous programming
+    languages including C, C++, Vala, Java, Perl, Python, C#, Pike, Ruby,
+    Haskell, Objective Caml and Scheme.
+    </description>
+    <language>en-us</language>
+    <link>http://glade.gnome.org</link>
+    <copyright> © 2003 by The GNOME Project</copyright>
+    <webMaster>glade-web glade gnome org</webMaster>
+
+  <image>
+    <title>Glade</title>
+    <url>http://glade.gnome.org/images/gnome-64.png</url>
+    <link>http://glade.gnome.org</link>
+  </image>
+
+  <item>
+    <title>New website design</title>
+    <link>http://glade.gnome.org/news.html#item2</link>
+    <pubDate>Mon, 20 Jul 2009 00:00:00 GMT</pubDate>
+    <description>Our website gets a facelift. Enjoy!.</description>
+  </item>
+
+  <item>
+    <title>Glade 3.6.7 released</title>
+    <link>http://glade.gnome.org/news.html#item1</link>
+    <pubDate>Mon, 29 Jun 2009 00:00:00 GMT</pubDate>
+    <description>This is a bugfix release. See full announcement for details.</description>
+  </item>
+
+  </channel>
+</rss>
diff --git a/news.src b/news.src
new file mode 100644
index 0000000..56560c6
--- /dev/null
+++ b/news.src
@@ -0,0 +1,11 @@
+<!--stp:include('head.src')-->
+
+<div id="mainText">
+
+<h2>News</h2>
+
+<!--stp:include('newsitems.src') -->
+
+</div>
+
+<!--stp:include('foot.src') -->
diff --git a/newsitems-index.src b/newsitems-index.src
new file mode 100644
index 0000000..2ea0d64
--- /dev/null
+++ b/newsitems-index.src
@@ -0,0 +1,12 @@
+
+<div class="news">
+<h4><a name="item2">New website design</a></h4>
+<h5>Monday 20 July 2009 by Tristan van Berkom</h5>
+<div>Our website gets a facelift. Enjoy!.</div>
+</div>
+
+<div class="news">
+<h4><a name="item1">Glade 3.6.7 released</a></h4>
+<h5>Monday 29 June 2009 by Tristan van Berkom</h5>
+<div>This is a bugfix release. See full announcement for details.</div>
+</div>
diff --git a/newsitems.py b/newsitems.py
new file mode 100644
index 0000000..886d9bf
--- /dev/null
+++ b/newsitems.py
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8
+# Setup code, stay away
+items = []
+item = lambda *x: items.append(x)
+
+# News items go here, most recent ones at top. Dates can be either
+# strings or time(3) output.
+#
+# item("INSERT TITLE HERE",
+#      (1901, 3, 1),
+#      """
+#      INSERT TEXT HERE
+#      """,
+#      "INSERT AUTHOR HERE")
+
+# http://news.gmane.org/gmane.comp.gnome.gtk%2B.python/
+item("New website design", (2009, 7, 20),
+     """Our website gets a facelift. Enjoy!.""", 'Tristan van Berkom')
+
+item("Glade 3.6.7 released", (2009, 6, 29),
+     """This is a bugfix release. See full announcement for details.""", 'Tristan van Berkom')
+#item("PyGobject 2.18.0 released", (2009, 5, 25),
+#     """PyGobject 2.18.0 has been released, this is a stable release, the first of the 2.18.x series. As usual, it's sources can be fetched
+#     <a href="http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.18/pygobject-2.18.0.tar.bz2";>here</a>.
+#     Check out <a href="http://mail.gnome.org/archives/gnome-announce-list/2009-May/msg00065.html";>the release announcement and full list of changes</a>.""", 'Gian Mario Tagliaretti')
diff --git a/newsitems.src b/newsitems.src
new file mode 100644
index 0000000..2ea0d64
--- /dev/null
+++ b/newsitems.src
@@ -0,0 +1,12 @@
+
+<div class="news">
+<h4><a name="item2">New website design</a></h4>
+<h5>Monday 20 July 2009 by Tristan van Berkom</h5>
+<div>Our website gets a facelift. Enjoy!.</div>
+</div>
+
+<div class="news">
+<h4><a name="item1">Glade 3.6.7 released</a></h4>
+<h5>Monday 29 June 2009 by Tristan van Berkom</h5>
+<div>This is a bugfix release. See full announcement for details.</div>
+</div>
diff --git a/sources.src b/sources.src
new file mode 100644
index 0000000..c08f9af
--- /dev/null
+++ b/sources.src
@@ -0,0 +1,14 @@
+<!--stp:include('head.src') -->
+
+    <div id="body">
+
+        <h2>Getting sources</h2>
+        <p>Sources of the Glade project can be obtained either from:</p>
+        <ul>
+          <li><a href="http://ftp.gnome.org/pub/GNOME/sources/glade3/3.6/";>source code tarballs</a> of released versions, or</li>
+          <li><a href="http://git.gnome.org/cgit/glade3";>our git repository</a> to get bleeding edge source code. To clone it you need to type:
+          <code>git clone git://git.gnome.org/glade3</code></li>
+        </ul>
+    </div>
+
+<!--stp:include('foot.src') -->
diff --git a/stp.py b/stp.py
new file mode 100644
index 0000000..13eab3d
--- /dev/null
+++ b/stp.py
@@ -0,0 +1,54 @@
+# Copyright 2003 Lorenzo Gil Sanchez <lgs sicem biz>
+#
+# stp stands for Simple Template Processor (or Stupid Template Processor)
+#
+# It takes a file as input and dumps it to standard output. When it sees
+# special tags it executes python code. For example:
+#
+# <!--stp:include('other-file')-->
+#
+# then it calls the python function include('other-file') which should be
+# defined here or funny things can happen.
+#
+# Don't use this script for serious work.
+
+import sys
+
+def usage():
+    print """
+    Usage: python sts.py input_file > output_file
+    """
+
+def process_file(filename, maxlines=0):
+    f = file(filename)
+    counter = 0
+    for line in f:
+        li = line.find('<!--stp:')
+        if li != -1:
+            li = li + len('<!--stp:')
+            ri = line.rfind('-->')
+            directive = line[li:ri].strip()
+            eval(directive) # this is a potential security bug.
+        else:
+            print line,
+
+        counter += 1
+        if counter >= maxlines and maxlines != 0:
+            break
+        
+    f.close()
+
+def include(filename, maxlines=0):
+    """ Include one file inside the current processed file.
+
+    maxlines: if different than 0 only includes that amount of lines.
+    """
+    process_file(filename, maxlines)
+        
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        usage()
+        sys.exit(1)
+        
+    input_filename = sys.argv[1]
+    process_file(input_filename)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]