[Wikisource-l] Playing with Lua, javascript and pagelist tag

2013-05-31 Thread Alex Brollo
I'm testing a template [:it:s:Template:Pg]] (calling a Lua module) that
fastly converts book page numbers, passed as the unique parameter to the
template,  into links to right djvu pages, without any need to add delta
parameters and linking any format for page number (arabic, roman, other...)
since page numbers are seen as strings.

The Lua script reads a data page, containing tables for conversion book
page-djvu page and reverse, using mw.loadData() function for max
efficiency (often there are dozens, sometimes hundreds of links to pages
into a single book page; ity happens into analytical indexes, glossaries
and so on).

The Lua data page is written in a eyeblink by a js script, which reads and
parses html of Index: page, produced by pagelist tag; so it's very
comfortable to fill such data page and to update it, if pagelist parameters
are updated.

Is this beginner's Lua exercise someway interesting/inspiring  in your
opinion?

Alex brollo
___
Wikisource-l mailing list
Wikisource-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikisource-l


[Wikisource-l] Centralized Lua modules for Wikisource (OPW mentor needed)

2013-05-31 Thread David Cuenca
Hi all,

After a talk with Brad Jorsch during the Hackathon (thanks again Brad for
your patience), it became clear to me that Lua modules can be localized
either by using system messages or by getting the project language code
(mw.getContentLanguage().getCode()) and then switching the message. This
second option is less integrated with the translation system, but can serve
as intermediate step to get things running.

For Wikisource it would be nice to have a central repository (sitting on
wikisource.org) of localized Lua modules and associated templates. The
documentation could be translated using Extension:Translate. These modules,
templates and associated documentation would be then synchronized with all
the language wikisources that subscribe to an opt-in list. Users would be
then advised to modify the central module, thus all language versions would
benefit of the improvements. This could be the first experiment of having a
centralized repository of modules.

What do you think of this? Would be anyone available to mentor an Outreach
Program for Women project?

Thanks,
David Cuenca --Micru
___
Wikisource-l mailing list
Wikisource-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikisource-l


Re: [Wikisource-l] Centralized Lua modules for Wikisource (OPW mentor needed)

2013-05-31 Thread Alex Brollo
I agree fully Micru.
Obviously, my dream is something much simpler and clear-cut: a unique
wikisource for all languages, since an unique project for any textual media
is needed IMHO just as a common project for any non-textual media is
running: Commons; and a common project for data now exists: Wikidata.

And now, let's go to explore Lua a little bit more I presume, that
mw.loaderData() can  read a table of Lua functions too, if I understand Lua
table features. So, shared modules could perhaps be hosted into one data
module only. Let's try 

Alex




2013/5/31 David Cuenca dacu...@gmail.com

 Hi all,

 After a talk with Brad Jorsch during the Hackathon (thanks again Brad for
 your patience), it became clear to me that Lua modules can be localized
 either by using system messages or by getting the project language code
 (mw.getContentLanguage().getCode()) and then switching the message. This
 second option is less integrated with the translation system, but can serve
 as intermediate step to get things running.

 For Wikisource it would be nice to have a central repository (sitting on
 wikisource.org) of localized Lua modules and associated templates. The
 documentation could be translated using Extension:Translate. These modules,
 templates and associated documentation would be then synchronized with all
 the language wikisources that subscribe to an opt-in list. Users would be
 then advised to modify the central module, thus all language versions would
 benefit of the improvements. This could be the first experiment of having a
 centralized repository of modules.

 What do you think of this? Would be anyone available to mentor an Outreach
 Program for Women project?

 Thanks,
 David Cuenca --Micru

 ___
 Wikisource-l mailing list
 Wikisource-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikisource-l


___
Wikisource-l mailing list
Wikisource-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikisource-l