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 <ssas...@wikimedia.org>
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
>> Wikitech-l@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>>
>
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to