Module:NavboxGenerator/doc: Difference between revisionsGive feedback
init |
m →=eeded changes: typo in section name |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Not finished. | Not finished. | ||
=Overview= | |||
Create's a navbox from a json file for input where keys are a title div container, and value <code>"Display"</code> is the display text. Each title div container gets smaller and smaller the further it is in the json. | Create's a navbox from a json file for input where keys are a title div container, and value <code>"Display"</code> is the display text. Each title div container gets smaller and smaller the further it is in the json. | ||
==Example== | =Parameters= | ||
Within each level of the json: | |||
* '''<key>''' - Title to display in the div/container/box. Can wrap it in <code><nowiki><span style="mystyle">key</span></nowiki></code> for styling it. | |||
* '''Style''' - Style for the div | |||
* '''Display''' - Text to display below the div | |||
* '''<Any other value>''' - Recursively calls for the contained layer, with '''<Any other value>''' as the new '''<key>''' | |||
=Examples= | |||
For understanding the input syntax, it is recommended to view the Simple Example first. | |||
==Simple Example== | |||
The input can be seen at [[Data:ItemNavboxSample.json]] | |||
<code><nowiki>{{#invoke:NavboxGenerator|createNavbox|Data:ItemNavboxSample.json}}</nowiki></code> | |||
Outputs | |||
{{#invoke:NavboxGenerator|createNavbox|Data:ItemNavboxSample.json}} | |||
==Styled Example== | |||
The input can be seen at [[Data:ItemNavbox.json]] | The input can be seen at [[Data:ItemNavbox.json]] | ||
| Line 14: | Line 33: | ||
=Needed changes= | |||
1. Style/Formatting made prettier | 1. Style/Formatting made prettier | ||
2. A way to have the json iterated in order; for some reason mw.loadJsonData doesn't load the keys in order they appear. | 2. A way to have the json iterated in order; for some reason mw.loadJsonData doesn't load the keys in order they appear. | ||
Latest revision as of 21:13, 25 October 2024
Not finished.
Overview
[edit source]Create's a navbox from a json file for input where keys are a title div container, and value "Display" is the display text. Each title div container gets smaller and smaller the further it is in the json.
Parameters
[edit source]Within each level of the json:
- <key> - Title to display in the div/container/box. Can wrap it in
<span style="mystyle">key</span>for styling it. - Style - Style for the div
- Display - Text to display below the div
- <Any other value> - Recursively calls for the contained layer, with <Any other value> as the new <key>
Examples
[edit source]For understanding the input syntax, it is recommended to view the Simple Example first.
Simple Example
[edit source]The input can be seen at Data:ItemNavboxSample.json
{{#invoke:NavboxGenerator|createNavbox|Data:ItemNavboxSample.json}}
Outputs
Lua error: bad argument #1 to 'mw.loadJsonData' ('Data:ItemNavboxSample.json' is not a valid JSON page).
Styled Example
[edit source]The input can be seen at Data:ItemNavbox.json
{{#invoke:NavboxGenerator|createNavbox|Data:ItemNavbox.json}}
Outputs
Lua error: bad argument #1 to 'mw.loadJsonData' ('Data:ItemNavbox.json' is not a valid JSON page).
Needed changes
[edit source]1. Style/Formatting made prettier 2. A way to have the json iterated in order; for some reason mw.loadJsonData doesn't load the keys in order they appear.
This is not used on any pages currently.