mw-render has problems with some infobox tables

20 views
Skip to first unread message

Jeremy

unread,
Mar 15, 2010, 4:31:15 PM3/15/10
to mwlib
Hi,

I've seen this error on the current HEAD of the git repo (last commit
88807d288f612dc74aeefd9c1aa9683aad7df466), and also as far back as
0.12.2.

I am executing mw-render with the following command:

mw-render --output out.xml -x -c :en -w xhtml Holy_Roman_Empire

And I receive output that contains the following (the SNIPs are my
edits, for brevity):
...
{| width=100% style="background: transparent; text-align:center;
margin:0 auto; border:0;" </td></tr><tr><td style="padding:0;
vertical-align:middle; border:0">...[SNIP]...</td><td align="center"
style="border:0" valign="top"> {| width=92%
style="background:transparent; text-align:center; margin:0 auto;
border:0;" </td></tr><tr><td style="padding:0; vertical-align:middle;
border:0; text-align:right"><a class="mwx.link.article" href="http://
en.wikipedia.org/w/index.php?title=Old_Swiss_Confederacy">Old Swiss
Confederacy</a></td>...[SNIP]...<img alt="" src="http://
en.wikipedia.org/w/index.php?oldid=20" width="20" /></a></td></tr></
table></td></tr></table><div class="mwx.paragraph"> |- | <strong>Today
part of</strong> || <span class="flagicon"><a class="mwx.link.image"
href="Image:File:Flag of Austria.svg"> ... [SNIP]... <a
class="mwx.link.article" href="http://en.wikipedia.org/w/index.php?
title=Switzerland">Switzerland</a> |- </div><div
class="mwx.paragraph">|- </div><div class="mwx.paragraph">|- |}
|} ...

This looks to me like some of the infobox data is not being properly
parsed, since the curly braces and pipes are part of the infobox
template. My first question is, am I using mw-render properly in this
case? If I am, am I correct in thinking that this output is incorrect?
And if both of those are true, could someone point me to the relevant
place in the code base, so I can dig a little deeper?

Thanks,
Jeremy

Volker Haas

unread,
Mar 16, 2010, 7:26:36 AM3/16/10
to mw...@googlegroups.com
Hi Jeremy,

thanks for the report, you indeed spotted a bug related to template parsing.

I filed a ticket at http://code.pediapress.com/wiki/ticket/800

Jeremy wrote:
> And if both of those are true, could someone point me to the relevant
> place in the code base, so I can dig a little deeper?
>
>

The bug is located somewhere in mwlib. I suspect that it is related to
template parsing or expansion - but I am just guessing.

If you want to try and debug the problem:

* use mw-zip to download the article and generate a zip file once. then
render/debug :

mw-zip -c :en -o test.zip 'Holy Roman Empire'

mw-render -c test.zip -o test.pdf -w rl -W debug

> Thanks,
> Jeremy
>
>

--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstra�e 64
fax +49 6131 2116392 55118 mainz
volke...@brainbot.com http://www.brainbot.com/

Jeremy

unread,
Mar 16, 2010, 10:12:39 PM3/16/10
to mwlib
Hi,

I've updated the bug report with some info I found today.

I have a simple fix that seems to work for this isolated case, but I'd
like to be able to do more thorough testing before moving forward (and
eventually submitting the patch). I'm not too familiar with a python
environment, unfortunately, so I could use some help running the tests
in the tests folder. What's the proper procedure?

On Mar 16, 4:26 am, Volker Haas <volker.h...@brainbot.com> wrote:
> Hi Jeremy,
>
> thanks for the report, you indeed spotted a bug related to template parsing.
>

> I filed a ticket athttp://code.pediapress.com/wiki/ticket/800


>
> Jeremy wrote:
> > And if both of those are true, could someone point me to the relevant
> > place in the code base, so I can dig a little deeper?
>
> The bug is located somewhere in mwlib. I suspect that it is related to
> template parsing or expansion - but I am just guessing.
>
> If you want to try and debug the problem:
>
> * use mw-zip to download the article and generate a zip file once. then
> render/debug :
>
> mw-zip -c :en -o test.zip 'Holy Roman Empire'
>
> mw-render -c test.zip -o test.pdf -w rl -W debug
>
> > Thanks,
> > Jeremy
>
> --
> volker haas                 brainbot technologies ag
> fon +49 6131 2116394        boppstra e 64
> fax +49 6131 2116392        55118 mainz

> volker.h...@brainbot.com    http://www.brainbot.com/

Volker Haas

unread,
Mar 17, 2010, 4:33:11 AM3/17/10
to mw...@googlegroups.com
Hi Jeremy

Jeremy wrote:
> I'm not too familiar with a python
> environment, unfortunately, so I could use some help running the tests
> in the tests folder. What's the proper procedure?
>


First you need the "py" package: http://pypi.python.org/pypi/py/1.2.1

Then you can run specific tests in the tests folder:

~/repos/mwlib/tests/ % py.test test_parser.py
...
========================== 152 passed in 1.49 seconds

I hope that gets you started.

Regards,
Volker

--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstra�e 64
fax +49 6131 2116392 55118 mainz

volke...@brainbot.com http://www.brainbot.com/

Reply all
Reply to author
Forward
0 new messages