Difference between revisions of "Template:Lua Functions/Updating"

From The Battle for Wesnoth Wiki
(Created page with "Reference how this page was made. For each relevant LuaAPI page run javascript <syntaxhighlight lang='js'> [...document.querySelectorAll('.toclevel-2 .toctext')].map(e => e.i...")
(No difference)

Revision as of 18:51, 18 April 2024

Reference how this page was made.

For each relevant LuaAPI page run javascript

[...document.querySelectorAll('.toclevel-2 .toctext')].map(e => e.innerText).filter(s => s.startsWith('wesnoth') || s.startsWith('wml') || s.startsWith('gui') || s.startsWith('location_set') || s.startsWith('functional') || s.startsWith('stringx') || s.startsWith('mathx') || s.startsWith('filesystem') || s.startsWith('ai') || s.startsWith('utils') || s.startsWith('unit_test')) + " @ " + document.location

Put output to separate lines of data.txt and run python

with open ("data.txt") as f:
    for line in f:
        line = line.strip().strip("'")
        methods, url = line.split(" @ ")
        url = url.removeprefix("https://wiki.wesnoth.org/")
        for method in methods.split(","):
            print("[[{}#{}|{}]]<br>".format(url, method, method))