Fossil SCM
For rendering footnote-refs enclose HTML tag "a" inside of tag "sup" (instead of the opposite). Format anchors ids using "footnote%s-%i-%s" template (instead of "footnote-%s%i-%s"). Add highlighting when hovering over a span-bounded footnotes.
Commit
fb999972e441766bee98fdebad7b6d460033665cec3f88c4a98030a8c76c43c7
Parent
7229d0f58813d75…
2 files changed
+4
-2
+14
-14
+4
-2
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -1678,17 +1678,19 @@ | ||
| 1678 | 1678 | font-weight: bold; |
| 1679 | 1679 | } |
| 1680 | 1680 | div.markdown > ol.footnotes > li > .footnote-backrefs > a:target { |
| 1681 | 1681 | background: gold; |
| 1682 | 1682 | } |
| 1683 | -div.markdown a.noteref:target > sup { | |
| 1683 | +div.markdown sup > a.noteref:target { | |
| 1684 | 1684 | background: gold; |
| 1685 | 1685 | } |
| 1686 | +div.markdown span.notescope:hover, | |
| 1686 | 1687 | div.markdown span.notescope:target { |
| 1687 | 1688 | border-bottom: 2px solid gold; |
| 1688 | 1689 | } |
| 1689 | -div.markdown span.notescope:target > a.noteref > sup { | |
| 1690 | +div.markdown span.notescope:hover > sup > a.noteref, | |
| 1691 | +div.markdown span.notescope:target > sup > a.noteref { | |
| 1690 | 1692 | background: gold; |
| 1691 | 1693 | } |
| 1692 | 1694 | |
| 1693 | 1695 | /* Objects in the "desktoponly" class are invisible on mobile */ |
| 1694 | 1696 | @media screen and (max-width: 600px) { |
| 1695 | 1697 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1678,17 +1678,19 @@ | |
| 1678 | font-weight: bold; |
| 1679 | } |
| 1680 | div.markdown > ol.footnotes > li > .footnote-backrefs > a:target { |
| 1681 | background: gold; |
| 1682 | } |
| 1683 | div.markdown a.noteref:target > sup { |
| 1684 | background: gold; |
| 1685 | } |
| 1686 | div.markdown span.notescope:target { |
| 1687 | border-bottom: 2px solid gold; |
| 1688 | } |
| 1689 | div.markdown span.notescope:target > a.noteref > sup { |
| 1690 | background: gold; |
| 1691 | } |
| 1692 | |
| 1693 | /* Objects in the "desktoponly" class are invisible on mobile */ |
| 1694 | @media screen and (max-width: 600px) { |
| 1695 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -1678,17 +1678,19 @@ | |
| 1678 | font-weight: bold; |
| 1679 | } |
| 1680 | div.markdown > ol.footnotes > li > .footnote-backrefs > a:target { |
| 1681 | background: gold; |
| 1682 | } |
| 1683 | div.markdown sup > a.noteref:target { |
| 1684 | background: gold; |
| 1685 | } |
| 1686 | div.markdown span.notescope:hover, |
| 1687 | div.markdown span.notescope:target { |
| 1688 | border-bottom: 2px solid gold; |
| 1689 | } |
| 1690 | div.markdown span.notescope:hover > sup > a.noteref, |
| 1691 | div.markdown span.notescope:target > sup > a.noteref { |
| 1692 | background: gold; |
| 1693 | } |
| 1694 | |
| 1695 | /* Objects in the "desktoponly" class are invisible on mobile */ |
| 1696 | @media screen and (max-width: 600px) { |
| 1697 |
+14
-14
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -333,22 +333,22 @@ | ||
| 333 | 333 | const bitfield64_t l = to_base26(locus-1,0); |
| 334 | 334 | char pos[32]; |
| 335 | 335 | |
| 336 | 336 | /* expect BUGs if the following yields compiler warnings */ |
| 337 | 337 | memset(pos,0,32); |
| 338 | - sprintf(pos, "%s%i-%s", ctx->unique.c, index, l.c); | |
| 338 | + sprintf(pos, "%s-%i-%s", ctx->unique.c, index, l.c); | |
| 339 | 339 | if(span && blob_size(span)) { |
| 340 | - BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref-"); | |
| 340 | + BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref"); | |
| 341 | 341 | blob_appendf(ob,"%s'>",pos); |
| 342 | 342 | BLOB_APPEND_BLOB(ob, span); |
| 343 | 343 | blob_trim(ob); |
| 344 | - BLOB_APPEND_LITERAL(ob,"<a class='noteref' href='#footnote-"); | |
| 345 | - blob_appendf(ob,"%s'><sup>%i</sup></a></span>", pos, index); | |
| 344 | + BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote"); | |
| 345 | + blob_appendf(ob,"%s'>%i</a></sup></span>", pos, index); | |
| 346 | 346 | }else{ |
| 347 | 347 | blob_trim(ob); |
| 348 | - BLOB_APPEND_LITERAL(ob,"<a class='noteref' href='#footnote-"); | |
| 349 | - blob_appendf(ob,"%s' id='noteref-%s'><sup>%i</sup></a>", | |
| 348 | + BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote"); | |
| 349 | + blob_appendf(ob,"%s' id='noteref%s'>%i</a></sup>", | |
| 350 | 350 | pos, pos, index); |
| 351 | 351 | } |
| 352 | 352 | return 1; |
| 353 | 353 | } |
| 354 | 354 | |
| @@ -363,31 +363,31 @@ | ||
| 363 | 363 | return; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /* expect BUGs if the following yields compiler warnings */ |
| 367 | 367 | memset(pos,0,24); |
| 368 | - sprintf(pos, "%s%i", ctx->unique.c, index); | |
| 368 | + sprintf(pos, "%s-%i", ctx->unique.c, index); | |
| 369 | 369 | |
| 370 | - blob_appendf(ob, "<li id='footnote-%s'>", pos); | |
| 370 | + blob_appendf(ob, "<li id='footnote%s'>", pos); | |
| 371 | 371 | BLOB_APPEND_LITERAL(ob,"<sup class='footnote-backrefs'>"); |
| 372 | 372 | if( nUsed <= 1 ){ |
| 373 | - blob_appendf(ob,"<a id='footnote-%s-a' " | |
| 374 | - "href='#noteref-%s-a'>^</a>", pos, pos); | |
| 373 | + blob_appendf(ob,"<a id='footnote%s-a' " | |
| 374 | + "href='#noteref%s-a'>^</a>", pos, pos); | |
| 375 | 375 | }else{ |
| 376 | 376 | int i; |
| 377 | 377 | blob_append_char(ob, '^'); |
| 378 | 378 | for(i=0; i<nUsed && i<26; i++){ |
| 379 | 379 | const int c = i + (unsigned)'a'; |
| 380 | - blob_appendf(ob," <a id='footnote-%s-%c'" | |
| 381 | - " href='#noteref-%s-%c'>%c</a>", pos,c, pos,c, c); | |
| 380 | + blob_appendf(ob," <a id='footnote%s-%c'" | |
| 381 | + " href='#noteref%s-%c'>%c</a>", pos,c, pos,c, c); | |
| 382 | 382 | } |
| 383 | 383 | /* It's unlikely that so many backrefs will be usefull */ |
| 384 | 384 | /* but maybe for some machine generated documents... */ |
| 385 | 385 | for(; i<nUsed && i<676; i++){ |
| 386 | 386 | const bitfield64_t l = to_base26(i,0); |
| 387 | - blob_appendf(ob," <a id='footnote-%s-%s'" | |
| 388 | - " href='#noteref-%s-%s'>%s</a>", | |
| 387 | + blob_appendf(ob," <a id='footnote%s-%s'" | |
| 388 | + " href='#noteref%s-%s'>%s</a>", | |
| 389 | 389 | pos,l.c, pos,l.c, l.c); |
| 390 | 390 | } |
| 391 | 391 | if( i < nUsed ) BLOB_APPEND_LITERAL(ob," …"); |
| 392 | 392 | } |
| 393 | 393 | BLOB_APPEND_LITERAL(ob,"</sup>\n"); |
| 394 | 394 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -333,22 +333,22 @@ | |
| 333 | const bitfield64_t l = to_base26(locus-1,0); |
| 334 | char pos[32]; |
| 335 | |
| 336 | /* expect BUGs if the following yields compiler warnings */ |
| 337 | memset(pos,0,32); |
| 338 | sprintf(pos, "%s%i-%s", ctx->unique.c, index, l.c); |
| 339 | if(span && blob_size(span)) { |
| 340 | BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref-"); |
| 341 | blob_appendf(ob,"%s'>",pos); |
| 342 | BLOB_APPEND_BLOB(ob, span); |
| 343 | blob_trim(ob); |
| 344 | BLOB_APPEND_LITERAL(ob,"<a class='noteref' href='#footnote-"); |
| 345 | blob_appendf(ob,"%s'><sup>%i</sup></a></span>", pos, index); |
| 346 | }else{ |
| 347 | blob_trim(ob); |
| 348 | BLOB_APPEND_LITERAL(ob,"<a class='noteref' href='#footnote-"); |
| 349 | blob_appendf(ob,"%s' id='noteref-%s'><sup>%i</sup></a>", |
| 350 | pos, pos, index); |
| 351 | } |
| 352 | return 1; |
| 353 | } |
| 354 | |
| @@ -363,31 +363,31 @@ | |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | /* expect BUGs if the following yields compiler warnings */ |
| 367 | memset(pos,0,24); |
| 368 | sprintf(pos, "%s%i", ctx->unique.c, index); |
| 369 | |
| 370 | blob_appendf(ob, "<li id='footnote-%s'>", pos); |
| 371 | BLOB_APPEND_LITERAL(ob,"<sup class='footnote-backrefs'>"); |
| 372 | if( nUsed <= 1 ){ |
| 373 | blob_appendf(ob,"<a id='footnote-%s-a' " |
| 374 | "href='#noteref-%s-a'>^</a>", pos, pos); |
| 375 | }else{ |
| 376 | int i; |
| 377 | blob_append_char(ob, '^'); |
| 378 | for(i=0; i<nUsed && i<26; i++){ |
| 379 | const int c = i + (unsigned)'a'; |
| 380 | blob_appendf(ob," <a id='footnote-%s-%c'" |
| 381 | " href='#noteref-%s-%c'>%c</a>", pos,c, pos,c, c); |
| 382 | } |
| 383 | /* It's unlikely that so many backrefs will be usefull */ |
| 384 | /* but maybe for some machine generated documents... */ |
| 385 | for(; i<nUsed && i<676; i++){ |
| 386 | const bitfield64_t l = to_base26(i,0); |
| 387 | blob_appendf(ob," <a id='footnote-%s-%s'" |
| 388 | " href='#noteref-%s-%s'>%s</a>", |
| 389 | pos,l.c, pos,l.c, l.c); |
| 390 | } |
| 391 | if( i < nUsed ) BLOB_APPEND_LITERAL(ob," …"); |
| 392 | } |
| 393 | BLOB_APPEND_LITERAL(ob,"</sup>\n"); |
| 394 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -333,22 +333,22 @@ | |
| 333 | const bitfield64_t l = to_base26(locus-1,0); |
| 334 | char pos[32]; |
| 335 | |
| 336 | /* expect BUGs if the following yields compiler warnings */ |
| 337 | memset(pos,0,32); |
| 338 | sprintf(pos, "%s-%i-%s", ctx->unique.c, index, l.c); |
| 339 | if(span && blob_size(span)) { |
| 340 | BLOB_APPEND_LITERAL(ob,"<span class='notescope' id='noteref"); |
| 341 | blob_appendf(ob,"%s'>",pos); |
| 342 | BLOB_APPEND_BLOB(ob, span); |
| 343 | blob_trim(ob); |
| 344 | BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote"); |
| 345 | blob_appendf(ob,"%s'>%i</a></sup></span>", pos, index); |
| 346 | }else{ |
| 347 | blob_trim(ob); |
| 348 | BLOB_APPEND_LITERAL(ob,"<sup><a class='noteref' href='#footnote"); |
| 349 | blob_appendf(ob,"%s' id='noteref%s'>%i</a></sup>", |
| 350 | pos, pos, index); |
| 351 | } |
| 352 | return 1; |
| 353 | } |
| 354 | |
| @@ -363,31 +363,31 @@ | |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | /* expect BUGs if the following yields compiler warnings */ |
| 367 | memset(pos,0,24); |
| 368 | sprintf(pos, "%s-%i", ctx->unique.c, index); |
| 369 | |
| 370 | blob_appendf(ob, "<li id='footnote%s'>", pos); |
| 371 | BLOB_APPEND_LITERAL(ob,"<sup class='footnote-backrefs'>"); |
| 372 | if( nUsed <= 1 ){ |
| 373 | blob_appendf(ob,"<a id='footnote%s-a' " |
| 374 | "href='#noteref%s-a'>^</a>", pos, pos); |
| 375 | }else{ |
| 376 | int i; |
| 377 | blob_append_char(ob, '^'); |
| 378 | for(i=0; i<nUsed && i<26; i++){ |
| 379 | const int c = i + (unsigned)'a'; |
| 380 | blob_appendf(ob," <a id='footnote%s-%c'" |
| 381 | " href='#noteref%s-%c'>%c</a>", pos,c, pos,c, c); |
| 382 | } |
| 383 | /* It's unlikely that so many backrefs will be usefull */ |
| 384 | /* but maybe for some machine generated documents... */ |
| 385 | for(; i<nUsed && i<676; i++){ |
| 386 | const bitfield64_t l = to_base26(i,0); |
| 387 | blob_appendf(ob," <a id='footnote%s-%s'" |
| 388 | " href='#noteref%s-%s'>%s</a>", |
| 389 | pos,l.c, pos,l.c, l.c); |
| 390 | } |
| 391 | if( i < nUsed ) BLOB_APPEND_LITERAL(ob," …"); |
| 392 | } |
| 393 | BLOB_APPEND_LITERAL(ob,"</sup>\n"); |
| 394 |