Include macro with variable interpolation

Gordon Messmer <[email protected]>
Newsgroups gmane.comp.web.wiki.moin.general
Message-ID <[email protected]>
Use case: I want to publish customized documentation to users that I 
support.  The pages will be largely identical with small items such as 
hostnames that are specific to the different users.  I could do this 
with templates, but I also want to avoid keeping each document in sync 
manually when I need to update the documentation.

I've written two new macros and one action that build on top of the 
existing GetVal macro to accomplish this.

The first macro:
   <<IncludeWithVals(template, vardict)>>
saves the value given in "vardict" in the request object.  This value 
should name a page formatted as a wiki dict to provide values which will 
be referenced in the page named by "template".  If the query includes 
the key "edit" (as in /url?edit), the template will be surrounded by 
<form> tags and a submit button will be included at the end.

The second macro:
   <<IncludeVal(key)>>
is used in the template.  It will load the value named by "key" from the 
wiki dict referenced in the IncludeWithVals macro that included this 
page.  If the query includes the key "edit"), the values will be printed 
as form input items rather than text.

The action is referenced by the form printed by <<IncludeWithVals>>.  It 
will load all of the values present in the wiki dict named by "vardict", 
replace any values which are present in the form input, and save the 
results.  Any content of the wiki dict which is not part of the dict 
itself will be lost.

I'll publish these on the macro market shortly, but wanted to get input 
from users before I do.  I'll try to fix any flaws that exist in the 
macros before I upload them.

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912

_______________________________________________
Moin-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/moin-user
IncludeWithVals.tar.gz (application/x-gzip, 1.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.