#2 Page.RemoveTemplateParameter

open-accepted
nobody
None
5
2012-07-20
2012-07-20
Lsjjsllsjjsl
No

New method for Page class that removes a parameter from a template in a wikipage. It is modeled on SetTemplateParameter and reuses much of the same code, but instead of setting a new value for a parameter, the parameter is removed from the page.
Parameters:
templateTitle: template in which to remove a parameter
templateParameter: the parameter to be removed
firstTemplateOnly: if true, only first instance of template, if false all.

If the template or parameter doesn't exist, no action is taken.

Discussion

  • Lsjjsllsjjsl
    Lsjjsllsjjsl
    2012-07-20

    C# source, to be inserted in DotNetWikiBot.cs

     
  • CodeDriller
    CodeDriller
    2012-07-20

    • status: open --> open-accepted
     
  • CodeDriller
    CodeDriller
    2012-07-20

    Thank you. That function can be very useful.

    I have one question. Why did you change
    site.FormatTemplate(templateTitle, parameters, template);
    for
    site.FormatTemplate(templateTitle, parameters, false, false, 0);
    ?

     
  • Lsjjsllsjjsl
    Lsjjsllsjjsl
    2012-07-20

    The FormatTemplate change was for my own lazy reasons, I wanted to reformat the templates in the same run. Then I forgot to change it back before submitting it here. Better change it back to the original form site.FormatTemplate(templateTitle, parameters, template) before any general release. Should have no effect on the main function of this Method.