Χρήστης:Sarri.greek/Learn Lua and wikitext
Sarri.greek • συζήτηση - help:βοήθεια - εργασίες - Lua.wikitext - PAWS - ref@en.wikt - ετυμολογία - Μοντέλα σελίδων - Αρχείο πρωτολογισμών - Λέξεις που δεν υπάρχουν - είπαν - ja:Ιαπωνικά | lab:πρόχειρο - tAr - t4.t5 - mS.tS - menu |
Category:Learn Lua and wikitext
User:Sarri.greek/Learn Lua and wikitext
For wiktionaries: When there is no programmer around... Easy copy-paste.
Learn Lua/Scribunto for modules. As simple as possible.
Or, learn how to translate wikitext for templates to → Lua for modules.
Little applications for people who have no previous computer skills -like me-, except a little bit of HTML, focusing on wiktionary tasks. ‑‑Sarri.greek ♫ | 2020.09.13.
- Lua: The programming language used by Scribunto.
- lua means "moon" in Portoguese.
- Scribunto: An extension of MediaWiki software allowing scripts written in Lua to be used in wiki pages.
- scribunto means "let them write!" in Latin.
- wikitext: HTML, but easier. MediaWiki's markup language.
Trials
- Trials for Lua can be tested at Module:test and the correpsonding Template:test which calls the module, always function main.
- Trials for wikitext can be tested at Template:test2
ContentsΕπεξεργασία
First things first:
- View blue links in Lua and its comments. (instructions in greek)
- How to name templates and modules:
- prefer latin alphabet, no dicrictics, try using the same or similar title with your sister projects
- avoid empty spaces and underscores
- never never use colon : in the name. It ruins everything.
Lua & wikitextΕπεξεργασία
- Every page contains a Lua module and its wikitext equivalent
* 00. Structure of a template, of a module | ||
* 01. The first command: Hello world! - what is export? | Template:learn-01 | Module:learn-01 |
* 02. Numbered parameters: My name is... wikitext: Pipe or no pipe? | Template:learn-02 | Module:learn-02 |
* 03. Named parameters. | Template:learn-03 | Module:learn-03 |
* 04. if | Template:learn-04 | Module:learn-04 |
* 05. nested if - many ifs - parameter variations | Template:learn-05 | Module:learn-05 |
* 06. switch | Template:learn-06 | Module:learn-06 |
* 07. ifeq By the way: what is the difference between <br> & <br /> ?
|
Template:learn-07 | Module:learn-07 |
* 08. tables | Template:learn-08 | Module:learn-08 |
* 09. one template calls another | Template:learn-09 | Module:learn-09 |
* 10. Goodbye wikitext? Not really. |
LuaΕπεξεργασία
- under constructionnnnnnnnnnn
How toΕπεξεργασία
* title | - handle the title page. split in parts. find expressions. | Module:learn-title1 / Module:learn-title2 |
* data & alias |
- call a word from an array, 1st method | Module:learn-data1 |
- call a word from an array, 2nd method | Module:learn-data2 | |
- call a word from a dictionary Style 1 | Module:learn-data3 | |
- call a word from a dictionary Style 2 | Module:learn-data4 | |
- get a keyword from another keyword from a /datapage dictionary Style 1 | Module:learn-data5 | |
- get a keyword from another keyword from a /datapage dictionary Style 2 | Module:learn-data6 |
TheoryΕπεξεργασία
- scope global & local? https://developer.roblox.com/en-us/articles/Scope
- nil & empty & wrong
- error & mw.addWarning
- function what?
function(), function(frame), function(this, that)
- return how?
output =, frame:preprocess
- invoke directly, create Template, call within a module
- Careful where you place it
- Apply yout function to pagename or to another lemma
- How to call languages
- require another Module's help - require or mw.loadData ?
- How not to repeat the same block in many functions
- Do not use. Words preserved as Lua commands. Escape characters.
- Find or substitute parts of a string
(string,1,1)
Make capital letters. - Substitute one thing with another -
for i, j in pairs ... do
- Sorting: for various languages
- It drives me crazy...
What a wiktionary needsΕπεξεργασία
- names and data for languages: the ISO code, the name and how to call/use them - make language-Sections in a lemma
- link-to-a-language, t(ranslation)link
- codes which usually create categories
- for sections for the page's layout (e.g. pronunciation, partofspeech, reference)
- for topic-labels (e.g. education, economy, zoology)
- for style-labels (e.g. dated, offensive)
- inflection tables
- the parameters
- the table
- the categories created by them
- the functions for the actual inflections
- little tips for utility functions to use here and there
Optionally, provision for more:
- names and data for scripts, if automatic transliterations are desired
- data for pronunciation and automatic International Phonetic Alphabet transcriptions
- auto cat for categories (at least, for some of them)
Plus
- Need to record and upload audio pronunciations at commons? Here is audio help example
- Need to upload images at commons? I do not know how to do it!
- Need to do repetitive changes and you know nothing about bots? Here is a little PAWS help instead.
If you are a lonely administrator, if your language has too many special needs, here are some good examples from all wiktionaries:
- https://la.wiktionary.org/wiki/Categoria:Programmata
- https://la.wiktionary.org/wiki/Module:sectionibus/data
- https://la.wiktionary.org/wiki/Categoria:Programmata_linguarum
What a wikipedia needsΕπεξεργασία
.... to be written by a wikipedian
Common to all wikiprojectsΕπεξεργασία
- utitlity, general Template and Modules, like:
- .......
SourcesΕπεξεργασία
For wikitext
- https://en.wiktionary.org/wiki/Help:Index#template
- Βοήθεια:Πρότυπα Help:Templates (in Greek)
For Lua
- https://en.wiktionary.org/wiki/Help:Index#scribunto
- https://en.wikibooks.org/wiki/Scribunto:_An_Introduction/Glossary
- Βοήθεια:Lua#Μαθήματα Help:Lua#Lessons (links)
- https://en.wikibooks.org/wiki/Scribunto:_An_Introduction
- https://www.mediawiki.org/wiki/Manual:Coding_conventions/Lua (how to write neatly)
- https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual (everything needed is here)
wikitext - Lua
- https://en.wikibooks.org/wiki/Scribunto:_An_Introduction/When_to_convert_a_template
- https://en.wikipedia.org/wiki/Wikipedia:Comparable_Lua_functions_to_wikitext
- https://en.wiktionary.org/wiki/Wiktionary:Scribunto/Converting_templates
Examples by expertsΕπεξεργασία