Revision: 6105 Author: russblau Date: 2008-11-17 20:18:33 +0000 (Mon, 17 Nov 2008)
Log Message: ----------- fix treatment of positional parameters to match MediaWiki's
Modified Paths: -------------- branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py =================================================================== --- branches/rewrite/pywikibot/textlib.py 2008-11-17 19:48:45 UTC (rev 6104) +++ branches/rewrite/pywikibot/textlib.py 2008-11-17 20:18:33 UTC (rev 6105) @@ -569,8 +569,11 @@
Return value is a list of tuples. There is one tuple for each use of a template in the page, with the template title as the first entry and a - dict of parameters as the second entry. Positional parameters are - indexed by an int, named parameters by a str. + dict of parameters as the second entry. Parameters are indexed by + strings; as in MediaWiki, an unnamed parameter is given a parameter name + with an integer value corresponding to its position among the unnnamed + parameters, and if this results multiple parameters with the same name + only the last value provided will be returned.
""" # remove commented-out stuff etc. @@ -653,7 +656,7 @@ if "=" in param: param_name, param_val = param.split("=", 1) else: - param_name = numbered_param + param_name = unicode(numbered_param) param_val = param numbered_param += 1 for m2 in Rmarker.finditer(param_val):