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 --- moin--main--1.3/MoinMoin/formatter/text_html.py 2004-10-10 19:26:26.000000000 -0300 +++ moin--mpv--0/MoinMoin/formatter/text_html.py 2004-10-10 22:03:10.000000000 -0300 @@ -10,6 +10,8 @@ from MoinMoin import wikiutil, i18n, config from MoinMoin.Page import Page +import string + class Formatter(FormatterBase): """ Send HTML data. @@ -32,6 +34,8 @@ self.request = request self.cfg = request.cfg + self._numbered_list = [] + if not hasattr(request, '_fmt_hd_counters'): request._fmt_hd_counters = [] @@ -326,29 +330,55 @@ # Lists ############################################################## def number_list(self, on, type=None, start=None): + full = self.request.getPragma('list-numbers-complete') + result = '' if on: attrs = '' - if type: attrs += ' type="%s"' % (type,) - if start is not None: attrs += ' start="%d"' % (start,) - result = '' % (self._langAttr(), attrs) - else: - result = '\n' + if full: + if not start: self._numbered_list.append([type, 0]) + else: self._numbered_list.append([type, int(start)-1]) + attrs += ' class="complete"' + result = '' % (self._langAttr(), attrs) + else: + if type: attrs += ' type="%s"' % (type,) + if start is not None: attrs += ' start="%d"' % (start,) + result = '' % (self._langAttr(), attrs) + else: + if full: + self._numbered_list.pop() + result = '\n' + else: + result = '\n' return '%s\n' % result def bullet_list(self, on): - result = ['' % self._langAttr(), '\n'][not on] + if self.request.getPragma('list-numbers-complete'): + if on: + self._numbered_list.append(['bullet', 0]) + else: + self._numbered_list.pop() + result = ['' % (self._langAttr()), '\n'][not on] return '%s\n' % result def listitem(self, on, **kw): """ List item inherit its lang from the list. """ self._in_li = on != 0 + #if (self.request.getPragma('list-numbers-complete') + # and self._numbered_list[-1][0] != 'bullet'): + # return "%s\n" % self.completeListitem(on) + result = '' if on: + numbering = '' + if self.request.getPragma('list-numbers-complete'): + nr = self.numbering_show(self._numbered_list) + if nr: numbering = "%s - " % nr + self._terse = 1 css_class = kw.get('css_class', None) attrs = '' if css_class: attrs += ' class="%s"' % (css_class,) style = kw.get('style', None) if style: attrs += ' style="%s"' % style - result = '' % (attrs,) + result = '%s' % (attrs,numbering) else: result = '' return '%s\n' % result @@ -470,3 +500,56 @@ def escapedText(self, text): return wikiutil.escape(text) + + def numbering_show(self, nr_list): + '''Returns a complete list item number''' + nr_list[-1][1] += 1 + result = [] + for (listType, value) in nr_list: + if(listType == u'1'): + result.append(str(int(value))) + elif(listType == u'a'): + result.append(string.ascii_lowercase[(value-1) % 26]) + elif(listType == u'A'): + result.append(string.ascii_uppercase[(value-1) % 26]) + elif(listType == u'i'): + result.append( self.romanNumbering(int(value)) ) + elif(listType == u'I'): + result.append( self.romanNumbering(int(value)).upper() ) + elif(listType == u'bullet'): + result = [] + return u".".join(result) + + def romanNumbering(self, value): + '''Return the roman numeral of a integer value''' + if value < 1 or value > 3999: + raise exceptions.OverflowError + roman_digits = ( (1000, 'm'), + (500, 'd'), + (100, 'c'), + (50, 'l'), + (10, 'x'), + (5, 'v'), + (1, 'i') ); + res = [] + pos = 0 + while pos <= len(roman_digits): + (weight, letter) = roman_digits[pos] + occ = int(value / weight) + if(occ != 0): + value = value % (occ * weight); + if occ > 4 and occ < 9: + res.append( roman_digits[pos-1][1] ) + occ -= 5 + if occ == 4: + res.append( letter ) + res.append( roman_digits[pos-1][1] ) + elif occ == 9: + res.append( letter ) + res.append( roman_digits[pos-2][1] ) + else: + while (occ != 0): + res.append( letter ) + occ -= 1 + pos += 2 + return ''.join(res) 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 --- moin--main--1.3/wiki/htdocs/classic/css/common.css 2004-10-10 19:26:26.000000000 -0300 +++ moin--mpv--0/wiki/htdocs/classic/css/common.css 2004-10-10 21:57:16.000000000 -0300 @@ -64,6 +64,10 @@ list-style: none; } +.complete > li { + list-style: none; +} + /* eye catchers */ .warning {