https://bugzilla.wikimedia.org/show_bug.cgi?id=42126
Web browser: ---
Bug #: 42126
Summary: Fake perfect template expansion by calling into the
PHP API
Product: Parsoid
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: JS/token-stream transforms
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
Idea: Use the expandtemplates API to get the preprocessed template source, so
that we can fake perfect template expansion even with some parser functions
unimplemented.
>From Roan's mail:
Per last Friday's discussion, the API has a module that performs
template expansion (preprocessing, technically). This recursively
expands pretty much everything in curly braces, but it doesn't parse
other things and it doesn't run Tidy. I'm not exactly clear on how it
treats double-underscore magic words (like __NOTOC__) or curly brace
magic word (like {{DEFAULTSORT}}); I do know that "variable magic
words" (really parameterless core parser functions) like {{PAGENAME}}
get expanded.
Comments are also stripped, unless this is overridden with
&includecomments=1. The API module also takes a title parameter so it
can expand things like {{PAGENAME}} correctly.
Examples (with &format=phpfm for readability, in practice you'd want
to use &format=json):
Navbox templates on the Winston Churchill article:
https://en.wikipedia.org/w/api.php?action=expandtemplates&text={{Churchill}}%0A{{UKPrimeMinisters}}%0A{{Chancellor%20of%20the%20Exchequer}}%0A{{HomeSecretary}}%0A{{Secretary%20of%20State%20for%20Defence}}%0A{{Presidents%20of%20the%20Board%20of%20Trade}}%0A{{Leader%20of%20the%20House%20of%20Commons}}%0A{{Minister%20of%20Munitions}}%0A{{Fathers%20of%20the%20House}}%0A{{UK%20Conservative%20Party}}%0A{{Churchill%20War%20Ministry}}%0A{{Churchill%20Caretaker%20Ministry}}%0A{{Third%20Churchill%20Ministry}}%0A{{Chamberlain%20War%20Ministry}}%0A{{Cold%20War}}%0A{{Cold%20War%20figures}}%0A{{Charlemagne%20Prize%20recipients}}%0A{{Nobel%20Prize%20in%20Literature%20Laureates%201951-1975}}%0A{{Time%20Persons%20of%20the%20Year|27%E2%80%9350}}&title=Winston_Churchill&format=phpfm
Succession boxes on the Churchill article:
https://en.wikipedia.org/w/api.php?action=expandtemplates&text={{S-start}}
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l