@@ -521,26 +521,6 @@ def _shadow(self) -> bytearray:
521521 parse_to_spans (shadow )
522522 return shadow
523523
524- @property
525- def _ext_link_shadow (self ):
526- """Replace the invalid chars of SPAN_PARSER_TYPES with b'_'.
527-
528- For comments, all characters are replaced, but for ('Template',
529- 'ParserFunction', 'Parameter') only invalid characters are replaced.
530- """
531- ss , se , _ , _ = self ._span_data
532- byte_array = bytearray (self ._lststr [0 ][ss :se ], 'ascii' , 'replace' )
533- subspans = self ._subspans
534- for s , e , _ , _ in subspans ('Comment' ):
535- byte_array [s :e ] = (e - s ) * b'_'
536- for s , e , _ , _ in subspans ('WikiLink' ):
537- byte_array [s :e ] = (e - s ) * b' '
538- for type_ in 'Template' , 'ParserFunction' , 'Parameter' :
539- for s , e , _ , _ in subspans (type_ ):
540- byte_array [s :e ] = b' ' + INVALID_EXT_CHARS_SUB (
541- b' ' , byte_array [s + 2 :e - 2 ]) + b' '
542- return byte_array
543-
544524 def _inner_type_to_spans_copy (self ) -> Dict [str , List [List [int ]]]:
545525 """Create the arguments for the parse function used in pformat method.
546526
@@ -1067,6 +1047,26 @@ def get_italics(self, recursive=True) -> List['Italic']:
10671047 return self .get_bolds_and_italics (
10681048 filter_cls = Italic , recursive = recursive )
10691049
1050+ @property
1051+ def _ext_link_shadow (self ):
1052+ """Replace the invalid chars of SPAN_PARSER_TYPES with b'_'.
1053+
1054+ For comments, all characters are replaced, but for ('Template',
1055+ 'ParserFunction', 'Parameter') only invalid characters are replaced.
1056+ """
1057+ ss , se , _ , _ = self ._span_data
1058+ byte_array = bytearray (self ._lststr [0 ][ss :se ], 'ascii' , 'replace' )
1059+ subspans = self ._subspans
1060+ for s , e , _ , _ in subspans ('Comment' ):
1061+ byte_array [s :e ] = (e - s ) * b'_'
1062+ for s , e , _ , _ in subspans ('WikiLink' ):
1063+ byte_array [s :e ] = (e - s ) * b' '
1064+ for type_ in 'Template' , 'ParserFunction' , 'Parameter' :
1065+ for s , e , _ , _ in subspans (type_ ):
1066+ byte_array [s :e ] = b' ' + INVALID_EXT_CHARS_SUB (
1067+ b' ' , byte_array [s + 2 :e - 2 ]) + b' '
1068+ return byte_array
1069+
10701070 @property
10711071 def external_links (self ) -> List ['ExternalLink' ]:
10721072 """Return a list of found external link objects.
0 commit comments