@@ -994,11 +994,12 @@ impl<'a, 'r, 'o, 'd, 'c, 'p> Subject<'a, 'r, 'o, 'd, 'c, 'p> {
994994
995995 // Create the footnote reference node
996996 let ref_node = self . make_inline (
997- NodeValue :: FootnoteReference ( NodeFootnoteReference {
997+ NodeValue :: FootnoteReference ( Box :: new ( NodeFootnoteReference {
998998 name : name. clone ( ) ,
999+ texts : vec ! [ ] , // Unused.
9991000 ref_num : 0 ,
10001001 ix : 0 ,
1001- } ) ,
1002+ } ) ) ,
10021003 startpos,
10031004 endpos,
10041005 ) ;
@@ -1734,13 +1735,33 @@ impl<'a, 'r, 'o, 'd, 'c, 'p> Subject<'a, 'r, 'o, 'd, 'c, 'p> {
17341735 // do anything fancy here at all.
17351736 let mut sussy = false ;
17361737
1738+ let mut texts = vec ! [ ] ;
1739+
17371740 for sibling in sibling_iterator {
1738- match sibling. data ( ) . value {
1741+ let sibling_ast = sibling. data ( ) ;
1742+ if sibling_ast. sourcepos . start . line != sibling_ast. sourcepos . end . line
1743+ || sibling_ast. sourcepos . end . column < sibling_ast. sourcepos . start . column
1744+ {
1745+ sussy = true ;
1746+ break ;
1747+ }
1748+
1749+ match sibling_ast. value {
17391750 NodeValue :: Text ( ref literal) => {
17401751 text. push_str ( literal) ;
1752+ texts. push ( (
1753+ literal. to_string ( ) ,
1754+ sibling_ast. sourcepos . end . column - sibling_ast. sourcepos . start . column
1755+ + 1 ,
1756+ ) ) ;
17411757 }
17421758 NodeValue :: HtmlInline ( ref literal) => {
17431759 text. push_str ( literal) ;
1760+ texts. push ( (
1761+ literal. to_string ( ) ,
1762+ sibling_ast. sourcepos . end . column - sibling_ast. sourcepos . start . column
1763+ + 1 ,
1764+ ) ) ;
17441765 }
17451766 _ => {
17461767 sussy = true ;
@@ -1751,11 +1772,12 @@ impl<'a, 'r, 'o, 'd, 'c, 'p> Subject<'a, 'r, 'o, 'd, 'c, 'p> {
17511772
17521773 if !sussy && text. len ( ) > 1 {
17531774 let inl = self . make_inline (
1754- NodeValue :: FootnoteReference ( NodeFootnoteReference {
1775+ NodeValue :: FootnoteReference ( Box :: new ( NodeFootnoteReference {
17551776 name : text[ 1 ..] . to_string ( ) ,
1777+ texts,
17561778 ref_num : 0 ,
17571779 ix : 0 ,
1758- } ) ,
1780+ } ) ) ,
17591781 // Overridden immediately below.
17601782 self . scanner . pos ,
17611783 self . scanner . pos ,
@@ -2341,7 +2363,7 @@ pub(crate) fn manual_scan_link_url_2(input: &str) -> Option<(&str, usize)> {
23412363 }
23422364 }
23432365
2344- if i >= len || nb_p != 0 {
2366+ if len == 0 || nb_p != 0 {
23452367 None
23462368 } else {
23472369 Some ( ( & input[ ..i] , i) )
0 commit comments