Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
Hi Alex, No the book I want to do is still on my computer. That link you looked at is a book that was printed about 20 years ago as a facsimile of one printed in the 17th century. It does happen to be a book that has been massively reused, and it's not even the original! The book is just plates, and the only text on them is in the description section of the files. I don't see the point of having it on Wikisource because you can use it more easily on Commons (and each page can be linked to any language-pedia. I will try to upload the part of the book I mean so you can take a look at my specific problem. It's 3 volumes but there is a section that is particularly problematic. Jane 2013/6/7, Alex Brollo alex.bro...@gmail.com: @ Jane again: I'd better look before, and talk after I see a collection jpg's from scans, not a djvu file or a Index: page into a wikisource project. :-) So I presume that I can't find any pagelist tag. :-) Did you personally scan those pages? Did you scan all the pages of the book (if it's a book...)? Do you know if any complete scan of the book has been published previously (into Internet Archive, Google books, or other digital libraries)? Next time if you scan or take pictures to all the pages of a book, and load all the images to Commons, some willing wikisourcian could mount them into a multipage djvu file and to open an Index: page to proofread it into a wikisource project. 2013/6/7 Alex Brollo alex.bro...@gmail.com Thanks for suggestions I can only promise, I'll think about them. The question by Micru is particularly hard. :-( @ Jane: I've to read your mail again and again; nevertheless a well compiled pagelist tag can really identify into a unique way any page of the book, even if they have no page number, and tl|Pg manages djvu page/book page relationship easily even if book page is identified by something like Figure 1, Figure 2. I'll take a look at your book. Alex 2013/6/7 Jane Darnell jane...@gmail.com I have been wondering the same thing for years. When I upload prints to Wikimedia Commons, I am generally in a hurry and just use the default uploader to get it out there. Weeks or months or sometimes years later I will add in the detailed metadata like the book it was first published in, alternate sources for the print from the one I used, the publisher if that is a different person than the artist, etc. What I don't bother with is page numbers, because this is often unknown and changes from edition to edition. You can get around this problem by naming specific editions held in specific libraries with specific page numbers, which I have done occasionally. Some prints are so well known they go by their own titles, and the Wikimedia Commons artwork template even has a field Original title to deal with this issue. When you go through an index of plates in any older book, generally there are some mistakes, such as blank pages that are indexed because the plate didn't make it to the printer, some plates the printer added that didn't make it into the index, and of course the really confusing one, the prints that a reprinter added that neither the original author nor the original publisher ever saw. One reason I have not spent much time on Wikisource is because I feel I have to decide up front what the structure of the book will be with page numbering (which sometimes does not count the plates), so I need to base this on the original index or original list of chapters. Sometimes a book becomes famous just for one passage, and that passage may not even be indexed in the original version. How do you add these links? On Wikimedia Commons you can keep on adding values to fields, and change the Information template to Artwork to get more fields. You can even add annotations to files and then put links to other files in the annotations, so that through the Global usage property you can see where such prints have been quoted or re-used. How do you do this with books? I would like to see a flexible way to set this up that makes it easy to come back and make corrections or additions to the published information in both indexes and ToC's based on later discovery. This book of prints for example shows a page order based on one edition that was reproduced in facsimile version, but other versions exist with different plates: http://commons.wikimedia.org/wiki/Category:32_afbeeldinge_der_Graven_van_HOLLANDT How do you set up page numbers for this, because there weren't any to start with? Jane 2013/6/7, Andrea Zanni zanni.andre...@gmail.com: On Fri, Jun 7, 2013 at 1:36 AM, David Cuenca dacu...@gmail.com wrote: Automatic creation of page transclusion is nice but also dangerous... too many structures to have an easy solution. What Alex is thinking, if I understand his work correctly, is that when you work on a new book in nsPage, you define what the structure is (his work right
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
On Fri, Jun 7, 2013 at 2:01 PM, billinghurst billinghu...@gmail.com wrote: I don't agree that it should be fully automated by any stretch of the imagination. I can see that it is an option that some may wish to use, but I dislike the limitations, and do not see it working as the only means to use. Well, I think that the bot/Lua/extension/whatever could show to the user a window with the structure of the book as it would be created. The user could change some things, or Cancel the automatic transclusion. I don't know: to me, avoiding the burden of taking care of different namesapces, with diffirent templates needed and strange tags (eg pagelist) should be an aim for us, if we want the layman to understand Wikisource and contribute. I myself can't upload and create a whole book from the scan to the ns0 transclusion without mistakes or forgetting important things. Wikisource *is* difficult, Too much, IMHO. Aubrey ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
On Fri, Jun 7, 2013 at 9:40 AM, Jane Darnell jane...@gmail.com wrote: Sometimes a book becomes famous just for one passage, and that passage may not even be indexed in the original version. How do you add these links? On Wikimedia Commons you can keep on adding values to fields, and change the Information template to Artwork to get more fields. You can even add annotations to files and then put links to other files in the annotations, so that through the Global usage property you can see where such prints have been quoted or re-used. How do you do this with books? I think this is complex and should be addressed with a new vision of what quotes, citations and annotations are, and how to exploit and manage them better. Right now, we don't have the (software) infrastructure to do that. If we could integrate textus or other annotation tool with MediaWiki, probably things could change. Aubrey ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
Strategy 3 is extremely interesting, from the if you are repeating yourself, you are going wrong point of view. Nevertheless such an approach needs a well-designed and complete chapters tree as step one; the best would be that titles of sections/subsections could be wrote one only to avoid any possible mistake. A simple Excel page (or similar) would be probably the simplest way to produce the template code to be seeded into pages containing the start of chapters and ignoring other pages. With very few simple conventions, anything - but pagelist - could be automatized, if a thorough seeding of such templates could be done as proofreading step 1, since a script could add too needed section tags, then build pages tags and fill chapter list into Index page, and all the needed code for ns0 pages/subpages. 2013/6/7 Andrea Zanni zanni.andre...@gmail.com . I wonder if there is a better way to define the logic structure of our book, maybe directly in the Index page. I don't know what would be easier for the user: * define the table of content once for all in the Index page * define the table of content once in the book Toc (there is often one, if not always, when needed) * define the table of content just putting templates thorough the book, as the reader goes through the book. What do you all think? Aubrey ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
First version of a python script which builds a Modulo:Dati page/... parsing Index and produces a running Lua script (first test using it:Indice:Georgiche.djvu producing Modulo:Dati/Georgiche.djvu). This means that Modulo:Dati/... pages could be built and updated both automagically (by an #irc bot) and manually (by javascript, or by a interactive bot). Alex 2013/6/7 Alex Brollo alex.bro...@gmail.com Strategy 3 is extremely interesting, from the if you are repeating yourself, you are going wrong point of view. Nevertheless such an approach needs a well-designed and complete chapters tree as step one; the best would be that titles of sections/subsections could be wrote one only to avoid any possible mistake. A simple Excel page (or similar) would be probably the simplest way to produce the template code to be seeded into pages containing the start of chapters and ignoring other pages. With very few simple conventions, anything - but pagelist - could be automatized, if a thorough seeding of such templates could be done as proofreading step 1, since a script could add too needed section tags, then build pages tags and fill chapter list into Index page, and all the needed code for ns0 pages/subpages. 2013/6/7 Andrea Zanni zanni.andre...@gmail.com . I wonder if there is a better way to define the logic structure of our book, maybe directly in the Index page. I don't know what would be easier for the user: * define the table of content once for all in the Index page * define the table of content once in the book Toc (there is often one, if not always, when needed) * define the table of content just putting templates thorough the book, as the reader goes through the book. What do you all think? Aubrey ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
On Fri, 7 Jun 2013 14:44:06 +0200, Andrea Zanni zanni.andre...@gmail.com wrote: On Fri, Jun 7, 2013 at 2:01 PM, billinghurst billinghu...@gmail.com wrote: I don't agree that it should be fully automated by any stretch of the imagination. I can see that it is an option that some may wish to use, but I dislike the limitations, and do not see it working as the only means to use. Well, I think that the bot/Lua/extension/whatever could show to the user a window with the structure of the book as it would be created. The user could change some things, or Cancel the automatic transclusion. I don't know: to me, avoiding the burden of taking care of different namesapces, with diffirent templates needed and strange tags (eg pagelist) should be an aim for us, if we want the layman to understand Wikisource and contribute. I myself can't upload and create a whole book from the scan to the ns0 transclusion without mistakes or forgetting important things. Wikisource *is* difficult, Too much, IMHO. Aubrey I am not saying that it isn't part of the choice, I am just saying that it should not be enforced. I am explaining choice, not commenting on the development of the proposed tool and its availability. At a point of time, I may use it. Of course you make mistakes, we all do, and they are not just in the pages stuff. I make more mistakes in Page: ns than I do in main. I see mistakes in the published books, including mistakes in ToC. Humans while they make mistakes, also are able to error resolve. English Wikisource has more components in its headers, and is able to adapt its {{header}} components more dynamically. Having the ability to tweak enables presentation to how it suits a work, and its readibility; to this point of time, I find the automated process too restricting. Regards, Billinghurst ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
@Alex: one thing I always would have liked to have is an /all page that would display all the ocr text and that would replace it by proofread text as soon as each page would be created. It would be the equivalent of the text dump by internet archive and it would allow search engines to find text in the books even if they haven't been proofread yet. Automatic creation of page transclusion is nice but also dangerous... too many structures to have an easy solution. It could be easier to have a parser that would read the proofread pages, detect section marks and create pages accordingly. IIRC, Phe did already something like that, perhaps you could port it to Lua? By the way, do you think it would make sense that the Modulo:Dati is generated automatically by the Index: page? Maybe each time that it is saved? Micru On Thu, Jun 6, 2013 at 6:30 PM, Alex Brollo alex.bro...@gmail.com wrote: I found a limit at approx 4000 calls of template|Pg; so I splitted the whole page http://it.wikisource.org/wiki/Annali_del_Principato_ecclesiastico_di_Trento_dal_1022_al_1540/Indice into smaller subpages AZ and now the script runs happily. In the meantime, I'm translating js script which builds Modulo:Dati/ in python, so that Alebot (running into TS willow and listening #it.wikisource) could write/update Modulo:Dati/... page as soon as Index:page has been edited. Index page edits are not so frequent IMHO, they are relatively stable pages. Global number of source edits would not been flooded IMHO by such additive edits of Modulo:Dati subpages. I'm thinking too about loading other useful book-related data which could be uploaded into Modulo:Dati to be used into any nsPage and ns0 page related with rootIndex: page. I'm dreaming about an almost integral automation of ns0 transclusion. But I absolutely need Aubrey's suggestions. :-) Alex 2013/6/5 Alex Brollo alex.bro...@gmail.com I'm testing tl|Pg into a hard case, transcluded page will contain more than 8000 Pg template and Pg module calls; no expensive parser function is added by Lua. This is the page I'm working about: http://it.wikisource.org/wiki/Annali_del_Principato_ecclesiastico_di_Trento_dal_1022_al_1540/Indice Alex 2013/6/3 Alex Brollo alex.bro...@gmail.com Done Lars; I edited Modulo:Pg to keep Template:Pg simpler. Alex 2013/6/3 Alex Brollo alex.bro...@gmail.com Thanks Lars: OK. :-) 2013/6/3 Lars Aronsson l...@aronsson.se On 06/03/2013 12:10 AM, Alex Brollo wrote: Take a look to this page http://it.wikisource.org/** wiki/Pagina:Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvu/583http://it.wikisource.org/wiki/Pagina:Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu/583. As you see, page numbers are simply wrapped into a tl|Pg. No other parameters. Nevertheless, they are transformed into active links do right djvu pages. Now, go here http://it.wikisource.org/**wiki/Manuale_di_economia_** politica_con_una_introduzione_**alla_scienza_sociale/Indice_** dei_nomi_di_autori#pagename583http://it.wikisource.org/wiki/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale/Indice_dei_nomi_di_autori#pagename583 ** where the same page is transcluded in ns0. Page numbers now are active links to the right subpage/chapter. This trick uses: Template:Pg http://it.wikisource.org/** wiki/Template:Pg http://it.wikisource.org/wiki/Template:Pg, Modulo:Pg http://it.wikisource.org/**wiki/Modulo:Pghttp://it.wikisource.org/wiki/Modulo:Pg, and this Modulo:Dati/Manuale http://it.wikisource.org/** wiki/Modulo:Dati/Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvuhttp://it.wikisource.org/wiki/Modulo:Dati/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu; nothing more than this, no javascript and no AJAX, so I presume (I didn't test by now) that links are running too into any html-based export of ns0 pages as server builds them. Excellent! However, on the transcluded page, the link goes only to the chapter URL. It should also add #pag137 or #pagename147, since all page links in the margin of the transcluded chapter are marked like this:... id=pag137span id=pagename147... -- Lars Aronsson (l...@aronsson.se) Project Runeberg - free Nordic literature - http://runeberg.org/ __**_ Wikisource-l mailing list Wikisource-l@lists.wikimedia.**org Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikisource-lhttps://lists.wikimedia.org/mailman/listinfo/wikisource-l ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l -- Etiamsi omnes, ego non ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
I'm testing tl|Pg into a hard case, transcluded page will contain more than 8000 Pg template and Pg module calls; no expensive parser function is added by Lua. This is the page I'm working about: http://it.wikisource.org/wiki/Annali_del_Principato_ecclesiastico_di_Trento_dal_1022_al_1540/Indice Alex 2013/6/3 Alex Brollo alex.bro...@gmail.com Done Lars; I edited Modulo:Pg to keep Template:Pg simpler. Alex 2013/6/3 Alex Brollo alex.bro...@gmail.com Thanks Lars: OK. :-) 2013/6/3 Lars Aronsson l...@aronsson.se On 06/03/2013 12:10 AM, Alex Brollo wrote: Take a look to this page http://it.wikisource.org/** wiki/Pagina:Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvu/583http://it.wikisource.org/wiki/Pagina:Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu/583. As you see, page numbers are simply wrapped into a tl|Pg. No other parameters. Nevertheless, they are transformed into active links do right djvu pages. Now, go here http://it.wikisource.org/**wiki/Manuale_di_economia_** politica_con_una_introduzione_**alla_scienza_sociale/Indice_** dei_nomi_di_autori#pagename583http://it.wikisource.org/wiki/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale/Indice_dei_nomi_di_autori#pagename583 ** where the same page is transcluded in ns0. Page numbers now are active links to the right subpage/chapter. This trick uses: Template:Pg http://it.wikisource.org/** wiki/Template:Pg http://it.wikisource.org/wiki/Template:Pg, Modulo:Pg http://it.wikisource.org/**wiki/Modulo:Pghttp://it.wikisource.org/wiki/Modulo:Pg, and this Modulo:Dati/Manuale http://it.wikisource.org/** wiki/Modulo:Dati/Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvuhttp://it.wikisource.org/wiki/Modulo:Dati/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu; nothing more than this, no javascript and no AJAX, so I presume (I didn't test by now) that links are running too into any html-based export of ns0 pages as server builds them. Excellent! However, on the transcluded page, the link goes only to the chapter URL. It should also add #pag137 or #pagename147, since all page links in the margin of the transcluded chapter are marked like this:... id=pag137span id=pagename147... -- Lars Aronsson (l...@aronsson.se) Project Runeberg - free Nordic literature - http://runeberg.org/ __**_ Wikisource-l mailing list Wikisource-l@lists.wikimedia.**org Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikisource-lhttps://lists.wikimedia.org/mailman/listinfo/wikisource-l ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
I got it :-) Take a look to this pagehttp://it.wikisource.org/wiki/Pagina:Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu/583. As you see, page numbers are simply wrapped into a tl|Pg. No other parameters. Nevertheless, they are transformed into active links do right djvu pages. Now, go herehttp://it.wikisource.org/wiki/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale/Indice_dei_nomi_di_autori#pagename583 where the same page is transcluded in ns0. Page numbers now are active links to the right subpage/chapter. This trick uses: Template:Pg http://it.wikisource.org/wiki/Template:Pg, Modulo:Pg http://it.wikisource.org/wiki/Modulo:Pg, and this Modulo:Dati/Manualehttp://it.wikisource.org/wiki/Modulo:Dati/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu; nothing more than this, no javascript and no AJAX, so I presume (I didn't test by now) that links are running too into any html-based export of ns0 pages as server builds them. Scripts are rough, they don't consider any exception, they are not documented, I tested them on a couple of works only but they show that it can be done. Alex 2013/6/1 Alex Brollo alex.bro...@gmail.com Thank you Thomas. There are two reasons to load structural metadata into a Lua data page, to be imported with mw.loadData(): 1. often the tl|Pg - which reads data page by mw.loadData() and converts a book page number/mark into a running link to djvu page - is called dozens, sometime hundreds of times by a single Page: this happens, i.e., into glossaries, indexes of people, indexes of lemmas; so, it's important IMHO that it's not server expensive; 2. I'm an absolute Lua beginner, and I'm searching for opportunities to test most interesting Lua features. ;-) I'm using javascript to build data Lua data page since I find it comfortable for tests (much more comfortable when coupled with Chrome Shortcut Manager); data pages can be built with a python bot too, but I think that a manual opportunity by javascript should be saved for updates/tests and so on. And it's so exciting to see how code appears into a eyeblink :-) I'm going to expand the data page adding ns0 names of pages and subpages and ranges of pages which they transclude (all the needed data are wrapped into Index: wiki code in it.source); so I hope that tl|Pg link will point djvu page in nsIndex and nsPage, and will point to ns0 page/subpage when transcluded into ns0. Alex 2013/6/1 Thomas PT thoma...@hotmail.fr Hi! It looks very good! In my opinion the template will be more interesting (but also more heavy) if you work directly with the Index page by loading its content (local page = mw.title.new( 'Index:XXX.djvu' ); local text = page:getContent()) and parsing the pagelist tag that will give you the displayed number - number in the djvu conversion. Thomas -- Date: Fri, 31 May 2013 16:10:47 +0200 From: alex.bro...@gmail.com To: wikisource-l@lists.wikimedia.org Subject: [Wikisource-l] Playing with Lua, javascript and pagelist tag 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 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
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
On 06/03/2013 12:10 AM, Alex Brollo wrote: Take a look to this page http://it.wikisource.org/wiki/Pagina:Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu/583. As you see, page numbers are simply wrapped into a tl|Pg. No other parameters. Nevertheless, they are transformed into active links do right djvu pages. Now, go here http://it.wikisource.org/wiki/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale/Indice_dei_nomi_di_autori#pagename583 where the same page is transcluded in ns0. Page numbers now are active links to the right subpage/chapter. This trick uses: Template:Pg http://it.wikisource.org/wiki/Template:Pg, Modulo:Pg http://it.wikisource.org/wiki/Modulo:Pg, and this Modulo:Dati/Manuale http://it.wikisource.org/wiki/Modulo:Dati/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu; nothing more than this, no javascript and no AJAX, so I presume (I didn't test by now) that links are running too into any html-based export of ns0 pages as server builds them. Excellent! However, on the transcluded page, the link goes only to the chapter URL. It should also add #pag137 or #pagename147, since all page links in the margin of the transcluded chapter are marked like this:... id=pag137span id=pagename147... -- Lars Aronsson (l...@aronsson.se) Project Runeberg - free Nordic literature - http://runeberg.org/ ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
Thanks Lars: OK. :-) 2013/6/3 Lars Aronsson l...@aronsson.se On 06/03/2013 12:10 AM, Alex Brollo wrote: Take a look to this page http://it.wikisource.org/** wiki/Pagina:Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvu/583http://it.wikisource.org/wiki/Pagina:Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu/583. As you see, page numbers are simply wrapped into a tl|Pg. No other parameters. Nevertheless, they are transformed into active links do right djvu pages. Now, go here http://it.wikisource.org/**wiki/Manuale_di_economia_** politica_con_una_introduzione_**alla_scienza_sociale/Indice_** dei_nomi_di_autori#pagename583http://it.wikisource.org/wiki/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale/Indice_dei_nomi_di_autori#pagename583 ** where the same page is transcluded in ns0. Page numbers now are active links to the right subpage/chapter. This trick uses: Template:Pg http://it.wikisource.org/**wiki/Template:Pghttp://it.wikisource.org/wiki/Template:Pg, Modulo:Pg http://it.wikisource.org/**wiki/Modulo:Pghttp://it.wikisource.org/wiki/Modulo:Pg, and this Modulo:Dati/Manuale http://it.wikisource.org/** wiki/Modulo:Dati/Manuale_di_**economia_politica_con_una_** introduzione_alla_scienza_**sociale.djvuhttp://it.wikisource.org/wiki/Modulo:Dati/Manuale_di_economia_politica_con_una_introduzione_alla_scienza_sociale.djvu; nothing more than this, no javascript and no AJAX, so I presume (I didn't test by now) that links are running too into any html-based export of ns0 pages as server builds them. Excellent! However, on the transcluded page, the link goes only to the chapter URL. It should also add #pag137 or #pagename147, since all page links in the margin of the transcluded chapter are marked like this:... id=pag137span id=pagename147... -- Lars Aronsson (l...@aronsson.se) Project Runeberg - free Nordic literature - http://runeberg.org/ __**_ Wikisource-l mailing list Wikisource-l@lists.wikimedia.**org Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/**mailman/listinfo/wikisource-lhttps://lists.wikimedia.org/mailman/listinfo/wikisource-l ___ Wikisource-l mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
Re: [Wikisource-l] Playing with Lua, javascript and pagelist tag
Hi! It looks very good! In my opinion the template will be more interesting (but also more heavy) if you work directly with the Index page by loading its content (local page = mw.title.new( 'Index:XXX.djvu' ); local text = page:getContent()) and parsing the pagelist tag that will give you the displayed number - number in the djvu conversion. Thomas Date: Fri, 31 May 2013 16:10:47 +0200 From: alex.bro...@gmail.com To: wikisource-l@lists.wikimedia.org Subject: [Wikisource-l] Playing with Lua, javascript and pagelist tag 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 mailing list Wikisource-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikisource-l
[Wikisource-l] Playing with Lua, javascript and pagelist tag
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