Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.script.migration._conv160_wiki Namespace Reference

Classes

class  Converter

Functions

def convert_wiki
def explore_args

Variables

 STONEAGE_IMAGELINK = False

Function Documentation

def MoinMoin.script.migration._conv160_wiki.convert_wiki (   request,
  pagename,
  intext,
  renames 
)
Convert content written in wiki markup 

Definition at line 40 of file _conv160_wiki.py.

00040 
00041 def convert_wiki(request, pagename, intext, renames):
00042     """ Convert content written in wiki markup """
00043     noeol = False
00044     if not intext.endswith('\r\n'):
00045         intext += '\r\n'
00046         noeol = True
00047     c = Converter(request, pagename, intext, renames)
00048     result = request.redirectedOutput(c.convert, request)
00049     if noeol and result.endswith('\r\n'):
00050         result = result[:-2]
00051     return result
00052 

Here is the caller graph for this function:

explore args for positional and keyword parameters 

Definition at line 59 of file _conv160_wiki.py.

00059 
00060 def explore_args(args):
00061     """ explore args for positional and keyword parameters """
00062     if args:
00063         args = args.split(',')
00064         args = [arg.strip() for arg in args]
00065     else:
00066         args = []
00067 
00068     kw_count = 0
00069     kw = {} # keyword args
00070     pp = [] # positional parameters
00071 
00072     kwAllowed = ('width', 'height', 'alt')
00073 
00074     for arg in args:
00075         if '=' in arg:
00076             key, value = arg.split('=', 1)
00077             key_lowerstr = str(key.lower())
00078             # avoid that urls with "=" are interpreted as keyword
00079             if key_lowerstr in kwAllowed:
00080                 kw_count += 1
00081                 kw[key_lowerstr] = value
00082             elif not kw_count and '://' in arg:
00083                 # assuming that this is the image
00084                 pp.append(arg)
00085         else:
00086             pp.append(arg)
00087 
00088     if STONEAGE_IMAGELINK and len(pp) >= 2:
00089         pp[0], pp[1] = pp[1], pp[0]
00090 
00091     return pp, kw
00092 

Here is the caller graph for this function:


Variable Documentation

Definition at line 53 of file _conv160_wiki.py.