Thanks for the responses. I was hoping there would be some php function in MW core or some API feature that I could use like from [0]. I'm having a hard time understanding how I would use either of these suggestions.
[0] https://doc.wikimedia.org/mediawiki-core/master/php/ On Wed, Aug 9, 2017 at 3:02 PM, Gergo Tisza <[email protected]> wrote: > mwparserfromhell ( https://github.com/earwig/mwparserfromhell ) is also > pretty good at this kind of thing. > > On Wed, Aug 9, 2017 at 6:30 PM, Subramanya Sastry <[email protected]> > wrote: > > > Take a look at Parsoid's output spec and the Parsoid API (as exposed > > through the REST API). > > > > See https://www.mediawiki.org/wiki/Specs/HTML/1.4.0#Template_markup and > > https://en.wikipedia.org/api/rest_v1/#!/Transforms/post_tran > > sform_html_to_wikitext_title_revision > > > > So, you fetch the HTML, edit data-mw blob, and save it back. > > > > Subbu. > > > > > > > > On 08/09/2017 10:22 AM, Daren Welsh wrote: > > > >> I'm working on a server-side script that will periodically revise wiki > >> pages that all use the same template. Is there a function I can use that > >> will parse a page and then find and replace template arguments with > values > >> I determine within my script? > >> > >> For example, let's say I have Template:Beer like the following: > >> > >> {{Beer > >> |Name= > >> |Brewery= > >> |Style= > >> |ABV= > >> |IBU= > >> }} > >> > >> So if I had a page Rocket Fuel: > >> > >> {{Beer > >> |Name=Rocket Fuel > >> |Brewery=8th Wonder > >> |Style=Vietnamese Coffee Porter > >> |ABV=4.6 > >> |IBU=18 > >> }} > >> > >> Let's say my script "discovered" an error in one of the arguments and > >> needed to update the page. For example, let's say the IBU was actually > 28. > >> Is there a function that will find and replace the value for IBU in the > >> page? > >> > >> I'm currently using regex, but I'm wondering if there's a more > trustworthy > >> method. > >> > >> Thanks, > >> > >> Daren > >> _______________________________________________ > >> Wikitech-l mailing list > >> [email protected] > >> https://lists.wikimedia.org/mailman/listinfo/wikitech-l > >> > > > > > > _______________________________________________ > > Wikitech-l mailing list > > [email protected] > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > > > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > -- __________________ http://enterprisemediawiki.org http://mixcloud.com/darenwelsh _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
