clokep/mwcomposerfromhell

Incorrect result with lists in template parameters

Opened this issue · 3 comments

Hello,

i have test your composer on this code : https://en.wikipedia.org/w/index.php?title=Template:Routing_software&action=edit
and the result is :

<ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li>{{Navbox
|name=Routing software
|title=[[List of router firmware projects|Routing software]]
|listclass=hlist
|state={{{state|autocollapse}}}

|group1=[[Operating system|operating<br>systems]]<br>&<br>[[Network operating system|network<br>operating<br>systems]]
|list1={{Navbox|child
 |group1=[[Linux kernel|Linux]]-<br>based
 |list1={{Navbox|child
  |group1=[[Free and open-source software|entirely free]]
  |list1=
*[[Endian Firewall|Endian]]
*[[Floppyfw]]
*[[IPFire]]
*[[LEDE]]
*[[libreCMC]]
*[[OpenWrt]]
*[[VyOS]]
*[[Zeroshell]]
  |group2=[[Proprietary software|partly proprietary]]
  |list2=
*[[Ubiquiti Networks|AirOS & EdgeOS]]
*[[AlliedWare Plus|Alliedware Plus]]
*[[DD-WRT]]
*[[ExtremeXOS]]
*[[Fritz!Box|FRITZ!Box]]
*[[MikroTik#RouterOS|RouterOS]]
*[[SmoothWall]]
*[[Tomato (firmware)|Tomato]]
*[[Vyatta]]
}}
 |group2=[[FreeBSD]]-<br>based
 |list2={{Navbox|child
  |group1=[[Free and open-source software|entirely free]]
  |list1=
*[[m0n0wall]]
*[[OPNsense]]
*[[pfSense]]
  |group2=[[Proprietary software|partly proprietary]]
  |list2=
*[[Junos OS]]
}}
|group3=[[Proprietary software|proprietary]]
|list3=
*[[Cisco IOS]]
*[[Extreme Networks|ExtremeWare]]
*[[Cisco NX-OS|NX-OS]]
*[[Alcatel-Lucent|TiMOS]]
*[[Huawei|VRP]]
}}

|group2=routing daemons
|list2=
*[[Babel (protocol)|Babel]]
*[[B.A.T.M.A.N.]]
*[[Bird Internet routing daemon|BIRD]]
*[[FRRouting]]
*[[GNU Zebra]]
*[[OpenBGPD]]
*[[OpenOSPFD]]
*[[Quagga (software)|Quagga]]
*[[XORP]]

|group3=other software
|list3=
*[[Captive portal]]
*[[Neighbornode]]
*[[Tor (network)|Tor]]

|group4=related articles
|list4=
*[[Comparison of firewalls]]
*[[List of router and firewall distributions]]
*[[List of router firmware projects]]
*[[National Security Agency#Software backdoors]]
}}
{{Documentation}}
</li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul>
clokep commented

It does tend to break a bit with nested lists, but without knowing more information about how you ran it or what you're attempting to do I'm not sure I can help much.

Hello, i put the wikicode in a txt file and i run this :

import mwparserfromhell
import mwcomposerfromhell
import json

f = open("firewall.txt", "r")
firewall_mw = f.read()

wikicode = mwparserfromhell.parse(firewall_mw)

html = mwcomposerfromhell.compose(wikicode)


f = open("firewall.html", "w+")
firewall_mw = f.write(html)
clokep commented

A reduced test-case:

{{Navbox
|list1=
*[[Article]]
}}

Which results in:

<ul><li>{{Navbox
|list1=
*[[Article]]
}}</li></ul>

It probably should generate:

{{Navbox
|list1=
<ul><li><a href="/wiki/Article" title="Article">Article</a>
</li></ul>
}}