[OSM-talk] Lua modules are here: Improving OSM wiki templates

Jo winfixit at gmail.com
Sun Jul 29 13:06:37 UTC 2018


This is only tangentially related, but I created a Lua module for the
wikipedias a few years ago:

https://en.wikipedia.org/wiki/Module:OSM

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 <yuriastrakhan at gmail.com
>:

> 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:
> * https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual
> * https://en.wikipedia.org/wiki/Wikipedia:Lua
>
> 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
> https://en.wikipedia.org/wiki/Wikipedia:Lua#Unit_testing
>
> Once again, thanks Tom for helping with this!
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20180729/175abea1/attachment.html>


More information about the talk mailing list