def test_footnote_inline(): md = MarkdownIt().use(footnote_plugin) src = r"^[a]" tokens = [] state = StateInline(src, md, {}, tokens) state.env = {"footnotes": {"refs": {":a": -1}}} index.footnote_inline(state, False) # print([t.as_dict() for t in tokens]) assert [t.as_dict() for t in tokens] == [{ "type": "footnote_ref", "tag": "", "nesting": 0, "attrs": None, "map": None, "level": 0, "children": None, "content": "", "markup": "", "info": "", "meta": { "id": 0 }, "block": False, "hidden": False, }] assert state.env == { "footnotes": { "refs": { ":a": -1 }, "list": { 0: { "content": "a", "tokens": [ Token( type="text", tag="", nesting=0, attrs=None, map=None, level=0, children=None, content="a", markup="", info="", meta={}, block=False, hidden=False, ) ], } }, } }
def test_footnote_ref(): md = MarkdownIt() src = r"[^a]" tokens = [] state = StateInline(src, md, {}, tokens) state.env = {"footnotes": {"refs": {":a": -1}}} index.footnote_ref(state, False) # print([t.as_dict() for t in tokens]) assert [t.as_dict() for t in tokens] == [{ "type": "footnote_ref", "tag": "", "nesting": 0, "attrs": None, "map": None, "level": 0, "children": None, "content": "", "markup": "", "info": "", "meta": { "id": 0, "subId": 0, "label": "a" }, "block": False, "hidden": False, }] assert state.env == { "footnotes": { "refs": { ":a": 0 }, "list": { 0: { "label": "a", "count": 1 } } } }