Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor code refactoring: rename a temporary variable and utilize
matching_bracket_offset() one more time.
No changes in functionality.
|
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | markdown-footnotes |
Files: | files | file ages | folders |
SHA3-256: |
5b845a0790d102965a842d7d33a072bc |
User & Date: | george 2022-02-14 23:32:54 |
Context
2022-02-16
| ||
22:11 |
Include REQUEST_URI into footnotes' hyperlinks.
This should make links work even if base href (in a page's header)
is not consistent with the REQUEST_URI .
If FOOTNOTES_WITHOUT_URI macro is defined while
compiling src/markdown_html.c then bare "#fragment"
hyperlinks (without REQUEST_URI ) are generated.
...
(check-in: 2c1f8f35 user: george tags: markdown-footnotes)
| |
2022-02-14
| ||
23:32 |
Minor code refactoring: rename a temporary variable and utilize
matching_bracket_offset() one more time.
No changes in functionality.
...
(check-in: 5b845a07 user: george tags: markdown-footnotes)
| |
2022-02-13
| ||
19:29 | Fix parsing of "free-standing" footnotes that was (slightly) broken by the previous check-in. ... (check-in: 23c3e0b2 user: george tags: markdown-footnotes) | |
Changes
Changes to src/markdown.c.
︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | ){ const int is_img = (offset && data[-1] == '!'); size_t i = 1, txt_e; struct Blob *content = 0; struct Blob *link = 0; struct Blob *title = 0; const struct footnote *fn = 0; | | | < < < < < < < < | | < | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | ){ const int is_img = (offset && data[-1] == '!'); size_t i = 1, txt_e; struct Blob *content = 0; struct Blob *link = 0; struct Blob *title = 0; const struct footnote *fn = 0; int ret; /* ? FIXME: assert( size>0 ); */ /* checking whether the correct renderer exists */ if( (is_img && !rndr->make.image) || (!is_img && !rndr->make.link) ){ return 0; } /* looking for the matching closing bracket */ txt_e = matching_bracket_offset(data, data+size); if( !txt_e ) return 0; i = txt_e + 1; /* skip any amount of whitespace or newline */ /* (this is much more laxist than original markdown syntax) */ while( i<size && (data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } /* allocate temporary buffers to store content, link and title */ title = new_work_buffer(rndr); |
︙ | ︙ | |||
2582 2583 2584 2585 2586 2587 2588 | size_t j = i+1, k = blob_size(&x->text) + 64; while(j<rndr.notes.nLbled && !blob_compare(&x->id, &fn[j].id)){ k += blob_size(&fn[j].text) + 10; j++; nDups++; } if( i+1<j ){ | | | | | | | | | | 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 | size_t j = i+1, k = blob_size(&x->text) + 64; while(j<rndr.notes.nLbled && !blob_compare(&x->id, &fn[j].id)){ k += blob_size(&fn[j].text) + 10; j++; nDups++; } if( i+1<j ){ Blob list = empty_blob; blob_reserve(&list, k); /* must match _joined_footnote_indicator in html_footnote_item() */ blob_append_string(&list, "<ul class='fn-joined'>\n"); for(k=i; k<j; k++){ struct footnote *y = fn + k; blob_append_string(&list, "<li>"); blob_append(&list, blob_buffer(&y->text), blob_size(&y->text)); blob_append_string(&list, "</li>\n"); /* free memory buffer */ blob_reset(&y->text); if( k!=i ) blob_reset(&y->id); } blob_append_string(&list, "</ul>\n"); x->text = list; } i = j; } if( nDups ){ /* clean rndr.notes.all from invalidated footnotes */ const int n = rndr.notes.nLbled - nDups; struct Blob filtered = empty_blob; blob_reserve(&filtered, n*sizeof(struct footnote)); |
︙ | ︙ |