D F | 16 Aug 18:32 2015
Picon

Re: Wikitext-l Digest, Vol 53, Issue 3

What I mean is that the whole string

  ... {{inner1|...|???}} ... {{inner2|...|???}} ... {{inner17|...|???}} ... {{inner18|...|???}} ...

is passed as the first argument of

  {{outer| ... |language}}

instead of being hard coded in the template {{outer| ... |language}} since the first argument is not known in advance.

Thanks,

Daniel Forgues

On Sun, Aug 16, 2015 at 5:01 AM, <wikitext-l-request <at> lists.wikimedia.org> wrote:
Send Wikitext-l mailing list submissions to
        wikitext-l <at> lists.wikimedia.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.wikimedia.org/mailman/listinfo/wikitext-l
or, via email, send a message with subject or body 'help' to
        wikitext-l-request <at> lists.wikimedia.org

You can reach the person managing the list at
        wikitext-l-owner <at> lists.wikimedia.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Wikitext-l digest..."


Today's Topics:

   1. Re: Outer templates modifying inner templates' parameters in
      nested template calls? (Arlo Breault)


----------------------------------------------------------------------

Message: 1
Date: Sat, 15 Aug 2015 15:30:56 -0700
From: Arlo Breault <abreault <at> wikimedia.org>
To: Parsoid and wikitext discussion <wikitext-l <at> lists.wikimedia.org>
Subject: Re: [Wikitext-l] Outer templates modifying inner templates'
        parameters in nested template calls?
Message-ID: <A99A5E66440D49C78EF7756667638071 <at> wikimedia.org>
Content-Type: text/plain; charset="utf-8"

On Monday, July 13, 2015 at 9:02 PM, D F wrote:
> Is there a way, or some hack, for an outer template to modify some inner templates' parameters in nested template calls? For example:
>
> {{outer| ... {{inner1|...|???}} ... {{inner2|...|???}} ... {{inner17|...|???}} ... {{inner18|...|???}} ... |language}}
>
> so that
>
> * if language = english, then ??? is replaced with en (before the inner templates are called)
> * if language = spanish, then ??? is replaced with sp (before the inner templates are called)
>
> This way, we only have to change the language parameter of the outer template, and all the inner templates are called with the appropriate parameter. (Instead of manually modifying the numerous inner templates.)
>
> I know that inner templates are called before outer ones. (This would mean that the inner templates would execute with the ??? parameter, returning something that would allow the outer template to modify the ???, then the outer template would call back the inner templates with the modified parameter, before the outer template finally does it's own thing with the result. I don't know whether or not this could be hacked.)
>
Maybe I’m misunderstanding but you can pass template
parameters as arguments to nested templates. As in,

/Page
{{aha|output=hello}}

/Tempate:aha
{{echo|{{{output}}}}}

/Template:echo
{{{1}}}

The content of page will be “hello”. I used a named parameter
so that the example is clearer; that isn’t necessary.

Hope it helps.


>
> Thanks
>
> Daniel Forgues
> _______________________________________________
> Wikitext-l mailing list
> Wikitext-l <at> lists.wikimedia.org (mailto:Wikitext-l <at> lists.wikimedia.org)
> https://lists.wikimedia.org/mailman/listinfo/wikitext-l






------------------------------

_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l


End of Wikitext-l Digest, Vol 53, Issue 3
*****************************************

_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Joe P. | 14 Aug 09:24 2015
Picon

[Parsoid] Installation problem

Greetings,

I am preparing VE for my Mediawiki. However, I failed to install Parsoid as the pre-requisite. My system is Ubuntu 14.04 LTS and MW 1.24.2. Following the guide https://www.mediawiki.org/wiki/Parsoid/Setup, but got these errors:

sudo apt-key advanced --keyserver keys.gnupg.net --recv-keys 5C927F7C
yields
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.hzJuISWZKb --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keys.gnupg.net --recv-keys 5C927F7C
gpg: requesting key 5C927F7C from hkp server keys.gnupg.net
?: keys.gnupg.net: Network is unreachable
gpgkeys: HTTP fetch error 7: couldn't connect: Network is unreachable
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

sudo apt-get update after adding the deb config
yields
W: Some index files failed to download. They have been ignored, or old ones used instead.

sudo apt-get install parsoid
yields
E: Unable to locate package parsoid

So could anyone please help me on this? Thank in advance!

Rgds,
Joe
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
D F | 14 Jul 06:02 2015
Picon

Outer templates modifying inner templates' parameters in nested template calls?

Is there a way, or some hack, for an outer template to modify some inner templates' parameters in nested template calls? For example:

  {{outer| ... {{inner1|...|???}} ... {{inner2|...|???}} ... {{inner17|...|???}} ... {{inner18|...|???}} ... |language}}

so that

* if language = english, then ??? is replaced with en (before the inner templates are called)
* if language = spanish, then ??? is replaced with sp (before the inner templates are called)

This way, we only have to change the language parameter of the outer template, and all the inner templates are called with the appropriate parameter. (Instead of manually modifying the numerous inner templates.)

I know that inner templates are called before outer ones. (This would mean that the inner templates would execute with the ??? parameter, returning something that would allow the outer template to modify the ???, then the outer template would call back the inner templates with the modified parameter, before the outer template finally does it's own thing with the result. I don't know whether or not this could be hacked.)

Thanks

Daniel Forgues 
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Vadim Shlyakhov | 22 Apr 18:11 2015
Picon

Parsoid to render #Widget parser function result

Hi!,

Like before I'm playing with a wiki with quite an old Mediawiki installed (http://www.cruiserswiki.org/wiki/Special:Version)

We have a Widgets extension installed and it appears we are not able to render a result from #widget parser function there.

For example, at http://www.cruiserswiki.org/wiki/User:Vadim/Sandbox3 we have:

 <nowiki>{{</nowiki>#Widget:Dmh2Deg|d=41|m=14.74|h=N}}

{{#Widget:Dmh2Deg|d=41|m=14.74|h=N}}

 <nowiki>{{</nowiki>#Widget:Dmh2Deg|d=09|m=11.93|h=E}}

{{#Widget:Dmh2Deg|d=09|m=11.93|h=E}}

which renders to
{{#Widget:Dmh2Deg|d=41|m=14.74|h=N}}

41.245666666667

{{#Widget:Dmh2Deg|d=09|m=11.93|h=E}}

9.1988333333333


but the Parsoid gives:

{{#Widget:Dmh2Deg|d=41|m=14.74|h=N}}

{{#Widget:Dmh2Deg|d=09|m=11.93|h=E}}

Actually in HTML code I see:

<!-- ENCODED_CONTENT PCEtLQotLT48IS0tCi0tPjQxLjI0NTY2NjY2NjY2Nw== -->

and

<!--  ENCODED_CONTENT PCEtLQotLT48IS0tCi0tPjkuMTk4ODMzMzMzMzMzMw== -->

which gives 41.245666666667 and 9.1988333333333 if base64-decoded.

I'm quite confused about this behaviour.

I wonder if someone could help me to solve this issue.

Thanks

Vadim
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Vadim Shlyakhov | 22 Apr 17:56 2015
Picon

Parsoid crashes if no mediatype received

Hello,

Some older versions of Mediawiki (1.16) do not provide "mediatype" in "iiprop" for media. Then its worker crashes when it tries to parse a reply from a server.

Here is workaround for an issue:

--- ext.core.LinkHandler.js-    2015-04-22 15:30:04.000000000 +0300
+++ ext.core.LinkHandler.js    2015-04-22 17:03:11.000000000 +0300
<at> <at> -1011,7 +1012,11 <at> <at>
         // Add (read-only) information about original file size (T64881)
         img.addAttribute( 'data-file-width', info.width );
         img.addAttribute( 'data-file-height', info.height );
-        img.addAttribute( 'data-file-type', info.mediatype.toLowerCase() );
+        if (info.mediatype) {
+            img.addAttribute( 'data-file-type', info.mediatype.toLowerCase() );
+        }
     }
 
     if ( hasImageLink ) {



Is it possible implement it into the Parsoid.

Regards
Vadim
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Vadim Shlyakhov | 1 Mar 15:28 2015
Picon

Parsoid to preserve custom tag

Hi!,

Like before I'm playing with a wiki with quite an old Mediawiki installed (1http://www.cruiserswiki.org/wiki/Special:Version)

Some tags there do not seem to be translated by Parsoid (http://www.cruiserswiki.org/wiki/Sandbox):

<imagemap>
Image:NewcastleRoot.jpg|thumb|center|frame|Route From Newcastle - ''Click on name or areas''
rect 40 465 140 535 [[Sydney]]
rect 90 420 172 450 [[Newcastle]]
rect 132 359 215 415 [[Port Stephens]]
rect 177 275 265 335 [[Port Macquarie]]
rect 190 195 275 253 [[Coffs Harbour]]
rect 160 1 270 40 [[Brisbane]]
rect 510 288 687 360 [[Lord Howe Island]]
poly 124 600 196 421 271 239 272 1 648 1 648 600 [[Tasman Sea]]
</imagemap>

==gallery test==
<gallery widths="185px" heights="140px" perrow="4">
Image:TrapaniPurgatorio.jpg|Chiesa del Purgatorio, Trapani
Image:EriceView.jpg|View from Erice
Image:EriceCastle.jpg|Norman castle, Erice
Image:EriceChurch.jpg|Norman church, Erice
</gallery>

Which Parsoid renders to something like:

<imagemap> Image:NewcastleRoot.jpg|thumb|center|frame|Route From Newcastle - Click on name or areas rect 40 465 140 535 Sydney rect 90 420 172 450 Newcastle rect 132 359 215 415 Port Stephens rect 177 275 265 335 Port Macquarie rect 190 195 275 253 Coffs Harbour rect 160 1 270 40 Brisbane rect 510 288 687 360 Lord Howe Island poly 124 600 196 421 271 239 272 1 648 1 648 600 Tasman Sea </imagemap>
gallery test

<gallery widths="185px" heights="140px" perrow="4"> Image:TrapaniPurgatorio.jpg|Chiesa del Purgatorio, Trapani Image:EriceView.jpg|View from Erice Image:EriceCastle.jpg|Norman castle, Erice Image:EriceChurch.jpg|Norman church, Erice </gallery>

Apparently I'm missing something important. Any ideas?

Thanks
Vadim
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Daniel Friesen | 23 Feb 22:56 2015

Getting a sqlite database of extension metadata

I've published the first step of that MediaWiki Extension tool. So far it's only a script that can populate a database with extension metadata from extensions in Gerrit.

So, if you have any use for your own sqlite database of extension metadata, here's how to get one (assuming you have node and git installed).

$ git clone -b v0.1.1 https://github.com/redwerks/mediawiki-extensionservice.git $ cd mediawiki-extensionservice/ $ npm install $ npm install -g sequelize-cli $ npm install sqlite3 $ mkdir storage/ $ echo "STORAGE_DIR=./storage" >> .env $ echo "DATABASE_TYPE=sqlite" >> .env $ echo "DATABASE_STORAGE=./storage/db.sqlite" >> .env $ sequelize db:migrate $ bin/cron.js You'll have to wait a few minutes for it to finish. But at the end you can use whatever sqlite tools you have to look at the database in `./storage/db.sqlite`.

The Extensions table will contain a list of extensions, besides the extid and composerName indexes each row will have a data column containing JSON with data on the extension.

Some of this data is only available for extensions containing an extension.json file (The .php file is not parsed).
- name: The name of the extension (English text for "namemsg" -> "name" -> final fallback to the extension's dirname)
- description: The extension description (English text for "descriptionmsg" -> "description" -> empty)
- versionHint: The "version" in extension.json.

This data will always be available:
- repository: The git repository url.
- composerName: The "name" in composer.json if present.
- sources: An array of some of the possible ways to install the extension.
  - git-master if the repository has a master branch (basically everything)
  - git-stable if the repository has a HEAD that points to something other than master (in this case a "stableBranch" will also be present)
  - git-rel if the repository has REL#_## branches (basically everything)
  - git-tag if the repository has #.#.# or v#.#.# tags
  - composer if the repository has a valid composer.json with a name.

-- ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Subramanya Sastry | 20 Feb 18:41 2015
Picon

DOM Spec change: Upcoming changes to data-mw output for <ref> tags


As part of T88290, we are going to be making some changes to the data-mw spec for <ref> tags.

So far, the data-mw attribute for <ref> tags had the entire HTML for the reference represented in the body.html property in data-mw. However, in order to reduce the size of the HTML that we generate (and reduce network load and parsing load on clients, especially visual editor), we have been working on a change where we add a reference to the HTML via the body.id attribute in data-mw.

https://gerrit.wikimedia.org/r/#/c/191593/ is the patch that Marc has been working on.

An example at the end of this email will show the specific change and how it looks. We will update the DOM spec page[1] shortly.

So, once this patch is reviewed, tested, and deployed (most likely Feb 25 or Mar 2 unless there are concerns / problems that show up), Parsoid will only be emitting an id-based reference to the HTML. However, Parsoid will continue to accept both data-mw.body.html and data-mw.body.id for serialization.

That said, because of the specifics of Parsoid's selective serializer implementation. if a <ref>'s content has been edited, Parsoid expects to see *some* edit in the wrapper HTML of the <ref> itself. If you continue to send Parsoid data-mw.body.html back, all will work fine (since that will register as an edit). But, if you send Parsoid data-mw.body.id back, you should change the value of that id to a different value.

This update is a bit late in coming -- kind of lost track of it amidst the work, but as far as we know, only VE is affected by this change and they have already fixed their code. Flow has confirmed they aren't. But, let us know if there are any questions / concerns.

Subbu and Marc.

[1] https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec

--------------------------------------------------------------------------------------------------------------------------------------------------------

Wikitext
--------
A <ref>
 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
</ref>

<references />

Current HTML
------------
<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>

<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
</li>
</ol>

New HTML
--------
<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id": "mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>

<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span> </span>
</li>
</ol>

_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Nitin Gupta | 14 Feb 06:49 2015
Picon

Parsoid template expansion

Hi,

I created a nodejs service to convert wikitext to HTML with a frontent (written in Golang) which reads wikipedia dump and feed wikitext to this service[1]. However, after doing all this I discovered that Parsoid needs to contact wikimedia server for template expansion. Since I want to convert the entire wikipedia dump and HTML, I do not want to keep hitting wikimedia servers for template expansion requests.

So, are there any plans to add support to Parsoid to do this expansion offline. Once the wikipedia dump is downloaded, I want the entire process of converting to HTML to be offline (of course, don't need images).


Thanks,
Nitin

_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Vadim Shlyakhov | 5 Feb 11:25 2015
Picon

http://www.cruiserswiki.org/wiki/

Hello there,

I have a bit of a problem with parsing http://www.cruiserswiki.org/wiki/ on my machine.

When I'm trying to use parsoid with this wiki then all external links at the page do not seem to be converted into <a> element.

For example for the page http://www.cruiserswiki.org/wiki/Cesme external link
[http://en.wikipedia.org/wiki/Cesme Çesme] (near the bottom of the page) appears at the parsoid output as it is instead of being converted to something like: <a href="http://en.wikipedia.org/wiki/Cesme" class="external text" rel="nofollow" target="_blank">

I have Ubuntu 14.04 on my machine and initially I tried version 0.2.0 of parsoid from http://parsoid.wmflabs.org:8080/deb . Then I cloned the parsoid from the git repository. But result is the same.

Any feedback would be highly appreciated.

Regards
Vadim
_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l
Emmanuel Engelhart | 15 Nov 13:07 2014

Questions about Parsoid caching HTTP headers

Hi

I currently try to create a cache for "mwoffliner". A cache for images 
(thumbnails) and a cache for Parsoid output. For the images/thumbnails 
it's pretty straight forward thanks to the "last-modified" header.

Unfortunately, for the Parsoid output, this seems to be more 
complicated. Gabriel's htmldumper relies only on the oldid value, but 
I'm not really satisfied byt this approach because I want to be able to 
download a new version of the HTML for the same oldid if necessary (for 
example if the HTML output was improved with a Parsoid fix).

There is an "age" header but I don't really understand the fundamental 
difference with "last-modified". Do we have the same information here 
but presented in an other way? If yes, why is that better than 
"last-modified"?

There is in addition the "x-varnish" header but this is IMO an internal 
information I should not rely on (and BTW, time to time we get headers 
with two "x-warning" header entries, what looks pretty weird to me - see 
PS).

Finally my question, might we introduce a "last-modified" HTTP header?

Regards
Emmanuel

PS: Here an example of request with two "x-varnish" headers:

$ curl -I 
"http://parsoid-lb.eqiad.wikimedia.org/dewiki/Almer%C3%ADa?oldid=133672544"
HTTP/1.1 200 OK
X-Powered-By: Express
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
Cache-Control: s-maxage=2592000
content-revision-id: 133672544
X-Parsoid-Performance: duration=4063; start=1416051524354
Content-Type: text/html; charset=UTF-8
X-Varnish: 735376643 735208307
Via: 1.1 varnish
Date: Sat, 15 Nov 2014 12:03:47 GMT
X-Varnish: 1047669169
Age: 1499
Via: 1.1 varnish
Connection: keep-alive
X-Cache: cp1058 hit (6), cp1058 frontend miss (0)

--

-- 
Kiwix - Wikipedia Offline & more
* Web: http://www.kiwix.org
* Twitter: https://twitter.com/KiwixOffline
* more: http://www.kiwix.org/wiki/Communication

_______________________________________________
Wikitext-l mailing list
Wikitext-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitext-l

Gmane