Last active
March 12, 2020 20:16
-
-
Save halfak/d6efaa43376a6b190b0dbeb15a906dd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mwparsefromhell | |
example = """ | |
{{foo bar baz}} | |
{{I am a random template|7|Foo bar|8}} | |
{{Marca de projeto|3|Biografias|4|Políticos|4|Brasil|3|WP Offline|2|bot=4/20111127|rev=20170714}}""" | |
templates = list(mwparserfromhell.parse(example_text).filter_templates()) | |
def from_template(template): | |
"Returns an iterator of projects and classes from a template if applicable" | |
pass | |
for template in templates: | |
print(list(from_template(template))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[] | |
[] | |
[("Biographias", "4"), ("Políticos", "4"), ("Brasil", "3"), ("WP Offline", "2")] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment