Attachment 'xml_docbook.py.diff'

Download

   1 --- MoinMoin/formatter/xml_docbook.py.orig	2005-12-01 20:30:07.000000000 -0500
   2 +++ MoinMoin/formatter/xml_docbook.py	2006-01-12 14:39:36.000000000 -0500
   3 @@ -132,7 +132,7 @@
   4      def endDocument(self):
   5          return self.outputFormatter.getFooter()
   6  
   7 -    def text(self, text):
   8 +    def text(self, text, **kw):
   9          if text == "\\n":
  10              srcText = "\n"
  11          else:
  12 @@ -183,7 +183,7 @@
  13  
  14          return ""
  15  
  16 -    def paragraph(self, on):
  17 +    def paragraph(self, on, **kw):
  18          FormatterBase.paragraph(self, on)
  19          if on:
  20              para = self.doc.createElement("para")
  21 @@ -269,40 +269,40 @@
  22  
  23          return self._handleNode(name, on, attributes)
  24  
  25 -    def strong(self, on):
  26 +    def strong(self, on, **kw):
  27          return self._handleFormatting("emphasis", on, (('role','strong'), ))
  28  
  29 -    def emphasis(self, on):
  30 +    def emphasis(self, on, **kw):
  31          return self._handleFormatting("emphasis", on)
  32  
  33 -    def underline(self, on):
  34 +    def underline(self, on, **kw):
  35          return self._handleFormatting("emphasis", on, (('role','underline'), ))
  36  
  37 -    def highlight(self, on):
  38 +    def highlight(self, on, **kw):
  39          return self._handleFormatting("emphasis", on, (('role','highlight'), ))
  40  
  41 -    def sup(self, on):
  42 +    def sup(self, on, **kw):
  43          return self._handleFormatting("superscript", on)
  44  
  45 -    def sub(self, on):
  46 +    def sub(self, on, **kw):
  47          return self._handleFormatting("subscript", on)
  48  
  49 -    def strike(self, on):
  50 +    def strike(self, on, **kw):
  51          # does not yield <strike> using the HTML XSLT files here ...
  52          # but seems to be correct
  53          return self._handleFormatting("emphasis", on,
  54                                        (('role','strikethrough'), ))
  55  
  56 -    def code(self, on, **kwargs):
  57 +    def code(self, on, **kw):
  58          return self._handleFormatting("code", on)
  59  
  60 -    def preformatted(self, on):
  61 +    def preformatted(self, on, **kw):
  62          return self._handleFormatting("screen", on)
  63  
  64  
  65  ### Lists ###########################################################
  66  
  67 -    def number_list(self, on, type=None, start=None):
  68 +    def number_list(self, on, type=None, start=None, **kw):
  69          docbook_ol_types = {'1': "arabic", 
  70                              'a': "loweralpha", 
  71                              'A': "upperalpha",
  72 @@ -316,16 +316,16 @@
  73  
  74          return self._handleNode('orderedlist', on, attrs)
  75  
  76 -    def bullet_list(self, on):
  77 +    def bullet_list(self, on, **kw):
  78          return self._handleNode("itemizedlist", on)
  79  
  80 -    def definition_list(self, on):
  81 +    def definition_list(self, on, **kw):
  82          return self._handleNode("glosslist", on)        
  83  
  84      '''When on is false, we back out just on level. This is
  85         ok because we know definition_desc gets called, and we
  86         back out two levels there'''
  87 -    def definition_term(self, on, compact=0):
  88 +    def definition_term(self, on, compact=0, **kw):
  89          if on:
  90              entry=self.doc.createElement('glossentry')
  91              term=self.doc.createElement('glossterm')
  92 @@ -337,7 +337,7 @@
  93          return ""
  94     
  95      '''We backout two levels when 'on' is false, to leave the glossentry stuff'''
  96 -    def definition_desc(self, on):
  97 +    def definition_desc(self, on, **kw):
  98          if on:
  99              return self._handleNode("glossdef", on)
 100          else:
 101 @@ -381,7 +381,8 @@
 102          self._handleNode("ulink", False)
 103          return ""
 104  
 105 -    def anchorlink(self, on, name='', id=None):
 106 +    def anchorlink(self, on, name='', **kw):
 107 +        id = kw.get('id',None)
 108          attrs = []
 109          if name != '':
 110              attrs.append(('endterm', name))
 111 @@ -438,7 +439,9 @@
 112  
 113  
 114  ### Images and Smileys ##############################################
 115 -    def image(self, **kw):
 116 +    def image(self, src=None, **kw):
 117 +        if src:
 118 +            kw['src']=src
 119          media = self.doc.createElement('inlinemediaobject')
 120  
 121          imagewrap = self.doc.createElement('imageobject')
 122 @@ -477,7 +480,7 @@
 123  
 124      #FIXME: We should copy code from text_html.py for attr handling
 125  
 126 -    def table(self, on, attrs=None):
 127 +    def table(self, on, attrs=None, **kw):
 128          sanitized_attrs = []
 129          if attrs and attrs.has_key('id'):
 130              sanitized_attrs[id] = attrs['id']
 131 @@ -489,14 +492,14 @@
 132          self._handleNode("tbody", on)
 133          return ""
 134      
 135 -    def table_row(self, on, attrs=None):
 136 +    def table_row(self, on, attrs=None, **kw):
 137          self.table_current_row_cells = 0
 138          sanitized_attrs = []
 139          if attrs and attrs.has_key('id'):
 140              sanitized_attrs[id] = attrs['id']
 141          return self._handleNode("row", on, sanitized_attrs)
 142  
 143 -    def table_cell(self, on, attrs=None):
 144 +    def table_cell(self, on, attrs=None, **kw):
 145          # Finish row definition
 146          sanitized_attrs = []
 147          if attrs and attrs.has_key('id'):
 148 @@ -572,11 +575,11 @@
 149          return u""
 150  
 151  ### Not supported ###################################################
 152 -    def rule(self, size = 0):
 153 +    def rule(self, size = 0, **kw):
 154          return ""
 155  
 156 -    def small(self, on):
 157 +    def small(self, on, **kw):
 158          return ""
 159  
 160 -    def big(self, on):
 161 +    def big(self, on, **kw):
 162          return ""

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-01-12 20:03:22, 4.3 KB) [[attachment:base.py.diff]]
  • [get | view] (2006-01-12 20:03:35, 4.0 KB) [[attachment:dom_xml.py.diff]]
  • [get | view] (2006-01-19 20:12:28, 67.9 KB) [[attachment:formatter-patch-r4.diff]]
  • [get | view] (2006-01-16 20:11:38, 58.7 KB) [[attachment:formatter-patch.diff]]
  • [get | view] (2006-01-12 20:03:43, 2.0 KB) [[attachment:text_gedit.py.diff]]
  • [get | view] (2006-01-12 20:03:51, 25.7 KB) [[attachment:text_html.py.diff]]
  • [get | view] (2006-01-12 20:03:58, 3.7 KB) [[attachment:text_plain.py.diff]]
  • [get | view] (2006-01-12 20:04:06, 4.0 KB) [[attachment:text_xml.py.diff]]
  • [get | view] (2006-01-12 20:04:11, 5.1 KB) [[attachment:xml_docbook.py.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.