Lua modules are here: Improving OSM wiki templates

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua modules are here: Improving OSM wiki templates

Yuri Astrakhan-2
Hi everyone.  Thanks to Tom Hughes, we now have Scribunto extension set up on OSM wiki, which allows Lua language in addition to the very slow and unreadable wiki template language.

Documentation:

Benefits:
* Much better performance compared with wiki template language
* Substantially more readable
* Allows greater flexibility with how templates are set up

Migration:
The usual migration is to re-implement complex and often-used templates in Lua (as a Module:* pages), and keep the existing template as a "wrapper" - a one-liner with {{#invoke:mymodulepage|mymodulefunction}}.  This way existing pages do not need to be changed, but get all the performance benefits.

Template info:
Create a "doc" sub-page, e.g.  Module:<my_module>/doc  and put all the documentation there.

Testing:
I would advise to create "unit tests" for the complex templates. The simplest way is to create a   Module:<my_module_page>/doc   page with a table of all possible usages of the module, There is also a good practice page

Once again, thanks Tom for helping with this!

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

Yuri Astrakhan-2
P.S.  If you want to test this new functionality, please use    Module:sandbox/your_wiki_user_name    pages (or a subpage of that, e.g.  Module:sandbox/your_wiki_user_name/my_test_1).  Once the template is ready for usage, you can always rename it to something else.

On Sun, Jul 29, 2018 at 2:57 PM Yuri Astrakhan <[hidden email]> wrote:
Hi everyone.  Thanks to Tom Hughes, we now have Scribunto extension set up on OSM wiki, which allows Lua language in addition to the very slow and unreadable wiki template language.

Documentation:

Benefits:
* Much better performance compared with wiki template language
* Substantially more readable
* Allows greater flexibility with how templates are set up

Migration:
The usual migration is to re-implement complex and often-used templates in Lua (as a Module:* pages), and keep the existing template as a "wrapper" - a one-liner with {{#invoke:mymodulepage|mymodulefunction}}.  This way existing pages do not need to be changed, but get all the performance benefits.

Template info:
Create a "doc" sub-page, e.g.  Module:<my_module>/doc  and put all the documentation there.

Testing:
I would advise to create "unit tests" for the complex templates. The simplest way is to create a   Module:<my_module_page>/doc   page with a table of all possible usages of the module, There is also a good practice page

Once again, thanks Tom for helping with this!

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

Jo-2
In reply to this post by Yuri Astrakhan-2
This is only tangentially related, but I created a Lua module for the wikipedias a few years ago:


It generates an Overpass Query showing all the objects related to the Wikipedia entry via wikidata tags in the OSM data.

Polyglot

Op zo 29 jul. 2018 om 15:01 schreef Yuri Astrakhan <[hidden email]>:
Hi everyone.  Thanks to Tom Hughes, we now have Scribunto extension set up on OSM wiki, which allows Lua language in addition to the very slow and unreadable wiki template language.

Documentation:

Benefits:
* Much better performance compared with wiki template language
* Substantially more readable
* Allows greater flexibility with how templates are set up

Migration:
The usual migration is to re-implement complex and often-used templates in Lua (as a Module:* pages), and keep the existing template as a "wrapper" - a one-liner with {{#invoke:mymodulepage|mymodulefunction}}.  This way existing pages do not need to be changed, but get all the performance benefits.

Template info:
Create a "doc" sub-page, e.g.  Module:<my_module>/doc  and put all the documentation there.

Testing:
I would advise to create "unit tests" for the complex templates. The simplest way is to create a   Module:<my_module_page>/doc   page with a table of all possible usages of the module, There is also a good practice page

Once again, thanks Tom for helping with this!
_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

Yuri Astrakhan-2
Thanks Jo, now you can copy it to OSM wiki if you think it would be useful! :)

On Sun, Jul 29, 2018 at 3:06 PM Jo <[hidden email]> wrote:
This is only tangentially related, but I created a Lua module for the wikipedias a few years ago:


It generates an Overpass Query showing all the objects related to the Wikipedia entry via wikidata tags in the OSM data.

Polyglot

Op zo 29 jul. 2018 om 15:01 schreef Yuri Astrakhan <[hidden email]>:
Hi everyone.  Thanks to Tom Hughes, we now have Scribunto extension set up on OSM wiki, which allows Lua language in addition to the very slow and unreadable wiki template language.

Documentation:

Benefits:
* Much better performance compared with wiki template language
* Substantially more readable
* Allows greater flexibility with how templates are set up

Migration:
The usual migration is to re-implement complex and often-used templates in Lua (as a Module:* pages), and keep the existing template as a "wrapper" - a one-liner with {{#invoke:mymodulepage|mymodulefunction}}.  This way existing pages do not need to be changed, but get all the performance benefits.

Template info:
Create a "doc" sub-page, e.g.  Module:<my_module>/doc  and put all the documentation there.

Testing:
I would advise to create "unit tests" for the complex templates. The simplest way is to create a   Module:<my_module_page>/doc   page with a table of all possible usages of the module, There is also a good practice page

Once again, thanks Tom for helping with this!
_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

Jo-2
I'm afraid it's not useful on our wiki. First of because our pages are not connected to Wikidata (for obvious reasons).

But if people want to have a look at Lua code, or if they want to use it on a Wikipedia to refer back to OSM objects, that's where it could be useful.

Jo

Op zo 29 jul. 2018 om 15:09 schreef Yuri Astrakhan <[hidden email]>:
Thanks Jo, now you can copy it to OSM wiki if you think it would be useful! :)

On Sun, Jul 29, 2018 at 3:06 PM Jo <[hidden email]> wrote:
This is only tangentially related, but I created a Lua module for the wikipedias a few years ago:


It generates an Overpass Query showing all the objects related to the Wikipedia entry via wikidata tags in the OSM data.

Polyglot

Op zo 29 jul. 2018 om 15:01 schreef Yuri Astrakhan <[hidden email]>:
Hi everyone.  Thanks to Tom Hughes, we now have Scribunto extension set up on OSM wiki, which allows Lua language in addition to the very slow and unreadable wiki template language.

Documentation:

Benefits:
* Much better performance compared with wiki template language
* Substantially more readable
* Allows greater flexibility with how templates are set up

Migration:
The usual migration is to re-implement complex and often-used templates in Lua (as a Module:* pages), and keep the existing template as a "wrapper" - a one-liner with {{#invoke:mymodulepage|mymodulefunction}}.  This way existing pages do not need to be changed, but get all the performance benefits.

Template info:
Create a "doc" sub-page, e.g.  Module:<my_module>/doc  and put all the documentation there.

Testing:
I would advise to create "unit tests" for the complex templates. The simplest way is to create a   Module:<my_module_page>/doc   page with a table of all possible usages of the module, There is also a good practice page

Once again, thanks Tom for helping with this!
_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
mmd
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

mmd
In reply to this post by Yuri Astrakhan-2
Am 29.07.2018 um 14:57 schrieb Yuri Astrakhan:
> * Much better performance compared with wiki template language

Sounds great. One of the major pain points on many Wiki pages is the
whole topic around Language / LanguageSwitch templates.

Verdy_p has written a lengthy analysis of the current situation, which
I'm mostly unable to follow as I'm not really familiar with Mediawiki
internals:

https://wiki.openstreetmap.org/wiki/User_talk:Verdy_p#Performance_impact_due_to_translation_templates

Maybe someone more knowledgeable than myself could take a look, if it is
worthwhile throwing in some Lua for better performance in this case, or
maybe trying something different.

Thanks!

--





_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Lua modules are here: Improving OSM wiki templates

Andrew Hain
It would be interesting to know how much of the problem is because of the large number of languages tested, many with no pages on the wiki written in that language.

--
Andrew
From: mmd <[hidden email]>
Sent: 29 July 2018 19:37:04
To: [hidden email]
Subject: Re: [OSM-talk] Lua modules are here: Improving OSM wiki templates
 
Am 29.07.2018 um 14:57 schrieb Yuri Astrakhan:
> * Much better performance compared with wiki template language

Sounds great. One of the major pain points on many Wiki pages is the
whole topic around Language / LanguageSwitch templates.

Verdy_p has written a lengthy analysis of the current situation, which
I'm mostly unable to follow as I'm not really familiar with Mediawiki
internals:

https://wiki.openstreetmap.org/wiki/User_talk:Verdy_p#Performance_impact_due_to_translation_templates

Maybe someone more knowledgeable than myself could take a look, if it is
worthwhile throwing in some Lua for better performance in this case, or
maybe trying something different.

Thanks!

--





_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk

_______________________________________________
talk mailing list
[hidden email]
https://lists.openstreetmap.org/listinfo/talk