Back to index

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

Classes

class  Converter

Functions

def convert_wiki
def explore_args

Variables

string QUOTE_CHARS = u"'\""
 STONEAGE_IMAGELINK = False

Function Documentation

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

Definition at line 31 of file _conv160a_wiki.py.

00031 
00032 def convert_wiki(request, pagename, intext, renames):
00033     """ Convert content written in wiki markup """
00034     noeol = False
00035     if not intext.endswith('\r\n'):
00036         intext += '\r\n'
00037         noeol = True
00038     c = Converter(request, pagename, intext, renames)
00039     result = request.redirectedOutput(c.convert, request)
00040     if noeol and result.endswith('\r\n'):
00041         result = result[:-2]
00042     return result
00043 

explore args for positional and keyword parameters 

Definition at line 50 of file _conv160a_wiki.py.

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

Here is the caller graph for this function:


Variable Documentation

Definition at line 29 of file _conv160a_wiki.py.

Definition at line 44 of file _conv160a_wiki.py.