Skip to content

Commit 32ffc77

Browse files
committed
Renamed cmark_node->footnote.{ix,count} to {ref_ix,def_count} to make intent more obvious.
1 parent 7b5d45d commit 32ffc77

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/blocks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,10 @@ static void process_footnotes(cmark_parser *parser) {
484484
if (!footnote->ix)
485485
footnote->ix = ++ix;
486486

487-
// keep track of a) how many times this footnote def has been
488-
// referenced, and b) which reference count this footnote ref is at
487+
// keep track of a) count of how many times this footnote def has been
488+
// referenced, and b) which reference index this footnote ref is at.
489489
// this is used by renderers when generating links and backreferences.
490-
cur->footnote.ix = ++footnote->node->footnote.count;
490+
cur->footnote.ref_ix = ++footnote->node->footnote.def_count;
491491

492492
// store the footnote reference text label in the footnote ref's node's
493493
// `user_data`, so that renderers can use the label when generating

src/html.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf *
6868
cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len);
6969
cmark_strbuf_puts(html, "\" class=\"footnote-backref\">↩</a>");
7070

71-
if (node->footnote.count > 1)
71+
if (node->footnote.def_count > 1)
7272
{
73-
for(int i = 2; i <= node->footnote.count; i++) {
73+
for(int i = 2; i <= node->footnote.def_count; i++) {
7474
char n[32];
7575
snprintf(n, sizeof(n), "%d", i);
7676

@@ -428,9 +428,9 @@ static int S_render_node(cmark_html_renderer *renderer, cmark_node *node,
428428
cmark_strbuf_puts(html, "\" id=\"fnref:");
429429
cmark_strbuf_puts(html, node->user_data);
430430

431-
if (node->footnote.ix > 1) {
431+
if (node->footnote.ref_ix > 1) {
432432
char n[32];
433-
snprintf(n, sizeof(n), "%d", node->footnote.ix);
433+
snprintf(n, sizeof(n), "%d", node->footnote.ref_ix);
434434
cmark_strbuf_puts(html, ":");
435435
cmark_strbuf_put(html, (const unsigned char *)n, strlen(n));
436436
}

src/node.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ struct cmark_node {
7777
cmark_syntax_extension *extension;
7878

7979
union {
80-
int ix;
81-
int count;
80+
int ref_ix;
81+
int def_count;
8282
} footnote;
8383

8484
union {

0 commit comments

Comments
 (0)