12
12
from MoinMoin.util import pysupport
13
from MoinMoin import wikiutil
15
14
modules = pysupport.getPackageModules(__file__)
18
def parse_start_step(request, args):
20
Parses common Colorizer parameters start, step, numbers.
21
Uses L{wikiutil.parseAttributes} and sanitizes the results.
23
Start and step must be a non negative number and default to 1,
24
numbers might be on, off, or none and defaults to on. On or off
25
means that numbers are switchable via JavaScript (html formatter),
26
disabled means that numbers are disabled completely.
28
attrdict is returned as last element in the tuple, to enable the
29
calling parser to extract further arguments.
31
@param request: a request instance
32
@param args: the argument string
34
@returns: numbers, start, step, attrdict
36
nums, start, step = 1, 1, 1
37
attrs, msg = wikiutil.parseAttributes(request, args)
40
start = int(attrs.get('start', '"1"')[1:-1])
44
step = int(attrs.get('step', '"1"')[1:-1])
47
if attrs.get('numbers', '"on"')[1:-1].lower() in ('off', 'false', 'no'):
49
elif attrs.get('numbers', '"on"')[1:-1].lower() in ('none', 'disable'):
51
return nums, start, step, attrs