[gnue] r9716 - in trunk/gnue-appserver: . scripts

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2007-06-13 11:09:31 -0500 (Wed, 13 Jun 2007)
New Revision: 9716

Added:
   trunk/gnue-appserver/scripts/gnue-gcd2html
Modified:
   trunk/gnue-appserver/setup.py
Log:
Added small script to generate HTML documentation from GCD files.


Added: trunk/gnue-appserver/scripts/gnue-gcd2html
===================================================================
--- trunk/gnue-appserver/scripts/gnue-gcd2html	2007-06-13 14:31:31 UTC (rev 9715)
+++ trunk/gnue-appserver/scripts/gnue-gcd2html	2007-06-13 16:09:31 UTC (rev 9716)
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# GNU Enterprise Application Server - GCD to HTML converter script
+#
+# Copyright 2007 Free Software Foundation
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise 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, or (at your option) any later version.
+#
+# GNU Enterprise 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 program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+
+# -----------------------------------------------------------------------------
+# This script is a quick hack that allows to generate HTML documentation from
+# GCD files.
+# -----------------------------------------------------------------------------
+
+xsl='<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html"/>
+
+  <xsl:template match="module">
+    <xsl:text>
+::MODULE::
+</xsl:text><xsl:value-of select="@name"/><xsl:text>
+</xsl:text>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:template>
+
+  <xsl:template match="class">
+    <xsl:text>
+::CLASS::
+</xsl:text><xsl:value-of select="@name"/><xsl:text>
+</xsl:text>
+    <xsl:element name="h2">
+      <xsl:text>Class </xsl:text>
+      <xsl:value-of select="@name"/>
+    </xsl:element>
+    <xsl:element name="p">
+      <xsl:value-of select="@comment"/>
+    </xsl:element>
+    <xsl:element name="dl">
+      <xsl:for-each select="property">
+        <xsl:element name="dt">
+          <xsl:value-of select="@name"/>
+          <xsl:text> - </xsl:text>
+          <xsl:element name="em">
+            <xsl:choose>
+              <xsl:when test="contains(@type,'"'_'"')">
+                <xsl:element name="a">
+                  <xsl:attribute name="href">../<xsl:value-of select="translate(@type,'"'_'"','"'/'"')"/>.html</xsl:attribute>
+                  <xsl:value-of select="@type"/>
+                </xsl:element>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@type"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:element>
+        </xsl:element>
+        <xsl:element name="dd">
+          <xsl:value-of select="@comment"/>
+        </xsl:element>
+      </xsl:for-each>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="@*|node()" priority="-1"/>
+</xsl:stylesheet>'
+
+for gcd in $*; do
+  module=""
+  class=""
+  echo "$xsl" | xsltproc - "$gcd" | while read line; do
+    test -n "$line" || continue
+    if [ "$line" == "::MODULE::" ]; then
+      read module
+      mkdir $module
+      continue
+    fi
+    if [ "$line" == "::CLASS::" ]; then
+      read class
+      continue
+    fi
+    test -n "$module" || continue
+    test -n "$class" || continue
+    echo "$line" >> $module/$class.html
+  done
+done


Property changes on: trunk/gnue-appserver/scripts/gnue-gcd2html
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id

Modified: trunk/gnue-appserver/setup.py
===================================================================
--- trunk/gnue-appserver/setup.py	2007-06-13 14:31:31 UTC (rev 9715)
+++ trunk/gnue-appserver/setup.py	2007-06-13 16:09:31 UTC (rev 9716)
@@ -60,12 +60,12 @@
 
     # The Programs
     if sys.platform == 'win32':
-      setupdb = "scripts/gnue-setupdb.bat"
+      platscripts = ["scripts/gnue-setupdb.bat"]
     else:
-      setupdb = "scripts/gnue-setupdb"
+      platscripts = ["scripts/gnue-setupdb", "scripts/gnue-gcd2html"]
       
     params ["package_dir"] = {"gnue.appserver": "src"}
-    params ["scripts"]     = [setupdb,
+    params ["scripts"]     =  platscripts + [
                               "scripts/gnue-appserver",
                               "scripts/gnue-gsdgen",
                               "scripts/gnue-readgcd",
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.