mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
port the m-e footnote bugfix to v2maint
This commit is contained in:
+20
-13
@@ -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 ) {
|
||||
|
||||
@@ -28,6 +28,20 @@ yes?<a href="#footref:1" rev="footnote">↩</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">↩</a></li>
|
||||
<li id="fn:2">
|
||||
from Hamburg<a href="#fnref:2" rev="footnote">↩</a></li>
|
||||
</ol>
|
||||
</div>'
|
||||
|
||||
try -fnofootnote 'footnotes (-fnofootnote)' "$FOOTIE" \
|
||||
'<p>I haz a footnote<a href="yes?">^1</a></p>'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user