326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
BLOB_APPEND_LITERAL(ob, " </tr>\n");
}
static int html_footnote_ref(
struct Blob *ob, const struct Blob *span, int index, int locus, void *opaque
){
const struct MarkdownToHtml *ctx = (struct MarkdownToHtml*)opaque;
const bitfield64_t l = to_base26(locus-1,0);
char pos[32];
/* expect BUGs if the following yields compiler warnings */
memset(pos,0,32);
sprintf(pos, "%s-%i-%s", ctx->unique.c, index, l.c);
if(span && blob_size(span)) {
BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref");
blob_appendf(ob,"%s'>",pos);
BLOB_APPEND_BLOB(ob, span);
blob_trim(ob);
BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote");
blob_appendf(ob,"%s'>%i</a></sup></span>", pos, index);
}else{
blob_trim(ob);
BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote");
blob_appendf(ob,"%s' id='noteref%s'>%i</a></sup>",
pos, pos, index);
}
return 1;
}
/* Render a single item of the footnotes list.
* Each backref gets a unique id to enable dynamic styling. */
static void html_footnote_item(
|
>
>
>
|
|
<
<
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
BLOB_APPEND_LITERAL(ob, " </tr>\n");
}
static int html_footnote_ref(
struct Blob *ob, const struct Blob *span, int index, int locus, void *opaque
){
const struct MarkdownToHtml *ctx = (struct MarkdownToHtml*)opaque;
/* expect BUGs if the following yields compiler warnings */
if( index>0 && locus>0 ){
const bitfield64_t l = to_base26(locus-1,0);
char pos[32];
memset(pos,0,32);
sprintf(pos, "%s-%i-%s", ctx->unique.c, index, l.c);
if(span && blob_size(span)) {
BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref");
blob_appendf(ob,"%s'>",pos);
BLOB_APPEND_BLOB(ob, span);
blob_trim(ob);
BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote");
blob_appendf(ob,"%s'>%i</a></sup></span>", pos, index);
}else{
blob_trim(ob);
BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote");
blob_appendf(ob,"%s' id='noteref%s'>%i</a></sup>",
pos, pos, index);
}
}else if(span && blob_size(span)) {
BLOB_APPEND_LITERAL(ob, "<span class='notescope' id='misref");
blob_appendf(ob, "%s-%i'>", ctx->unique.c, -index);
BLOB_APPEND_BLOB(ob, span);
blob_trim(ob);
BLOB_APPEND_LITERAL(ob,
"<sup class='misref'>misreference</sup></span>");
}else{
blob_trim(ob);
BLOB_APPEND_LITERAL(ob, "<sup class='misref' id='misref");
blob_appendf(ob, "%s-%i", ctx->unique.c, -index);
BLOB_APPEND_LITERAL(ob, "'>misreference</sup>");
}
return 1;
}
/* Render a single item of the footnotes list.
* Each backref gets a unique id to enable dynamic styling. */
static void html_footnote_item(
|