annotate MoinMoin/formatter/text_docbook.py @ 1793:2a4caa295346

Eclipse PyDev Check: fixed lots of its errors and warnings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 23 Feb 2007 13:06:42 +0100
parents 6dd2e29acffe
children 57f12932915f
rev   line source
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
2 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
3 MoinMoin - DocBook Formatter
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
4
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
5 @copyright: 2005 by Mikko Virkkil <mvirkkil@cc.hut.fi>
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
6 @copyright: 2005 by MoinMoin:AlexanderSchremmer (small modifications)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
7 @copyright: 2005 by MoinMoin:Petr Pytelka <pyta@lightcomp.com> (small modifications)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
8
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
9 @license: GNU GPL, see COPYING for details.
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
10 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
11
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 999
diff changeset
12 import os
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
13
661
19ef5f9fff84 moved formatter.base to formatter.__init__
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 660
diff changeset
14 from MoinMoin.formatter import FormatterBase
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 999
diff changeset
15 from MoinMoin import wikiutil
86
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
16 from MoinMoin.error import CompositeError
200
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
17 from MoinMoin.action import AttachFile
86
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
18
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
19 from xml.sax import saxutils
86
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
20 from xml.dom import getDOMImplementation
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
21
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
22 class InternalError(CompositeError): pass
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
23
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
24 try:
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
25 dom = getDOMImplementation("4DOM")
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
26 except ImportError:
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
27 raise InternalError("You need to install PyXML to use the DocBook formatter.")
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
28
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
29 class DocBookOutputFormatter:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
30 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
31 Format docbook output
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
32 """
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
33
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
34 def __init__(self, dommDoc):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
35 self.doc = dommDoc
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
36 self.curNode = dommDoc.documentElement
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
37
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
38 def setHeading(self, headNode):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
39 self.domHeadNode = headNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
40 return u""
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
41
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
42 def _printNode(self, node):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
43 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
44 Function print a node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
45 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
46 from xml.dom.ext import Print
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
47 import StringIO
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
48 from xml.dom.ext import Printer
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
49
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
50 stream = StringIO.StringIO()
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
51
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
52 visitor = Printer.PrintVisitor(stream, 'UTF-8')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
53 Printer.PrintWalker(visitor, node).run()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
54 # get value from stream
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
55 ret = stream.getvalue()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
56 stream.close()
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
57
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
58 return unicode(ret, 'utf-8')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
59
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
60 def getHeading(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
61 # return heading from model
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
62 rootNode = self.doc.documentElement
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
63 # print article info
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
64 return '<?xml version="1.0"?><%s>%s' % (rootNode.nodeName,
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
65 self._printNode(self.domHeadNode))
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
66
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
67 def getBody(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
68 body = []
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
69 # print all nodes inside dom behind heading
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
70 firstNode = self.doc.documentElement.firstChild
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
71 while firstNode:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
72 if firstNode != self.domHeadNode:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
73 body.append(self._printNode(firstNode))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
74 firstNode = firstNode.nextSibling
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
75 return ''.join(body)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
76
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
77 def getEndContent(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
78 # close all opened tags
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
79 ret = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
80 while self.curNode != self.doc.documentElement:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
81 ret.append("</%s>" % (self.curNode.nodeName, ))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
82 self.curNode = self.curNode.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
83 return ''.join(ret)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
84
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
85 def getFooter(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
86 return "</%s>" % self.doc.documentElement.nodeName
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
87
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
88 class Formatter(FormatterBase):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
89 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
90 Send plain text data.
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
91 """
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
92
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
93 section_should_break = ['abstract', 'para', 'emphasis']
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
94
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
95 def __init__(self, request, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
96 """We should use this for creating the doc"""
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
97 FormatterBase.__init__(self, request, **kw)
86
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
98
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
99 self.doc = dom.createDocument(None, "article", dom.createDocumentType(
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
100 "article", "-//OASIS//DTD DocBook V4.4//EN",
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
101 "http://www.docbook.org/xml/4.4/docbookx.dtd"))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
102 self.root = self.doc.documentElement
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
103 self.curdepth = 0
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
104 self.outputFormatter = DocBookOutputFormatter(self.doc)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
105 self.exchangeKeys = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
106 self.exchangeValues = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
107
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
108 def startDocument(self, pagename):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
109 info = self.doc.createElement("articleinfo")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
110 title = self.doc.createElement("title")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
111 title.appendChild(self.doc.createTextNode(pagename))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
112 info.appendChild(title)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
113 self.root.appendChild(info)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
114 # set heading node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
115 self.outputFormatter.setHeading(info)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
116
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
117 return self.outputFormatter.getHeading()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
118
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
119 def startContent(self, content_id="content", **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
120 self.cur = self.root
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
121 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
122
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
123 def endContent(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
124 bodyStr = self.outputFormatter.getBody()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
125 # exchange all strings in body
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
126 i = 0
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
127 while i < len(self.exchangeKeys):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
128 bodyStr = bodyStr.replace(self.exchangeKeys[i], self.exchangeValues[i])
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
129 i += 1
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
130 return bodyStr + self.outputFormatter.getEndContent()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
131
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
132 def endDocument(self):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
133 return self.outputFormatter.getFooter()
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
134
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
135 def text(self, text, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
136 if text == "\\n":
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
137 srcText = "\n"
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
138 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
139 srcText = text
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
140 if self.cur.nodeName == "screen":
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
141 if self.cur.lastChild is not None:
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
142 from xml.dom.ext import Node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
143 if self.cur.lastChild.nodeType == Node.CDATA_SECTION_NODE:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
144 self.cur.lastChild.nodeValue = self.cur.lastChild.nodeValue + srcText
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
145 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
146 self.cur.appendChild(self.doc.createCDATASection(srcText))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
147 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
148 self.cur.appendChild(self.doc.createTextNode(srcText))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
149 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
150
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
151 def heading(self, on, depth, **kw):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
152 while self.cur.nodeName in self.section_should_break:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
153 self.cur = self.cur.parentNode
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
154
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
155 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
156 # try to go to higher level if needed
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
157 if depth <= self.curdepth:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
158 # number of levels we want to go higher
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
159 numberOfLevels = self.curdepth-depth + 1
1793
2a4caa295346 Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
160 for dummy in range(numberOfLevels):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
161 #find first non section node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
162 while (self.cur.nodeName != "section" and self.cur.nodeName != "article"):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
163 self.cur = self.cur.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
164
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
165 # I don't understand this code - looks like unnecessary -- maybe it is used to gain some vertical space for large headings?
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
166 # if len(self.cur.childNodes) < 3:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
167 # self._addEmptyNode("para")
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
168
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
169 # check if not top-level
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
170 if self.cur.nodeName != "article":
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
171 self.cur = self.cur.parentNode
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
172
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
173 section = self.doc.createElement("section")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
174 self.cur.appendChild(section)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
175 self.cur = section
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
176
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
177 title = self.doc.createElement("title")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
178 self.cur.appendChild(title)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
179 self.cur = title
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
180 self.curdepth = depth
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
181 else:
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
182 self.cur = self.cur.parentNode
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
183
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
184 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
185
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
186 def paragraph(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
187 FormatterBase.paragraph(self, on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
188 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
189 para = self.doc.createElement("para")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
190 self.cur.appendChild(para)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
191 self.cur = para
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
192 else:
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
193 self.cur = self.cur.parentNode
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
194 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
195
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
196 def linebreak(self, preformatted=1):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
197 if preformatted:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
198 self.text('\\n')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
199 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
200 #this should not happen
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
201 #self.text('CRAP')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
202 pass
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
203 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
204
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
205 def _handleNode(self, name, on, attributes=()):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
206 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
207 node = self.doc.createElement(name)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
208 self.cur.appendChild(node)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
209 if len(attributes) > 0:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
210 for name, value in attributes:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
211 node.setAttribute(name, value)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
212 self.cur = node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
213 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
214 self.cur = self.cur.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
215 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
216
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
217 def _addEmptyNode(self, name, attributes=()):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
218 node = self.doc.createElement(name)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
219 self.cur.appendChild(node)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
220 if len(attributes) > 0:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
221 for name, value in attributes:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
222 node.setAttribute(name, value)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
223
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
224 def _getTableCellCount(self, attrs=()):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
225 cols = 1
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
226 if attrs and attrs.has_key('colspan'):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
227 s1 = attrs['colspan']
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
228 s1 = str(s1).replace('"', '')
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
229 cols = int(s1)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
230 return cols
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
231
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
232 def _addTableCellDefinition(self, attrs=()):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
233 # Check number of columns
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
234 cols = self._getTableCellCount(attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
235 # Find node tgroup
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
236 actNode = self.cur
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
237 numberExistingColumns = 0
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
238 while actNode and actNode.nodeName != 'tgroup':
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
239 actNode = actNode.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
240 # Number of existing columns
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
241 nodeBefore = self.cur
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
242 if actNode:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
243 nodeBefore = actNode.firstChild
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
244 while nodeBefore and nodeBefore.nodeName != 'tbody':
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
245 nodeBefore = nodeBefore.nextSibling
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
246 numberExistingColumns += 1
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
247
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
248 while cols >= 1:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
249 # Create new node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
250 numberExistingColumns += 1
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
251 nnode = self.doc.createElement("colspec")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
252 nnode.setAttribute('colname', 'xxx' + str(numberExistingColumns))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
253 # Add node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
254 if actNode:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
255 actNode.insertBefore(nnode, nodeBefore)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
256 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
257 self.cur.insertBefore(nnode, nodeBefore)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
258 cols -= 1
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
259 # Set new number of columns for tgroup
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
260 self.cur.parentNode.parentNode.parentNode.setAttribute('cols', str(numberExistingColumns))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
261 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
262
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
263 ### Inline ##########################################################
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
264
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
265 def _handleFormatting(self, name, on, attributes=()):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
266 # We add all the elements we create to the list of elements that should not contain a section
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
267 if name not in self.section_should_break:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
268 self.section_should_break.append(name)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
269
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
270 return self._handleNode(name, on, attributes)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
271
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
272 def strong(self, on, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
273 return self._handleFormatting("emphasis", on, (('role', 'strong'), ))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
274
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
275 def emphasis(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
276 return self._handleFormatting("emphasis", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
277
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
278 def underline(self, on, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
279 return self._handleFormatting("emphasis", on, (('role', 'underline'), ))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
280
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
281 def highlight(self, on, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
282 return self._handleFormatting("emphasis", on, (('role', 'highlight'), ))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
283
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
284 def sup(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
285 return self._handleFormatting("superscript", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
286
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
287 def sub(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
288 return self._handleFormatting("subscript", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
289
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
290 def strike(self, on, **kw):
264
67e1f1d49a97 Fixed XML formatters.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 217
diff changeset
291 # does not yield <strike> using the HTML XSLT files here ...
67e1f1d49a97 Fixed XML formatters.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 217
diff changeset
292 # but seems to be correct
217
98df82a31b87 Added strike() to non HTML formatters. PLEASE REVIEW the xml_docbook FORMATTER!
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 200
diff changeset
293 return self._handleFormatting("emphasis", on,
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
294 (('role', 'strikethrough'), ))
217
98df82a31b87 Added strike() to non HTML formatters. PLEASE REVIEW the xml_docbook FORMATTER!
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 200
diff changeset
295
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
296 def code(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
297 return self._handleFormatting("code", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
298
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
299 def preformatted(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
300 return self._handleFormatting("screen", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
301
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
302
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
303 ### Lists ###########################################################
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
304
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
305 def number_list(self, on, type=None, start=None, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
306 docbook_ol_types = {'1': "arabic",
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
307 'a': "loweralpha",
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
308 'A': "upperalpha",
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
309 'i': "lowerroman",
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
310 'I': "upperroman"}
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
311
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
312 if type and docbook_ol_types.has_key(type):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
313 attrs = [("numeration", docbook_ol_types[type])]
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
314 else:
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
315 attrs = []
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
316
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
317 return self._handleNode('orderedlist', on, attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
318
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
319 def bullet_list(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
320 return self._handleNode("itemizedlist", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
321
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
322 def definition_list(self, on, **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
323 return self._handleNode("glosslist", on)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
324
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
325 def definition_term(self, on, compact=0, **kw):
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
326 # When on is false, we back out just on level. This is
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
327 # ok because we know definition_desc gets called, and we
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
328 # back out two levels there.
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
329 if on:
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
330 entry = self.doc.createElement('glossentry')
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
331 term = self.doc.createElement('glossterm')
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
332 entry.appendChild(term)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
333 self.cur.appendChild(entry)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
334 self.cur = term
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
335 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
336 self.cur = self.cur.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
337 return ""
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
338
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
339 def definition_desc(self, on, **kw):
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
340 # We backout two levels when 'on' is false, to leave the glossentry stuff
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
341 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
342 return self._handleNode("glossdef", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
343 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
344 self.cur = self.cur.parentNode.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
345 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
346
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
347 def listitem(self, on, **kw):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
348 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
349 node = self.doc.createElement("listitem")
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
350 self.cur.appendChild(node)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
351 self.cur = node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
352 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
353 self.cur = self.cur.parentNode
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
354 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
355
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
356
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
357 ### Links ###########################################################
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
358
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
359 # FIXME: This is quite crappy
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
360 def pagelink(self, on, pagename='', page=None, **kw):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
361 FormatterBase.pagelink(self, on, pagename, page, **kw)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
362
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
363 return self.interwikilink(on, 'Self', pagename) # FIXME
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
364
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
365 # FIXME: This is even more crappy
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
366 def interwikilink(self, on, interwiki='', pagename='', **kw):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
367 if not on:
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
368 return self.url(on, kw)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
369
828
902c34d95085 quoting for attachment filenames, wikiutil.load_wikimap, split_wiki can parse quoting, join_wiki does url_quote
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 734
diff changeset
370 wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:"%s"' % (interwiki, pagename))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
371 wikiurl = wikiutil.mapURL(self.request, wikiurl)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
372 href = wikiutil.join_wiki(wikiurl, wikitail)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
373
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
374 return self.url(on, href)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
375
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
376 def url(self, on, url=None, css=None, **kw):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
377 return self._handleNode("ulink", on, (('url', url), ))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
378
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
379 def anchordef(self, name):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
380 self._handleNode("anchor", True, (('id', name), ))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
381 self._handleNode("ulink", False)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
382 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
383
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
384 def anchorlink(self, on, name='', **kw):
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
385 id = kw.get('id', None)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
386 attrs = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
387 if name != '':
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
388 attrs.append(('endterm', name))
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
389 if id is not None:
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
390 attrs.append(('linkend', id))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
391 elif name != '':
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
392 attrs.append(('linkend', name))
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
393
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
394 return self._handleNode("link", on, attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
395
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
396 ### Attachments ######################################################
200
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
397
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
398 def attachment_link(self, url, text, **kw):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
399 _ = self.request.getText
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
400 pagename, filename = AttachFile.absoluteName(url, self.page.page_name)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
401 fname = wikiutil.taintfilename(filename)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
402 fpath = AttachFile.getFilename(self.request, pagename, fname)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
403 target = AttachFile.getAttachUrl(pagename, filename, self.request)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
404 if not os.path.exists(fpath):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
405 return self.text("[attachment:%s]" % url)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
406 else:
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
407 return (self.url(1, target, title="attachment:%s" % url) +
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
408 self.text(text) +
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
409 self.url(0))
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
410
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
411 def attachment_image(self, url, **kw):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
412 _ = self.request.getText
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
413 pagename, filename = AttachFile.absoluteName(url, self.page.page_name)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
414 fname = wikiutil.taintfilename(filename)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
415 fpath = AttachFile.getFilename(self.request, pagename, fname)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
416 if not os.path.exists(fpath):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
417 return self.text("[attachment:%s]" % url)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
418 else:
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
419 return self.image(
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
420 title="attachment:%s" % url,
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
421 src=AttachFile.getAttachUrl(pagename, filename,
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
422 self.request, addts=1))
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
423
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
424 def attachment_drawing(self, url, text, **kw):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
425 _ = self.request.getText
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
426 pagename, filename = AttachFile.absoluteName(url, self.page.page_name)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
427 fname = wikiutil.taintfilename(filename)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
428 drawing = fname
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
429 fname = fname + ".png"
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
430 filename = filename + ".png"
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 999
diff changeset
431 fpath = AttachFile.getFilename(self.request, pagename, fname)
200
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
432 if not os.path.exists(fpath):
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
433 return self.text("[drawing:%s]" % url)
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
434 else:
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
435 return self.image(
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
436 alt=drawing,
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
437 src=AttachFile.getAttachUrl(pagename, filename, self.request,
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
438 addts=1),
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
439 html_class="drawing")
7c5bba88937b attachment methods for the text_xml and xml_docbook formatters
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 159
diff changeset
440
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
441 ### Images and Smileys ##############################################
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
442
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
443 def image(self, src=None, **kw):
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
444 if src:
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
445 kw['src'] = src
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
446 media = self.doc.createElement('inlinemediaobject')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
447
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
448 imagewrap = self.doc.createElement('imageobject')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
449 media.appendChild(imagewrap)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
450
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
451 image = self.doc.createElement('imagedata')
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
452 if kw.has_key('src'):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
453 image.setAttribute('fileref', kw['src'])
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
454 if kw.has_key('width'):
734
bf2435e61f97 moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
455 image.setAttribute('width', str(kw['width']))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
456 if kw.has_key('height'):
734
bf2435e61f97 moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
457 image.setAttribute('depth', str(kw['height']))
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
458 imagewrap.appendChild(image)
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
459
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
460 title = ''
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
461 for a in ('title', 'html_title', 'alt', 'html_alt'):
466
de6f08a584fa fix broken smileys for docbook formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 407
diff changeset
462 if kw.has_key(a):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
463 title = kw[a]
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
464 break
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
465 if title:
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
466 txtcontainer = self.doc.createElement('textobject')
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
467 media.appendChild(txtcontainer)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
468 txtphrase = self.doc.createElement('phrase')
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
469 txtphrase.appendChild(self.doc.createTextNode(title))
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
470 txtcontainer.appendChild(txtphrase)
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
471
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
472 self.cur.appendChild(media)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
473 return ""
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
474
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
475 def smiley(self, text):
734
bf2435e61f97 moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
476 return self.request.theme.make_icon(text)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
477
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
478 def icon(self, type):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
479 return '' # self.request.theme.make_icon(type)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
480
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
481 ### Tables ##########################################################
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
482
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
483 #FIXME: We should copy code from text_html.py for attr handling
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
484
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
485 def table(self, on, attrs=None, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
486 sanitized_attrs = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
487 if attrs and attrs.has_key('id'):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
488 sanitized_attrs[id] = attrs['id']
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
489
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
490 self._handleNode("table", on, sanitized_attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
491 if on:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
492 self._addEmptyNode("caption") #dtd for table requires caption
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
493 self._handleNode("tgroup", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
494 self._handleNode("tbody", on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
495 return ""
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
496
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
497 def table_row(self, on, attrs=None, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
498 self.table_current_row_cells = 0
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
499 sanitized_attrs = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
500 if attrs and attrs.has_key('id'):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
501 sanitized_attrs[id] = attrs['id']
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
502 return self._handleNode("row", on, sanitized_attrs)
86
5181bcd3feb5 Show a better error message if PyXML is not installed and the docbook formatter is used.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 82
diff changeset
503
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
504 def table_cell(self, on, attrs=None, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
505 # Finish row definition
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
506 sanitized_attrs = []
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
507 if attrs and attrs.has_key('id'):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
508 sanitized_attrs[id] = attrs['id']
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
509 # Get number of newly added columns
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
510 startCount = self.table_current_row_cells
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
511 addedCellsCount = self._getTableCellCount(attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
512 self.table_current_row_cells += addedCellsCount
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
513 ret = self._handleNode("entry", on, sanitized_attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
514 if self.cur.parentNode == self.cur.parentNode.parentNode.firstChild:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
515 self._addTableCellDefinition(attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
516 # Set cell join if any
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
517 if addedCellsCount > 1:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
518 startString = "xxx" + str(startCount)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
519 stopString = "xxx" + str(startCount + addedCellsCount - 1)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
520 self.cur.setAttribute("namest", startString)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
521 self.cur.setAttribute("nameend", stopString)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
522 return ret
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
523
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
524 ### Code ############################################################
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
525
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
526 def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
527 show = show and 'numbered' or 'unnumbered'
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
528 if start < 1:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
529 start = 1
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
530
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
531 attrs = (('id', code_id),
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
532 ('linenumbering', show),
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
533 ('startinglinenumber', str(start)),
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
534 ('language', code_type),
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
535 ('format', 'linespecific'),
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
536 )
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
537 return self._handleFormatting("screen", on, attrs)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
538
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
539 def code_line(self, on):
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
540 return '' # No clue why something should be done here
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
541
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
542 def code_token(self, on, tok_type):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
543 toks_map = {'ID':'methodname',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
544 'Operator':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
545 'Char':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
546 'Comment':'lineannotation',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
547 'Number':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
548 'String':'phrase',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
549 'SPChar':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
550 'ResWord':'token',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
551 'ConsWord':'symbol',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
552 'Error':'errortext',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
553 'ResWord2':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
554 'Special':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
555 'Preprc':'',
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
556 'Text':''}
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
557 if toks_map.has_key(tok_type) and toks_map[tok_type] != '':
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
558 return self._handleFormatting(toks_map[tok_type], on)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
559 else:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
560 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
561
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
562 def macro(self, macro_obj, name, args):
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
563 if name == "TableOfContents":
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
564 # Table of content can be inserted in docbook transformation
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
565 return u""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
566 # output of all macros is added as the text node
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
567 # At the begining text mode contain some string which is later
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
568 # exchange for real value. There is problem that data inserted
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
569 # as text mode are encoded to xml, e.g. < is encoded in the output as &lt;
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
570 text = FormatterBase.macro(self, macro_obj, name, args)
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
571 if len(text) > 0:
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
572 # prepare identificator
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
573 sKey = "EXCHANGESTRINGMACRO-" + str(len(self.exchangeKeys)) + "-EXCHANGESTRINGMACRO"
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
574 self.exchangeKeys.append(sKey)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
575 self.exchangeValues.append(text)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
576 # append data to lists
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
577 self.text(sKey)
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
578 return u""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
579
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
580 ### Not supported ###################################################
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
581
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 828
diff changeset
582 def rule(self, size=0, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
583 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
584
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
585 def small(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
586 return ""
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
587
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
588 def big(self, on, **kw):
82
0da5d27c0c3c Integrated new additions by Petr into the DocBook formatter. This includes better macro support, better heading semantics and cleaner include-macro results. Fixed line endings.
Alexander Schremmer <alex@alexanderweb.de.tla>
parents: 0
diff changeset
589 return ""
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 264
diff changeset
590