Template {{refnec|....}} is misinterpreted?
LeMoussel opened this issue · 2 comments
LeMoussel commented
from unittest import TestCase
from wikitextprocessor import Wtp
from wiktextract.page import clean_node
from wiktextract.wxr_context import WiktextractContext
from wiktextract.config import WiktionaryConfig
class TestRefnec(TestCase):
def setUp(self):
self.wxr = WiktextractContext(
wtp = Wtp(
db_path="fr-wiki-latest.db",
lang_code="fr",
project="wikipedia",
),
config=WiktionaryConfig()
)
def tearDown(self):
self.wxr.wtp.close_db_conn()
def test_refnec(self):
self.wxr.wtp.start_page("Test refnec")
tree = self.wxr.wtp.parse(text="{{refnec|Une ligne de {{nobr|945 km}}}}.", expand_all=True)
text = clean_node(
wxr=self.wxr,
sense_data={},
wikinode=tree,
)
self.assertEqual(text, 'Une ligne de 945 km.')
Test seem KO.
The result is: Une ligne de 945 km^([réf. nécessaire])
. Should the result be Une ligne de 945 km.
?
kristian-clausal commented
That's because you forgot the closing }}
in {{refnec|Une ligne de {{nobr|945 km}}.
. Happens to everyone!
LeMoussel commented
corrected :)