Skip to content

possible to resolve macros in infobox? #154

@boompig

Description

@boompig

When running

page = wptools.page(title)
d = page.get_parse()
pprint(d.data['infobox'])

many fields include the Wikipedia macros used to generate those values. This can be useful, but it also means re-implementing the Wikipedia macros. Is there any way to have these resolved in the output?

Here is an example:

title = 'Scott Aitchison'
page = wptools.page(title)
d = page.get_parse()
pprint(d.data['infobox'])

output:

{'name': 'Scott Aitchison',
 'honorific-suffix': '{{post-nominals|country|=|CAN|MP|size|=|100%}}',
 'image': 'Scott Aitchison (cropped).jpg',
 'caption': 'Aitchison in 2014',
 'imagesize': '200px',
 'riding': '[[Parry Sound—Muskoka]]',
 'parliament': 'Canadian',
 'term_start': 'October 21, 2019',
 'predecessor': '[[Tony Clement]]',
 'birth_date': '{{circa|1973}}',
 'birth_place': '[[Huntsville, Ontario]], Canada',
 'party': '[[Conservative Party of Canada]]'}

So for example for the birth_date the return value is a macro that requires the user to parse it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions