Module:Territories/data/doc: Difference between revisions
Jump to navigation
Jump to search
create |
(No difference)
|
Latest revision as of 02:00, 8 September 2025
This page contains the documentation for Module:Territories/data. It includes information about the module, such as usage and categories, and is not displayed when using the module itself.
This is a data module to be used with mw.loadData.
To do: write script to generate since there are so many, didn't realize when starting.
How to generate
- Edit the module data page and delete everything except the comment at the top and the word
returnfollowed by a space. - Go to the API v2 page and have a Public access key ready.
- Click the "Try it out" button. For ids, select nothing (
--). The remaining fields need to be blank. Paste in your key and Execute. - Click the copy button in the response box (not the example below it) and paste into the edit box. Delete the line at the top that starts with "territory".
- At the bottom, in the
_metadataobject, on the line that says "next", make a note of the value afteroffset=. - Delete the whole metadata object as well as the line above it (
],), then type a comma at the end of the previous line so it looks like this: (},) and press Enter to create a new line. - On the API page, enter the offset value into the offset field and Execute again.
- This time, only copy everything starting below the line at the top that starts with "territory" (so the single
{and not the space before it), down to but not including the line that starts with "_metadata". Also do not include the line above it (],). - Paste into the edit box on a new line after the comma you added.
- Repeat the set of five steps before this one until the "next" line in the metadata does not contain a URL (the offset will be around 4000).
- The only line following the last set of data should be a single closing brace (
}) with no indent. - Copy the entire contents of the edit box into a text editor and make the following plaintext replacements:
(two spaces) ->\t(tab character - how to input depends on editor),[->{,]->}, and regular expression replacement:"(territory|id|sector|size|density|slots|respect|coordinates|x|y|neighbors)":->$1 =, then unindent everything by one level. - Update the date in the comment at the top and save. Keep a backup copy in your text editor in case it fails.