Add global wiki variable expansion using @key@ syntax

When you save a page with @key@ you private UserName/*Dict wiki dictionary is search for the value of key and @key@ is replaced with the value. Same feature is needed globally for the wiki.

Possible use cases

How it can work

Issues

Patch

Here is a (barely tested) patch to MoinMoin 1.8.2 which implements this feature. I called the global dictionary "WikiDict", other names are of course conceivable.

   1 *** /usr/local/stow/moin-1.8.2/lib/python2.5/site-packages/MoinMoin/PageEditor.py.~1~
   2 --- /usr/local/stow/moin-1.8.2/lib/python2.5/site-packages/MoinMoin/PageEditor.py
   3 ***************
   4 *** 787,792 ****
   5 --- 787,795 ----
   6               if request.dicts.has_dict(userDictPage):
   7                   variables.update(request.dicts.dict(userDictPage))
   8   
   9 +         if request.dicts.has_dict("WikiDict"):
  10 +             variables.update(request.dicts.dict("WikiDict"))
  11 + 
  12           for name in variables:
  13               text = text.replace('@%s@' % name, variables[name])
  14           return text

global-dictionary.diff


CategoryFeatureRequest CategoryFeaturePatched

MoinMoin: FeatureRequests/GlobalWikiVariableExpansion (last edited 2010-09-21 12:33:16 by ThomasWaldmann)