Attachment 'text_xml.py.diff'

Download

   1 --- MoinMoin/formatter/text_xml.py.orig	2005-12-01 20:30:07.000000000 -0500
   2 +++ MoinMoin/formatter/text_xml.py	2006-01-12 14:27:20.000000000 -0500
   3 @@ -77,12 +77,12 @@
   4          return '<attachmentdrawing href="%s">%s</attachmentdrawing>' % (
   5              url, text)
   6  
   7 -    def text(self, text):
   8 +    def text(self, text, **kw):
   9          if self.in_pre:
  10              return text.replace(']]>', ']]>]]&gt;<![CDATA[')
  11          return self._escape(text)
  12  
  13 -    def rule(self, size=0):
  14 +    def rule(self, size=0, **kw):
  15          return "\n<br/>%s<br/>\n" % ("-"*78,) # <hr/> not supported in stylebook
  16          if size:
  17              return '<hr size="%d"/>\n' % (size,)
  18 @@ -92,21 +92,21 @@
  19      def icon(self, type):
  20          return '<icon type="%s" />' % type            
  21  
  22 -    def strong(self, on):
  23 +    def strong(self, on, **kw):
  24          return ['<strong>', '</strong>'][not on]
  25  
  26 -    def emphasis(self, on):
  27 +    def emphasis(self, on, **kw):
  28          return ['<em>', '</em>'][not on]
  29  
  30 -    def highlight(self, on):
  31 +    def highlight(self, on, **kw):
  32          return ['<strong>', '</strong>'][not on]
  33  
  34 -    def number_list(self, on, type=None, start=None):
  35 +    def number_list(self, on, type=None, start=None, **kw):
  36          result = ''
  37          if self.in_p: result = self.paragraph(0)
  38          return result + ['<ol>', '</ol>\n'][not on]
  39  
  40 -    def bullet_list(self, on):
  41 +    def bullet_list(self, on, **kw):
  42          result = ''
  43          if self.in_p: result = self.paragraph(0)
  44          return result + ['<ul>', '</ul>\n'][not on]
  45 @@ -117,22 +117,22 @@
  46      def code(self, on, **kw):
  47          return ['<code>', '</code>'][not on]
  48  
  49 -    def sup(self, on):
  50 +    def sup(self, on, **kw):
  51          return ['<sup>', '</sup>'][not on]
  52  
  53 -    def sub(self, on):
  54 +    def sub(self, on, **kw):
  55          return ['<sub>', '</sub>'][not on]
  56  
  57 -    def strike(self, on):
  58 +    def strike(self, on, **kw):
  59          return ['<strike>', '</strike>'][not on]
  60  
  61 -    def preformatted(self, on):
  62 +    def preformatted(self, on, **kw):
  63          FormatterBase.preformatted(self, on)
  64          result = ''
  65          if self.in_p: result = self.paragraph(0)
  66          return result + ['<source><![CDATA[', ']]></source>'][not on]
  67  
  68 -    def paragraph(self, on):
  69 +    def paragraph(self, on, **kw):
  70          FormatterBase.paragraph(self, on)
  71          return ['<p>', '</p>\n'][not on]
  72  
  73 @@ -160,41 +160,42 @@
  74  
  75          return result + '<s%d%s title="' % (depth, id_text)
  76  
  77 -    def table(self, on, attrs={}):
  78 +    def table(self, on, attrs={}, **kw):
  79          return ['<table>', '</table>'][not on]
  80  
  81 -    def table_row(self, on, attrs={}):
  82 +    def table_row(self, on, attrs={}, **kw):
  83          return ['<tr>', '</tr>'][not on]
  84  
  85 -    def table_cell(self, on, attrs={}):
  86 +    def table_cell(self, on, attrs={}, **kw):
  87          return ['<td>', '</td>'][not on]
  88  
  89      def anchordef(self, id):
  90          return '<anchor id="%s"/>' % id
  91  
  92 -    def anchorlink(self, on, name='', id=None):
  93 +    def anchorlink(self, on, name='', **kw):
  94 +        id = kw.get('id',None)
  95          extra = ''
  96          if id:
  97              extra = ' id="%s"' % id
  98          return ('<link anchor="%s"%s>' % (name, extra) ,'</link>') [not on]
  99  
 100 -    def underline(self, on):
 101 +    def underline(self, on, **kw):
 102          return self.strong(on) # no underline in StyleBook
 103  
 104 -    def definition_list(self, on):
 105 +    def definition_list(self, on, **kw):
 106          result = ''
 107          if self.in_p: result = self.paragraph(0)
 108          return result + ['<gloss>', '</gloss>'][not on]
 109  
 110 -    def definition_term(self, on, compact=0):
 111 +    def definition_term(self, on, compact=0, **kw):
 112          return ['<label>', '</label>'][not on]
 113  
 114 -    def definition_desc(self, on):
 115 +    def definition_desc(self, on, **kw):
 116          return ['<item>', '</item>'][not on]
 117  
 118 -    def image(self, **kw):
 119 +    def image(self, src=None, **kw):
 120          valid_attrs = ['src', 'width', 'height', 'alt']
 121 -        attrs = {}
 122 +        attrs = {'src':src}
 123          for key, value in kw.items():
 124              if key in valid_attrs:
 125                  attrs[key] = value

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.