Opened 6 years ago

Closed 3 years ago

# FootNote counters go recursive on formatters

Reported by: Owned by: A. Przygienda Ryan J Ollos normal FootNoteMacro normal Andrew Schulman 0.12

### Description

OK, here's the problem, when doing the following

XXX1

YYY2

1. 1. X
2. 2. Y

the 'internal' footnotes are not printed, they are only printed if you give empty footnote before end of formatter. That would be not bad but in the formatter the footnote numbering starts again at 1. Very confusing.

Solution would be to either carry counters across formatters or inside formatter do (i) or letters or something like this

### comment:1 Changed 5 years ago by Ryan J Ollos

I think your example didn't display correctly here on Trac 0.10.6, so I threw the following into 0.12.2 to confirm the issue:

OK, here's the problem, when doing the following

XXX[[FootNote(X)]]

{{{
#!div style="margin-left:2em"

YYY[[FootNote(Y)]]
[[FootNote]]
}}}

ZZZ[[FootNote(Z)]]

[[FootNote]]


### comment:2 Changed 3 years ago by Ryan J Ollos

Cc: Andrew Schulman added; anonymous removed

#11057 closed as a duplicate.

### comment:3 Changed 3 years ago by Ryan J Ollos

In 13552:

Added unit test harness. Refs #9211.

### comment:4 Changed 3 years ago by Ryan J Ollos

The issue is due to the footnotes being bound to the Formatter object.

When rendering a page, the template wiki_view.html calls format_to_html, which instantiates an HtmlFormatter, which instantiates a Formatter. When formatting a td tablecell, format_to_html is called again, and a new Formatter object is constructed.

Therefore the footnotes bound to the Formatter in the table cell are not visible outside of the table cell.

The only way I can see to fix this is to bind the footnotes to the context. t9211.patch implements that change. Please test it out and let me know if you find any cases that don't format properly. I will add unit tests and increment the patch.

Version 0, edited 3 years ago by Ryan J Ollos (next)

### comment:5 Changed 3 years ago by Ryan J Ollos

Resolution: → fixed new → closed

In 13654:

1.4: Attach footnotes to the context` to avoid scoping issues when formatting the page. Fixes #9211.

### Modify Ticket

Change Properties