Only in moin--main--1.3/: ++log.moin--main--1.3--arch@arch.thinkmo.de--2003-archives
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-11 13:45:35.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.
@@ -31,6 +33,8 @@
self._is_included = kw.get('is_included',False)
self.request = request
self.cfg = request.cfg
+ self._numbered_list = []
+ self._list_numbers_complete = None
if not hasattr(request, '_fmt_hd_counters'):
request._fmt_hd_counters = []
@@ -326,29 +330,61 @@
# Lists ##############################################################
def number_list(self, on, type=None, start=None):
+ '''Generate the start or end of a numbered list'''
+ if self._list_numbers_complete == None:
+ # if not yet set, detect correct list number settings.
+ self._list_numbers_complete = self.pragmaOverridesConfig(
+ self.request.getPragma('list-numbers-complete', None),
+ self.cfg.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 self._list_numbers_complete:
+ 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 self._list_numbers_complete:
+ self._numbered_list.pop()
+ result = '
\n'
+ else:
+ result = '\n'
return '%s\n' % result
def bullet_list(self, on):
- result = ['\n'][not on]
+ if self._list_numbers_complete == None:
+ self._list_numbers_complete = self.pragmaOverridesConfig(
+ self.request.getPragma('list-numbers-complete', None),
+ self.cfg.list_numbers_complete)
+ if self._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
+ result = ''
if on:
+ numbering = ''
+ if self._list_numbers_complete:
+ nr = self.listNumber(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 +506,67 @@
def escapedText(self, text):
return wikiutil.escape(text)
+
+ def pragmaOverridesConfig(self, pragma, config, default=0):
+ res = pragma
+ if res == None:
+ res = config
+ if res in [1, '1', 'on', 'On', 'ON']:
+ return 1
+ if res in [0, '0', 'off', 'Off', 'OFF']:
+ return 0
+ else:
+ return default
+
+ def listNumber(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/MoinMoin/macro/TableOfContents.py moin--mpv--0/MoinMoin/macro/TableOfContents.py
--- moin--main--1.3/MoinMoin/macro/TableOfContents.py 2004-10-10 19:26:26.000000000 -0300
+++ moin--mpv--0/MoinMoin/macro/TableOfContents.py 2004-10-11 13:43:50.000000000 -0300
@@ -131,7 +131,7 @@
# Open Lists
for i in range(0,newindent-self.indent):
- self.result.append(self.macro.formatter.number_list(1))
+ self.result.append(self.macro.formatter.number_list(1, '1'))
# Add the heading
unique_id = ''
diff -x '*.pyc' -x {arch} -x '*~' -u -r moin--main--1.3/MoinMoin/multiconfig.py moin--mpv--0/MoinMoin/multiconfig.py
--- moin--main--1.3/MoinMoin/multiconfig.py 2004-10-10 19:26:26.000000000 -0300
+++ moin--mpv--0/MoinMoin/multiconfig.py 2004-10-11 11:52:39.000000000 -0300
@@ -200,6 +200,7 @@
shared_intermap = None # can be string or list of strings (filenames)
show_hosts = 1
show_section_numbers = 1
+ list_numbers_complete = 0
show_timings = 0
show_version = 0
sitename = 'An Unnamed MoinMoin Wiki'
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
{