Attachment 'moin--mpv--0--patch-10.diff.txt'

Download

   1 Only in moin--main--1.3/: ++log.moin--main--1.3--arch@arch.thinkmo.de--2003-archives
   2 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
   3 --- moin--main--1.3/MoinMoin/formatter/text_html.py	2004-10-10 19:26:26.000000000 -0300
   4 +++ moin--mpv--0/MoinMoin/formatter/text_html.py	2004-10-11 13:45:35.000000000 -0300
   5 @@ -10,6 +10,8 @@
   6  from MoinMoin import wikiutil, i18n, config
   7  from MoinMoin.Page import Page
   8  
   9 +import string
  10 +
  11  class Formatter(FormatterBase):
  12      """
  13          Send HTML data.
  14 @@ -31,6 +33,8 @@
  15          self._is_included = kw.get('is_included',False)
  16          self.request = request
  17          self.cfg = request.cfg
  18 +        self._numbered_list = []
  19 +        self._list_numbers_complete = None
  20  
  21          if not hasattr(request, '_fmt_hd_counters'):
  22              request._fmt_hd_counters = []
  23 @@ -326,29 +330,61 @@
  24      # Lists ##############################################################
  25  
  26      def number_list(self, on, type=None, start=None):
  27 +        '''Generate the start or end of a numbered list'''
  28 +        if self._list_numbers_complete == None:
  29 +            # if not yet set, detect correct list number settings.
  30 +            self._list_numbers_complete = self.pragmaOverridesConfig(
  31 +                self.request.getPragma('list-numbers-complete', None),
  32 +                self.cfg.list_numbers_complete)
  33 +        result = ''
  34          if on:
  35              attrs = ''
  36 -            if type: attrs += ' type="%s"' % (type,)
  37 -            if start is not None: attrs += ' start="%d"' % (start,)
  38 -            result = '<ol%s%s>' % (self._langAttr(), attrs)
  39 -        else:    
  40 -            result = '</ol>\n'
  41 +            if self._list_numbers_complete:
  42 +                if not start: self._numbered_list.append([type, 0])
  43 +                else: self._numbered_list.append([type, int(start)-1])
  44 +                attrs += ' class="complete"'
  45 +                result = '<ul%s%s>' % (self._langAttr(), attrs)
  46 +            else:
  47 +                if type: attrs += ' type="%s"' % (type,)
  48 +                if start is not None: attrs += ' start="%d"' % (start,)
  49 +                result = '<ol%s%s>' % (self._langAttr(), attrs)
  50 +        else:
  51 +            if self._list_numbers_complete:
  52 +                self._numbered_list.pop()
  53 +                result = '</ul>\n'
  54 +            else:
  55 +                result = '</ol>\n'
  56          return '%s\n' % result
  57      
  58      def bullet_list(self, on):
  59 -        result = ['<ul%s>' % self._langAttr(), '</ul>\n'][not on]
  60 +        if self._list_numbers_complete == None:
  61 +            self._list_numbers_complete = self.pragmaOverridesConfig(
  62 +                self.request.getPragma('list-numbers-complete', None),
  63 +                self.cfg.list_numbers_complete)
  64 +        if self._list_numbers_complete:
  65 +            if on:
  66 +                self._numbered_list.append(['bullet', 0])
  67 +            else:
  68 +                self._numbered_list.pop()
  69 +        result = ['<ul%s>' % (self._langAttr()), '</ul>\n'][not on]
  70          return '%s\n' % result
  71  
  72      def listitem(self, on, **kw):
  73          """ List item inherit its lang from the list. """
  74          self._in_li = on != 0
  75 +        result = ''
  76          if on:
  77 +            numbering = ''
  78 +            if self._list_numbers_complete:
  79 +                nr = self.listNumber(self._numbered_list)
  80 +                if nr: numbering = "%s. " % nr
  81 +                self._terse = 1
  82              css_class = kw.get('css_class', None)
  83              attrs = ''
  84              if css_class: attrs += ' class="%s"' % (css_class,)
  85              style = kw.get('style', None)
  86              if style:  attrs += ' style="%s"' % style
  87 -            result = '<li%s>' % (attrs,)
  88 +            result = '<li%s>%s' % (attrs,numbering)
  89          else:
  90              result = '</li>'
  91          return '%s\n' % result
  92 @@ -470,3 +506,67 @@
  93  
  94      def escapedText(self, text):
  95          return wikiutil.escape(text)
  96 +
  97 +    def pragmaOverridesConfig(self, pragma, config, default=0):
  98 +        res = pragma
  99 +        if res == None:
 100 +            res = config
 101 +        if res in [1, '1', 'on', 'On', 'ON']:
 102 +            return 1
 103 +        if res in [0, '0', 'off', 'Off', 'OFF']:
 104 +            return 0
 105 +        else:
 106 +            return default
 107 +
 108 +    def listNumber(self, nr_list):
 109 +        '''Returns a complete list item number'''
 110 +        nr_list[-1][1] += 1
 111 +        result = []
 112 +        for (listType, value) in nr_list:
 113 +            if(listType == u'1'):
 114 +                result.append(str(int(value)))
 115 +            elif(listType == u'a'):
 116 +                result.append(string.ascii_lowercase[(value-1) % 26])
 117 +            elif(listType == u'A'):
 118 +                result.append(string.ascii_uppercase[(value-1) % 26])
 119 +            elif(listType == u'i'):
 120 +                result.append( self.romanNumbering(int(value)) )
 121 +            elif(listType == u'I'):
 122 +                result.append( self.romanNumbering(int(value)).upper() )
 123 +            elif(listType == u'bullet'):
 124 +                result = []
 125 +        return u".".join(result)
 126 +
 127 +    def romanNumbering(self, value):
 128 +        '''Return the roman numeral of a integer value'''
 129 +        if value < 1 or value > 3999:
 130 +            raise exceptions.OverflowError
 131 +        roman_digits = ( (1000, 'm'),
 132 +                         (500, 'd'),
 133 +                         (100, 'c'),
 134 +                         (50, 'l'),
 135 +                         (10, 'x'),
 136 +                         (5, 'v'),
 137 +                         (1, 'i') );
 138 +        res = []
 139 +        pos = 0
 140 +        while pos <= len(roman_digits):
 141 +            (weight, letter) = roman_digits[pos]
 142 +            occ = int(value / weight)
 143 +            if(occ != 0):
 144 +                value = value % (occ * weight);
 145 +            if occ > 4 and occ < 9:
 146 +                res.append( roman_digits[pos-1][1] )
 147 +                occ -= 5
 148 +            if occ == 4:
 149 +                res.append( letter )
 150 +                res.append( roman_digits[pos-1][1] )
 151 +            elif occ == 9:
 152 +                res.append( letter )
 153 +                res.append( roman_digits[pos-2][1] )
 154 +            else:
 155 +                while (occ != 0):
 156 +                    res.append( letter )
 157 +                    occ -= 1
 158 +            pos += 2
 159 +        return ''.join(res)
 160 diff -x '*.pyc' -x {arch} -x '*~' -u -r moin--main--1.3/MoinMoin/macro/TableOfContents.py moin--mpv--0/MoinMoin/macro/TableOfContents.py
 161 --- moin--main--1.3/MoinMoin/macro/TableOfContents.py	2004-10-10 19:26:26.000000000 -0300
 162 +++ moin--mpv--0/MoinMoin/macro/TableOfContents.py	2004-10-11 13:43:50.000000000 -0300
 163 @@ -131,7 +131,7 @@
 164  
 165          # Open Lists
 166          for i in range(0,newindent-self.indent):
 167 -            self.result.append(self.macro.formatter.number_list(1))
 168 +            self.result.append(self.macro.formatter.number_list(1, '1'))
 169  
 170          # Add the heading
 171          unique_id = ''
 172 diff -x '*.pyc' -x {arch} -x '*~' -u -r moin--main--1.3/MoinMoin/multiconfig.py moin--mpv--0/MoinMoin/multiconfig.py
 173 --- moin--main--1.3/MoinMoin/multiconfig.py	2004-10-10 19:26:26.000000000 -0300
 174 +++ moin--mpv--0/MoinMoin/multiconfig.py	2004-10-11 11:52:39.000000000 -0300
 175 @@ -200,6 +200,7 @@
 176      shared_intermap = None # can be string or list of strings (filenames)
 177      show_hosts = 1
 178      show_section_numbers = 1
 179 +    list_numbers_complete = 0
 180      show_timings = 0
 181      show_version = 0
 182      sitename = 'An Unnamed MoinMoin Wiki'
 183 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
 184 --- moin--main--1.3/wiki/htdocs/classic/css/common.css	2004-10-10 19:26:26.000000000 -0300
 185 +++ moin--mpv--0/wiki/htdocs/classic/css/common.css	2004-10-10 21:57:16.000000000 -0300
 186 @@ -64,6 +64,10 @@
 187  	list-style: none;
 188  }
 189  
 190 +.complete > li { 
 191 +        list-style: none;
 192 +}
 193 +
 194  /* eye catchers */
 195  .warning 
 196  {

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] (2004-10-11 17:03:52, 7.7 KB) [[attachment:moin--mpv--0--patch-10.diff.txt]]
  • [get | view] (2004-10-11 05:40:42, 5.7 KB) [[attachment:moin--mpv--0--patch-6.diff.txt]]
 All files | Selected Files: delete move to page copy to page

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