port the m-e footnote bugfix to v2maint

This commit is contained in:
david parsons
2023-08-22 23:22:50 -07:00
parent c03c0ca03e
commit 452bf325a4
2 changed files with 34 additions and 13 deletions
+20 -13
View File
@@ -757,22 +757,29 @@ linkylinky(int image, MMIOT *f)
else {
int goodlink, implicit_mark = mmiottell(f);
if ( isspace(peek(f,1)) )
pull(f);
if ( peek(f,1) == '[' ) {
pull(f); /* consume leading '[' */
goodlink = linkylabel(f, &key.tag);
if ( is_flag_set(f->flags, MKD_EXTRA_FOOTNOTE)
&& !is_flag_set(f->flags, MKD_STRICT)
&& (!image)
&& S(name)
&& T(name)[0] == '^' ) {
extra_footnote = 1;
goodlink = 1;
}
else {
/* new markdown implicit name syntax doesn't
* require a second []
*/
mmiotseek(f, implicit_mark);
goodlink = !is_flag_set(f->flags, MKD_1_COMPAT);
if ( isspace(peek(f,1)) )
pull(f);
if ( is_flag_set(f->flags, MKD_EXTRA_FOOTNOTE) && (!image) && S(name) && T(name)[0] == '^' )
extra_footnote = 1;
if ( peek(f,1) == '[' ) {
pull(f); /* consume leading '[' */
goodlink = linkylabel(f, &key.tag);
}
else {
/* new markdown implicit name syntax doesn't
* require a second []
*/
mmiotseek(f, implicit_mark);
goodlink = !is_flag_set(f->flags, MKD_1_COMPAT);
}
}
if ( goodlink ) {
+14
View File
@@ -28,6 +28,20 @@ yes?<a href="#footref:1" rev="footnote">&#8617;</a></li>
</ol>
</div>'
try -ffootnote 'footnotes(two adjacent footnotes)' 'Hello[^1][^2]
[^1]: world
[^2]: from Hamburg' '<p>Hello<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p>
<div class="footnotes">
<hr/>
<ol>
<li id="fn:1">
world<a href="#fnref:1" rev="footnote">&#8617;</a></li>
<li id="fn:2">
from Hamburg<a href="#fnref:2" rev="footnote">&#8617;</a></li>
</ol>
</div>'
try -fnofootnote 'footnotes (-fnofootnote)' "$FOOTIE" \
'<p>I haz a footnote<a href="yes?">^1</a></p>'