466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
|
-
+
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
|
BLOB_APPEND_URI(ob, ctx);
blob_appendf(ob,"#misref%s-%c'>%c</a>", unique,c, c);
}
if( i < nUsed ) BLOB_APPEND_LITERAL(ob," …");
}
BLOB_APPEND_LITERAL(ob,"</sup>\n<span>Misreference</span>");
}else if( nUsed ){ /* a regular footnote */
}else if( iMark > 0 ){ /* a regular footnote */
char pos[24];
const char *join = "";
int bJoin = 0;
/* make.footnote_item() invocations should pass args accordingly */
const struct Blob * upc = text+1;
#define _joined_footnote_indicator "<ul class='fn-joined'>"
#define _jfi_sz (sizeof(_joined_footnote_indicator)-1)
assert( text );
assert( blob_size(text) );
memset(pos,0,24);
sprintf(pos, "%s-%i", unique, iMark);
blob_appendf(ob, "<li id='footnote%s' class='", pos);
if( nUsed ){
if( blob_size(text)>=_jfi_sz &&
!memcmp(blob_buffer(text),_joined_footnote_indicator,_jfi_sz)){
join = "fn-joined ";
}
if( blob_size(text)>=_jfi_sz &&
!memcmp(blob_buffer(text),_joined_footnote_indicator,_jfi_sz)){
bJoin = 1;
BLOB_APPEND_LITERAL(ob, "fn-joined ");
}
memset(pos,0,24);
sprintf(pos, "%s-%i", unique, iMark);
blob_appendf(ob, "<li id='footnote%s' class='%s", pos, join);
append_footnote_upc(ob, upc, 0);
if( nUsed == 1 ){
append_footnote_upc(ob, upc, 0);
}else{
BLOB_APPEND_LITERAL(ob, "fn-toodeep ");
}
if( nUsed <= 1 ){
BLOB_APPEND_LITERAL(ob, "fn-monoref'><sup class='fn-backrefs'>");
blob_appendf(ob,"<a id='footnote%s-a' href='", pos);
BLOB_APPEND_URI(ob, ctx);
blob_appendf(ob,"#noteref%s-a'>^</a>", pos);
}else{
int i;
BLOB_APPEND_LITERAL(ob, "fn-polyref'><sup class='fn-backrefs'>^");
|
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
|
-
+
-
+
+
+
+
+
+
+
|
BLOB_APPEND_URI(ob, ctx);
blob_appendf(ob,"#noteref%s-%s'>%s</a>", pos,l.c, l.c);
}
if( i < nUsed ) BLOB_APPEND_LITERAL(ob," …");
}
BLOB_APPEND_LITERAL(ob,"</sup>\n");
append_footnote_upc(ob, upc, 1);
if( join[0] ){
if( bJoin ){
BLOB_APPEND_LITERAL(ob,"<sup class='fn-joined'></sup><ul>");
blob_append(ob,blob_buffer(text)+_jfi_sz,blob_size(text)-_jfi_sz);
}else{
}else if( nUsed ){
BLOB_APPEND_BLOB(ob, text);
}else{
BLOB_APPEND_LITERAL(ob,"<i></i>\n"
"<pre><code class='language-markdown'>");
html_escape(ob, blob_buffer(text), blob_size(text));
BLOB_APPEND_LITERAL(ob,"</code></pre>");
}
#undef _joined_footnote_indicator
#undef _jfi_sz
}else{
/* a footnote was defined but wasn't used */
/* make.footnote_item() invocations should pass args accordingly */
const struct Blob * id = text-1;
assert( !nUsed );
assert( text );
assert( blob_size(text) );
assert( blob_size(id) );
BLOB_APPEND_LITERAL(ob,"<li class='fn-unreferenced'>\n[^ <code>");
html_escape(ob, blob_buffer(id), blob_size(id));
BLOB_APPEND_LITERAL(ob, "</code> ]<i></i>\n"
"<pre><code class='language-markdown'>");
|