fr-docs 5.2.0__tar.gz → 5.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {fr_docs-5.2.0 → fr_docs-5.3.0}/PKG-INFO +1 -1
  2. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/markdown.py +38 -12
  3. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/PKG-INFO +1 -1
  4. {fr_docs-5.2.0 → fr_docs-5.3.0}/pyproject.toml +1 -1
  5. {fr_docs-5.2.0 → fr_docs-5.3.0}/LICENSE.md +0 -0
  6. {fr_docs-5.2.0 → fr_docs-5.3.0}/README.md +0 -0
  7. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/__init__.py +0 -0
  8. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/__main__.py +0 -0
  9. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/build.py +0 -0
  10. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/config.py +0 -0
  11. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/config_accessors.py +0 -0
  12. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/frontmatter.py +0 -0
  13. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/git.py +0 -0
  14. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/html_pipeline.py +0 -0
  15. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/init.py +0 -0
  16. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/search.py +0 -0
  17. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/slug.py +0 -0
  18. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/syntax.py +0 -0
  19. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/template.py +0 -0
  20. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/update.py +0 -0
  21. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs/utils.py +0 -0
  22. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/SOURCES.txt +0 -0
  23. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/dependency_links.txt +0 -0
  24. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/entry_points.txt +0 -0
  25. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/requires.txt +0 -0
  26. {fr_docs-5.2.0 → fr_docs-5.3.0}/fr_docs.egg-info/top_level.txt +0 -0
  27. {fr_docs-5.2.0 → fr_docs-5.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fr-docs
3
- Version: 5.2.0
3
+ Version: 5.3.0
4
4
  Summary: Fast static documentation generator with search, versioning, and zero-config setup
5
5
  Author-email: Omena0 <omena0mc@gmail.com>
6
6
  License: # PolyForm Noncommercial License 1.0.0
@@ -127,8 +127,9 @@ def process_footnotes(md_text):
127
127
  Converts ``[^tag]`` references into superscript links:
128
128
  <a href="url" class="footnote-ref"><sup>n</sup></a>
129
129
 
130
- Returns tuple of (processed_text, footnotes) where footnotes is a list
131
- of {tag, url, title, index} dicts in reference order.
130
+ Returns tuple of (processed_text, references) where references is a list
131
+ of {tag, url, title, index} dicts for ALL definitions that have a title,
132
+ in first-use order (footnote references first, then unused definitions).
132
133
  """
133
134
  definitions = _extract_footnote_definitions(md_text)
134
135
  if not definitions:
@@ -136,6 +137,7 @@ def process_footnotes(md_text):
136
137
 
137
138
  footnotes = []
138
139
  footnote_counter = {}
140
+ footnote_order = {}
139
141
 
140
142
  def _repl(m):
141
143
  tag = m.group(1).strip()
@@ -144,7 +146,7 @@ def process_footnotes(md_text):
144
146
  if tag not in footnote_counter:
145
147
  footnote_counter[tag] = len(footnotes) + 1
146
148
  idx = footnote_counter[tag]
147
- # Avoid duplicate entries for the same tag
149
+ footnote_order[tag] = idx
148
150
  if not any(fn["tag"] == tag for fn in footnotes):
149
151
  footnotes.append(
150
152
  {
@@ -180,28 +182,52 @@ def process_footnotes(md_text):
180
182
  # Add commas between consecutive footnote references
181
183
  processed_text = _add_footnote_commas(processed_text)
182
184
 
183
- return processed_text, footnotes
185
+ # Build references list: all definitions with titles, in first-use order
186
+ references = []
187
+ used_indices = set()
188
+
189
+ # Add footnote-used tags that have titles, in first-use order
190
+ for tag, idx in sorted(footnote_order.items(), key=lambda kv: kv[1]):
191
+ if tag in definitions and definitions[tag]["title"]:
192
+ d = definitions[tag]
193
+ references.append(
194
+ {"tag": tag, "url": d["url"], "title": d["title"], "index": idx}
195
+ )
196
+ used_indices.add(tag)
197
+
198
+ # Add unused definitions that have titles (in definition order)
199
+ for tag, d in definitions.items():
200
+ if tag not in used_indices and d["title"]:
201
+ references.append(
202
+ {"tag": tag, "url": d["url"], "title": d["title"], "index": len(references) + 1}
203
+ )
204
+
205
+ return processed_text, references
184
206
 
185
207
 
186
- def build_footnotes_html(footnotes):
187
- """Build the footnotes HTML section for a page.
208
+ def build_footnotes_html(references):
209
+ """Build the references HTML section for a page.
188
210
 
189
211
  The section is appended before the footer content in the page body.
212
+ References includes all footnote definitions that have titles, renamed
213
+ from the previous "Footnotes" heading.
190
214
  """
191
- if not footnotes:
215
+ if not references:
192
216
  return ""
193
217
  items = []
194
- for fn in footnotes:
195
- title = fn.get("title") or fn.get("url") or ""
218
+ for ref in references:
219
+ title = ref.get("title") or ""
220
+ if not title:
221
+ continue
196
222
  items.append(
197
- f'<li id="fnref-{fn.get("tag")}" class="footnote-item">'
198
- f'<a href="{fn.get("url")}" class="footnote-link" title="{html.escape(title)}">'
223
+ f'<li id="fnref-{ref.get("tag")}" class="footnote-item">'
224
+ f'<a href="{ref.get("url")}" class="footnote-link" title="{html.escape(title)}">'
199
225
  f"{html.escape(title)}</a></li>"
200
226
  )
201
227
  inner = "".join(items)
202
228
  return (
203
229
  '<div class="footnotes">'
204
- '<h2 class="footnotes-heading">Footnotes</h2>'
230
+ '<h2 class="footnotes-heading">References</h2>'
205
231
  f'<ol class="footnotes-list">{inner}</ol>'
206
232
  "</div>"
207
233
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fr-docs
3
- Version: 5.2.0
3
+ Version: 5.3.0
4
4
  Summary: Fast static documentation generator with search, versioning, and zero-config setup
5
5
  Author-email: Omena0 <omena0mc@gmail.com>
6
6
  License: # PolyForm Noncommercial License 1.0.0
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "fr-docs"
9
- version = "5.2.0"
9
+ version = "5.3.0"
10
10
  description = "Fast static documentation generator with search, versioning, and zero-config setup"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.14"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes