Back to index

moin  1.9.0~rc2
Namespaces | Functions | Variables
MoinMoin.parser Namespace Reference

Namespaces

namespace  _creole
namespace  _ParserBase
namespace  highlight
namespace  text
namespace  text_cplusplus
namespace  text_creole
namespace  text_csv
namespace  text_diff
namespace  text_docbook
namespace  text_html
namespace  text_irssi
namespace  text_java
namespace  text_moin_wiki
namespace  text_pascal
namespace  text_python
namespace  text_rst
namespace  text_xslt

Functions

def parse_start_step

Variables

tuple modules = pysupport.getPackageModules(__file__)

Function Documentation

def MoinMoin.parser.parse_start_step (   request,
  args 
)
Parses common Colorizer parameters start, step, numbers.
Uses L{wikiutil.parseAttributes} and sanitizes the results.

Start and step must be a non negative number and default to 1,
numbers might be on, off, or none and defaults to on. On or off
means that numbers are switchable via JavaScript (html formatter),
disabled means that numbers are disabled completely.

attrdict is returned as last element in the tuple, to enable the
calling parser to extract further arguments.

@param request: a request instance
@param args: the argument string

@returns: numbers, start, step, attrdict

Definition at line 18 of file __init__.py.

00018 
00019 def parse_start_step(request, args):
00020     """
00021     Parses common Colorizer parameters start, step, numbers.
00022     Uses L{wikiutil.parseAttributes} and sanitizes the results.
00023 
00024     Start and step must be a non negative number and default to 1,
00025     numbers might be on, off, or none and defaults to on. On or off
00026     means that numbers are switchable via JavaScript (html formatter),
00027     disabled means that numbers are disabled completely.
00028 
00029     attrdict is returned as last element in the tuple, to enable the
00030     calling parser to extract further arguments.
00031 
00032     @param request: a request instance
00033     @param args: the argument string
00034 
00035     @returns: numbers, start, step, attrdict
00036     """
00037     nums, start, step = 1, 1, 1
00038     attrs, msg = wikiutil.parseAttributes(request, args)
00039     if not msg:
00040         try:
00041             start = int(attrs.get('start', '"1"')[1:-1])
00042         except ValueError:
00043             pass
00044         try:
00045             step = int(attrs.get('step', '"1"')[1:-1])
00046         except ValueError:
00047             pass
00048         if attrs.get('numbers', '"on"')[1:-1].lower() in ('off', 'false', 'no'):
00049             nums = 0
00050         elif attrs.get('numbers', '"on"')[1:-1].lower() in ('none', 'disable'):
00051             nums = -1
00052     return nums, start, step, attrs
00053 

Variable Documentation

tuple MoinMoin.parser.modules = pysupport.getPackageModules(__file__)

Definition at line 15 of file __init__.py.