@@ -1607,23 +1607,23 @@ def table_cell_fn(ctx: "Wtp", token: str) -> None:
16071607 # data cells
16081608 _parser_merge_str_children (ctx )
16091609 node = ctx .parser_stack [- 1 ]
1610- if (
1611- not node . attrs
1612- and len ( node . children ) == 1
1613- and isinstance ( attrs := node . children [ 0 ], str )
1610+ if node . kind in (
1611+ NodeKind . TABLE_CAPTION ,
1612+ NodeKind . TABLE_HEADER_CELL ,
1613+ NodeKind . TABLE_CELL ,
16141614 ):
1615- if node .kind in (
1616- NodeKind .TABLE_CAPTION ,
1617- NodeKind .TABLE_HEADER_CELL ,
1618- NodeKind .TABLE_CELL ,
1619- ):
1620- node .children .pop ()
1621- # Using the walrus operator and pop()ing without return
1622- # is just to make the type-checker happy without using
1623- # an assert that attrs is definitely a str...
1624- parse_attrs (node , attrs )
1615+ if len (node .attrs ) == 0 :
1616+ if len (node .children ) == 1 and isinstance (
1617+ attrs := node .children [0 ], str
1618+ ):
1619+ node .children .pop ()
1620+ # Using the walrus operator and pop()ing without return
1621+ # is just to make the type-checker happy without using
1622+ # an assert that attrs is definitely a str...
1623+ parse_attrs (node , attrs )
16251624 return
1626- return text_fn (ctx , token )
1625+ else :
1626+ return text_fn (ctx , token )
16271627
16281628 while True :
16291629 node = ctx .parser_stack [- 1 ]
@@ -1676,16 +1676,6 @@ def double_vbar_fn(ctx: "Wtp", token: str) -> None:
16761676 vbar_fn (ctx , "|" )
16771677 return
16781678
1679- # If it is at the beginning of a line, interpret it as starting a new
1680- # cell, without any HTML attributes. We do this by emitting one vbar.
1681- if ctx .beginning_of_line and ctx .begline_enabled :
1682- if _parser_have (ctx , NodeKind .TABLE ):
1683- vbar_fn (ctx , "|" )
1684- else :
1685- vbar_fn (ctx , "|" )
1686- vbar_fn (ctx , "|" )
1687- return
1688-
16891679 while True :
16901680 node = ctx .parser_stack [- 1 ]
16911681 if node .kind == NodeKind .TABLE_ROW :
@@ -2147,6 +2137,7 @@ def magicword_fn(ctx: "Wtp", token: str) -> None:
21472137 r"!!" ,
21482138 r"\s*https?://[\w.-]+(/[^][{}<>|\s]*)?" ,
21492139 r"^[ \t]*!" ,
2140+ r"^\|" ,
21502141 r"\|\|" ,
21512142 r"\|" ,
21522143 r"^----+" ,
0 commit comments