File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -868,11 +868,13 @@ def close_begline_lists(ctx: "Wtp") -> None:
868868 """Closes currently open list if at the beginning of a line."""
869869 if not (ctx .beginning_of_line and ctx .begline_enabled ):
870870 return
871- # only check if the last direct parent node is HTML
871+ # don't close list if inside <ref> and no list inside <ref>
872872 # if list doesn't close properly, update this code
873- node = ctx .parser_stack [- 1 ]
874- if isinstance (node , HTMLNode ) and node .tag in ctx .paired_html_tags :
875- return
873+ for node in ctx .parser_stack [::- 1 ]:
874+ if isinstance (node , WikiNode ) and node .kind == NodeKind .LIST :
875+ break
876+ elif isinstance (node , HTMLNode ) and node .tag == "ref" :
877+ return
876878 while _parser_have (ctx , NodeKind .LIST ):
877879 _parser_pop (ctx , True )
878880
@@ -2123,7 +2125,7 @@ def magicword_fn(ctx: "Wtp", token: str) -> None:
21232125 r"\|\+" ,
21242126 r"\|-" ,
21252127 r"!!" ,
2126- r"\s*https?://[a-zA-Z0-9. ]+(/[^][{}<>|\s]*)?" ,
2128+ r"\s*https?://[\w.- ]+(/[^][{}<>|\s]*)?" ,
21272129 r"^[ \t]*!" ,
21282130 r"\|\|" ,
21292131 r"\|" ,
Original file line number Diff line number Diff line change @@ -3351,6 +3351,23 @@ def test_is_list_item_fn_2(self):
33513351 item2 = test2_list .children [0 ]
33523352 self .assertTrue (is_list_item (item2 ))
33533353
3354+ def test_newline_in_ref (self ):
3355+ self .ctx .start_page ("aderedor" )
3356+ root = self .ctx .parse (
3357+ """* {{alt|roa-ole|deredor}}<ref> Diccionario del Español Medieval,
3358+ http://purl.uni-rostock.de/demel/d00649426</ref>"""
3359+ )
3360+ list_item = root .children [0 ].children [0 ]
3361+ self .assertEqual (len (list_item .children ), 3 )
3362+ ref_node = list_item .children [2 ]
3363+ self .assertIsInstance (ref_node , HTMLNode )
3364+ self .assertEqual (ref_node .tag , "ref" )
3365+ url_node = ref_node .children [1 ]
3366+ self .assertEqual (url_node .kind , NodeKind .URL )
3367+ self .assertEqual (
3368+ url_node .largs , [["http://purl.uni-rostock.de/demel/d00649426" ]]
3369+ )
3370+
33543371
33553372# XXX implement <nowiki/> marking for links, templates
33563373# - https://en.wikipedia.org/wiki/Help:Wikitext#Nowiki
You can’t perform that action at this time.
0 commit comments