mtd/html Makefile, NONE, 1.1 archive.xml, NONE, 1.1 fellows.xml,
NONE, 1.1 html.py, NONE, 1.1 index.xml, NONE, 1.1 mail.xml,
NONE, 1.1 menu1.xml, NONE, 1.1 menu2.xml, NONE, 1.1 source.xml,
NONE, 1.1
gleixner at infradead.org
gleixner at infradead.org
Sat Mar 12 08:48:24 EST 2005
- Previous message: mtd/html/styles - New directory
- Next message: mtd/html/doc Makefile, NONE, 1.1 general.xml, NONE, 1.1 jffs2.xml,
NONE, 1.1 jffs3.xml, NONE, 1.1 menu2.html, NONE, 1.1 menu2.xml,
NONE, 1.1 nand.xml, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/html
In directory phoenix.infradead.org:/tmp/cvs-serv15437
Added Files:
Makefile archive.xml fellows.xml html.py index.xml mail.xml
menu1.xml menu2.xml source.xml
Log Message:
Add overhauled page sources
--- NEW FILE Makefile ---
#
CONV = "./html.py"
TARGETS = index.html archive.html mail.html source.html fellows.html
SUBDIRS = doc faq
all: $(TARGETS) subdirs
$(TARGETS): %.html: %.xml inc/*.tmpl menu1.xml menu2.xml
$(CONV) -f $<
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
clean:
rm -f $(TARGETS)
for dir in $(SUBDIRS); do make -C $$dir clean; done
***** Error reading new file: [Errno 2] No such file or directory: 'archive.xml'
***** Error reading new file: [Errno 2] No such file or directory: 'fellows.xml'
--- NEW FILE html.py ---
#!/usr/bin/env python
#
# Patch series mailer. Mails patch series, which are generated
# by patchseries.py.
#
# Please modifiy the mailform and mailserver entries or use the
# options to override
#
# (C) 2004 Thomas Gleixner <tglx at linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import pprint
import shutil
import string
import smtplib
import socket
import time
import xml.sax
import commands
# Print the usage information
def usage():
print "USAGE:"
print "svnmail.py <-c config -h -i -v -u user -p path>"
print " -c conf configuration file"
print " -i interactive (confirm each message)"
print " -p path repository path"
print " -r rev revision number"
print " -v verbose (Enables smtp debug messages)"
return
# Headerfields
header = [
"Mime-Version: 1.0\r\n",
"Content-Type: text/plain\r\n",
"Content-Transfer-Encoding: 8bit\r\n",
"Content-Disposition: inline\r\n",
]
html = []
replace = []
fdout = sys.stdout
def replaceVars(line):
cnt = 0
while cnt < len(replace):
if line.find(replace[cnt]) >= 0:
line = line.replace(replace[cnt], replace[cnt+1])
cnt = cnt + 2
return line
def writeHtml(line):
fdout.write(replaceVars(line))
def startMenu(level):
writeHtml("<div id=\"menu%s\">\n" %(level))
def placeMenu(topic, link, mode):
topic = replaceVars(topic)
mode = replaceVars(mode)
if mode == 'text':
writeHtml("<p>%s</p>\n" %(topic))
return
if mode == 'selected':
writeHtml("<span class=\"sel\">\n")
else:
writeHtml("<span class=\"nonsel\">\n")
writeHtml("<a href=\"%s\"><span>%s</span></a>\n" %(link, topic))
writeHtml("</span>\n")
# configuration parser
class docHandler(xml.sax.ContentHandler):
def __init__(self):
self.content = ""
return
def startElement(self, name, attrs):
self.element = name
if len(self.content) > 0:
writeHtml(self.content)
self.content = ""
if name == "PAGE":
return
elif name == "INCLUDE":
fd = open(attrs.get('file'), 'r')
lines = fd.readlines()
fd.close()
for line in lines:
writeHtml(line)
elif name == "PARSE":
parseConfig(attrs.get('file'))
elif name == 'STARTMENU':
startMenu(attrs.get('level'))
elif name == 'MENU':
placeMenu(attrs.get('topic'), attrs.get('link'), attrs.get('mode'))
elif name == 'ENDMENU':
writeHtml("</div>\n")
elif name == 'VAR':
match = attrs.get('match')
repl = attrs.get('replace')
idx = len(replace)
replace[idx:] = [match]
idx = len(replace)
replace[idx:] = [repl]
elif name == "br":
writeHtml("<br")
if attrs.getLength > 0:
names = attrs.getNames()
for name in names:
writeHtml(" " + name + "=\"" + attrs.get(name) + "\"")
writeHtml(" />")
else:
writeHtml("<" + name)
if attrs.getLength > 0:
names = attrs.getNames()
for name in names:
writeHtml(" " + name + "=\"" + attrs.get(name) + "\"")
writeHtml(">")
def characters(self, ch):
self.content = self.content + ch
def endElement(self, name):
if name == "PAGE":
return
elif name == 'INCLUDE':
return
elif name == 'PARSE':
return
elif name == 'PAGE':
return
elif name == 'STARTMENU':
return
elif name == 'ENDMENU':
return
elif name == 'MENU':
return
elif name == 'VAR':
return
elif name == 'br':
return
if len(self.content) > 0:
writeHtml(self.content)
self.content = ""
writeHtml("</" + name + ">\n")
# error handler
class errHandler(xml.sax.ErrorHandler):
def __init__(self):
return
def error(self, exception):
sys.stderr.write("%s\n" % exception)
def fatalError(self, exception):
sys.stderr.write("Fatal error while parsing configuration\n")
sys.stderr.write("%s\n" % exception)
sys.exit(1)
# parse the configuration file
def parseConfig(file):
# handlers
dh = docHandler()
eh = errHandler()
# Create an XML parser
parser = xml.sax.make_parser()
# Set the handlers
parser.setContentHandler(dh)
parser.setErrorHandler(eh)
fd = open(file, 'r')
# Parse the file
parser.parse(fd)
fd.close()
# Here we go
# Parse the commandline
writefile = 0
try:
(options, arguments) = getopt.getopt(sys.argv[1:],'fh')
except getopt.GetoptError, ex:
print
print "ERROR:"
print ex.msg
usage()
sys.exit(1)
pass
for option, value in options:
if option == '-f':
writefile = 1
elif option == '-h':
usage()
sys.exit(0)
pass
pass
if not arguments:
print "No source file specified"
usage()
sys.exit(1)
pass
if writefile > 0:
fname = arguments[0].split('.')[0]
fname = fname + ".html"
fdout = open(fname, 'w')
parseConfig(arguments[0])
if writefile > 0:
fdout.close()
***** Error reading new file: [Errno 2] No such file or directory: 'index.xml'
***** Error reading new file: [Errno 2] No such file or directory: 'mail.xml'
--- NEW FILE menu1.xml ---
<PAGE>
<STARTMENU level="1"/>
<MENU topic="Home" link="VAR_ORIGINindex.html" mode="VAR_SEL_INDEX" />
<MENU topic="FAQ" link="VAR_ORIGINfaq/general.html" mode="VAR_SEL_FAQ" />
<MENU topic="Mailing Lists / IRC" link="VAR_ORIGINmail.html" mode="VAR_SEL_MAIL" />
<MENU topic="Source" link="VAR_ORIGINsource.html" mode="VAR_SEL_SOURCE" />
<MENU topic="Documentation" link="VAR_ORIGINdoc/general.html" mode="VAR_SEL_DOC" />
<MENU topic="Archive" link="VAR_ORIGINarchive.html" mode="VAR_SEL_ARCHIVE" />
<MENU topic="Fellows" link="VAR_ORIGINfellows.html" mode="VAR_SEL_FELLOWS" />
<MENU topic="Memory Technology Devices" link="" mode="text" />
<ENDMENU />
<PARSE file="menu2.xml" />
</PAGE>
--- NEW FILE menu2.xml ---
<PAGE>
<STARTMENU level="2"/>
<ENDMENU />
</PAGE>
***** Error reading new file: [Errno 2] No such file or directory: 'source.xml'
- Previous message: mtd/html/styles - New directory
- Next message: mtd/html/doc Makefile, NONE, 1.1 general.xml, NONE, 1.1 jffs2.xml,
NONE, 1.1 jffs3.xml, NONE, 1.1 menu2.html, NONE, 1.1 menu2.xml,
NONE, 1.1 nand.xml, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list