Bug#991917: python3-wikitrans: Wiki 2 html conversion errors

2021-08-09 Thread Erich Schubert

Hi,

3. WikiDelimNodes (generated by wikimarkup: ''Example'') cause raw
JSON to be
inserted in the HTML:

Can you give more detail, please?


I believe this article causes the problem:

https://simpsons.fandom.com/wiki/John_Swartzwelder?action=edit

It may be because of seemingly mismatched quotes:

''The Simpsons''' 16th season

which is rendered (supposedly correct) as: "/The Simpsons'/ 16th season"

Regards,
Erich


Bug#991917: python3-wikitrans: Wiki 2 html conversion errors

2021-08-06 Thread Sergey Poznyakoff
Hi Erich,

Thanks for your report.

> 1. This upstream patch should be included in the package:
> 
> https://git.gnu.org.ua/wikitrans.git/commit/?id=c785e3ad767b12a13ae75a3513ec88a4d1144210

Sure.  It will be included when new version is released.

> 2. A wrong variable name is used here:
> File "/usr/lib/python3/dist-packages/wikitrans/wikimarkup.py", line 662, in
> parse_ref
> list.append(self.parse_tag(tok))
> TypeError: descriptor 'append' for 'list' objects doesn't apply to a
> 'HtmlTagNode' object

That's definitely a copy-paste error.  I've pushed the following patch
https://git.gnu.org.ua/wikitrans.git/commit/?id=90a9ed7108e45fa8c2d0300e1308a99171240255

> 3. WikiDelimNodes (generated by wikimarkup: ''Example'') cause raw
> JSON to be
> inserted in the HTML:

Can you give more detail, please?

Regards,
Sergey



Bug#991917: python3-wikitrans: Wiki 2 html conversion errors

2021-08-05 Thread Erich Schubert

Package: python3-wikitrans
Version: 1.3-1
Severity: important
Tags: upstream
X-Debbugs-Cc: g...@gnu.org

Unfortunately, the wikitrans package fails to convert wiki to html quite 
often.


Here are some errors I noticed when processing the Simpsons fandom wiki:

1. This upstream patch should be included in the package:

https://git.gnu.org.ua/wikitrans.git/commit/?id=c785e3ad767b12a13ae75a3513ec88a4d1144210

2. A wrong variable name is used here:
File "/usr/lib/python3/dist-packages/wikitrans/wikimarkup.py", line 662, in
parse_ref
list.append(self.parse_tag(tok))
TypeError: descriptor 'append' for 'list' objects doesn't apply to a
'HtmlTagNode' object

Here, `list` is the standard class, the instance apparently was renamed to
`seq` in some places. Looks like a copy and paste error to me, as in other
location the local variable is named `list`.

https://git.gnu.org.ua/wikitrans.git/tree/wikitrans/wikimarkup.py?id=c785e3ad767b12a13ae75a3513ec88a4d1144210#n662

3. WikiDelimNodes (generated by wikimarkup: ''Example'') cause raw JSON 
to be

inserted in the HTML:

{"content": "''", "type": "DELIM", "wikinode": "WikiDelimNode"}

A simple workaround (but not a proper solution) is to override the __str__
method as follows:

wikitrans.wiki2html.WikiDelimNode.__str__ = lambda self: ""

Alternatively, one could return `self.content`, but a proper solution 
would be

to generate opening and closing em and bold tags I guess; but I am only
interested in the text, so this hotfix works for me.

-- System Information:
Debian Release: 11.0
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-7-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: 
LC_ALL

set to de_DE.utf-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-wikitrans depends on:
ii python3 3.9.2-3

python3-wikitrans recommends no packages.

python3-wikitrans suggests no packages.