print_const("<p>");
mmd_export_token_tree_html(out, source, t->child, scratch);
-
+
if (scratch->citation_being_printed) {
scratch->footnote_para_counter--;
scratch->footnote_para_counter--;
if (scratch->footnote_para_counter == 0) {
- printf(" <a href=\"#fnref:%d\" title=\"%s\" class=\"reversefootnote\"> ↩</a>", scratch->footnote_being_printed, LC("return to body"));
+ temp_short = scratch->footnote_being_printed;
+ if (scratch->extensions & EXT_RANDOM_FOOT) {
+ srand(scratch->random_seed_base + temp_short);
+ temp_short = rand() % 32000 + 1;
+ }
+ printf(" <a href=\"#fnref:%d\" title=\"%s\" class=\"reversefootnote\"> ↩</a>", temp_short, LC("return to body"));
}
}
if (temp_short2 == scratch->used_footnotes->size) {
// This is a re-use of a previously used note
+ if (scratch->extensions & EXT_RANDOM_FOOT) {
+ srand(scratch->random_seed_base + temp_short);
+ temp_short3 = rand() % 32000 + 1;
+ } else {
+ temp_short3 = temp_short;
+ }
+
printf("<a href=\"#fn:%d\" title=\"%s\" class=\"footnote\">[%d]</a>",
- temp_short, LC("see footnote"), temp_short);
+ temp_short3, LC("see footnote"), temp_short);
} else {
// This is the first time this note was used
+ if (scratch->extensions & EXT_RANDOM_FOOT) {
+ srand(scratch->random_seed_base + temp_short);
+ temp_short3 = rand() % 32000 + 1;
+ } else {
+ temp_short3 = temp_short;
+ }
+
printf("<a href=\"#fn:%d\" id=\"fnref:%d\" title=\"%s\" class=\"footnote\">[%d]</a>",
- temp_short, temp_short, LC("see footnote"), temp_short);
+ temp_short3, temp_short3, LC("see footnote"), temp_short);
}
} else {
// Note-based syntax disabled
// argtable structs
struct arg_lit *a_help, *a_version, *a_compatibility, *a_nolabels, *a_batch,
- *a_accept, *a_reject, *a_full, *a_snippet;
+ *a_accept, *a_reject, *a_full, *a_snippet, *a_random;
struct arg_str *a_format, *a_lang;
struct arg_file *a_file, *a_o;
struct arg_end *a_end;
a_compatibility = arg_lit0("c", "compatibility", "Markdown compatibility mode"),
a_full = arg_lit0("f", "full", "force a complete document"),
a_snippet = arg_lit0("s", "snippet", "force a snippet"),
+ a_random = arg_lit0("", "random", "use random numbers for footnote anchors"),
a_rem2 = arg_rem("", ""),
extensions |= EXT_SNIPPET;
}
+ if (a_random->count > 0) {
+ // Use random anchors
+ extensions |= EXT_RANDOM_FOOT;
+ }
+
if (a_format->count > 0) {
if (strcmp(a_format->sval[0], "html") == 0)
format = FORMAT_HTML;