Attachment 'moin--mpv--0--patch-6.diff.txt'
Download 1 diff -x '*.pyc' -x {arch} -x '*~' -u -r moin--main--1.3/MoinMoin/formatter/text_html.py moin--mpv--0/MoinMoin/formatter/text_html.py
2 --- moin--main--1.3/MoinMoin/formatter/text_html.py 2004-10-10 19:26:26.000000000 -0300
3 +++ moin--mpv--0/MoinMoin/formatter/text_html.py 2004-10-10 22:03:10.000000000 -0300
4 @@ -10,6 +10,8 @@
5 from MoinMoin import wikiutil, i18n, config
6 from MoinMoin.Page import Page
7
8 +import string
9 +
10 class Formatter(FormatterBase):
11 """
12 Send HTML data.
13 @@ -32,6 +34,8 @@
14 self.request = request
15 self.cfg = request.cfg
16
17 + self._numbered_list = []
18 +
19 if not hasattr(request, '_fmt_hd_counters'):
20 request._fmt_hd_counters = []
21
22 @@ -326,29 +330,55 @@
23 # Lists ##############################################################
24
25 def number_list(self, on, type=None, start=None):
26 + full = self.request.getPragma('list-numbers-complete')
27 + result = ''
28 if on:
29 attrs = ''
30 - if type: attrs += ' type="%s"' % (type,)
31 - if start is not None: attrs += ' start="%d"' % (start,)
32 - result = '<ol%s%s>' % (self._langAttr(), attrs)
33 - else:
34 - result = '</ol>\n'
35 + if full:
36 + if not start: self._numbered_list.append([type, 0])
37 + else: self._numbered_list.append([type, int(start)-1])
38 + attrs += ' class="complete"'
39 + result = '<ul%s%s>' % (self._langAttr(), attrs)
40 + else:
41 + if type: attrs += ' type="%s"' % (type,)
42 + if start is not None: attrs += ' start="%d"' % (start,)
43 + result = '<ol%s%s>' % (self._langAttr(), attrs)
44 + else:
45 + if full:
46 + self._numbered_list.pop()
47 + result = '</ul>\n'
48 + else:
49 + result = '</ol>\n'
50 return '%s\n' % result
51
52 def bullet_list(self, on):
53 - result = ['<ul%s>' % self._langAttr(), '</ul>\n'][not on]
54 + if self.request.getPragma('list-numbers-complete'):
55 + if on:
56 + self._numbered_list.append(['bullet', 0])
57 + else:
58 + self._numbered_list.pop()
59 + result = ['<ul%s>' % (self._langAttr()), '</ul>\n'][not on]
60 return '%s\n' % result
61
62 def listitem(self, on, **kw):
63 """ List item inherit its lang from the list. """
64 self._in_li = on != 0
65 + #if (self.request.getPragma('list-numbers-complete')
66 + # and self._numbered_list[-1][0] != 'bullet'):
67 + # return "%s\n" % self.completeListitem(on)
68 + result = ''
69 if on:
70 + numbering = ''
71 + if self.request.getPragma('list-numbers-complete'):
72 + nr = self.numbering_show(self._numbered_list)
73 + if nr: numbering = "%s - " % nr
74 + self._terse = 1
75 css_class = kw.get('css_class', None)
76 attrs = ''
77 if css_class: attrs += ' class="%s"' % (css_class,)
78 style = kw.get('style', None)
79 if style: attrs += ' style="%s"' % style
80 - result = '<li%s>' % (attrs,)
81 + result = '<li%s>%s' % (attrs,numbering)
82 else:
83 result = '</li>'
84 return '%s\n' % result
85 @@ -470,3 +500,56 @@
86
87 def escapedText(self, text):
88 return wikiutil.escape(text)
89 +
90 + def numbering_show(self, nr_list):
91 + '''Returns a complete list item number'''
92 + nr_list[-1][1] += 1
93 + result = []
94 + for (listType, value) in nr_list:
95 + if(listType == u'1'):
96 + result.append(str(int(value)))
97 + elif(listType == u'a'):
98 + result.append(string.ascii_lowercase[(value-1) % 26])
99 + elif(listType == u'A'):
100 + result.append(string.ascii_uppercase[(value-1) % 26])
101 + elif(listType == u'i'):
102 + result.append( self.romanNumbering(int(value)) )
103 + elif(listType == u'I'):
104 + result.append( self.romanNumbering(int(value)).upper() )
105 + elif(listType == u'bullet'):
106 + result = []
107 + return u".".join(result)
108 +
109 + def romanNumbering(self, value):
110 + '''Return the roman numeral of a integer value'''
111 + if value < 1 or value > 3999:
112 + raise exceptions.OverflowError
113 + roman_digits = ( (1000, 'm'),
114 + (500, 'd'),
115 + (100, 'c'),
116 + (50, 'l'),
117 + (10, 'x'),
118 + (5, 'v'),
119 + (1, 'i') );
120 + res = []
121 + pos = 0
122 + while pos <= len(roman_digits):
123 + (weight, letter) = roman_digits[pos]
124 + occ = int(value / weight)
125 + if(occ != 0):
126 + value = value % (occ * weight);
127 + if occ > 4 and occ < 9:
128 + res.append( roman_digits[pos-1][1] )
129 + occ -= 5
130 + if occ == 4:
131 + res.append( letter )
132 + res.append( roman_digits[pos-1][1] )
133 + elif occ == 9:
134 + res.append( letter )
135 + res.append( roman_digits[pos-2][1] )
136 + else:
137 + while (occ != 0):
138 + res.append( letter )
139 + occ -= 1
140 + pos += 2
141 + return ''.join(res)
142 diff -x '*.pyc' -x {arch} -x '*~' -u -r moin--main--1.3/wiki/htdocs/classic/css/common.css moin--mpv--0/wiki/htdocs/classic/css/common.css
143 --- moin--main--1.3/wiki/htdocs/classic/css/common.css 2004-10-10 19:26:26.000000000 -0300
144 +++ moin--mpv--0/wiki/htdocs/classic/css/common.css 2004-10-10 21:57:16.000000000 -0300
145 @@ -64,6 +64,10 @@
146 list-style: none;
147 }
148
149 +.complete > li {
150 + list-style: none;
151 +}
152 +
153 /* eye catchers */
154 .warning
155 {
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.You are not allowed to attach a file to this page.