Skip to content

Commit

Permalink
doc/chore: document docDecls field (#562)
Browse files Browse the repository at this point in the history
As well as a hack with the `header-data.json` file.
  • Loading branch information
grunweg authored Dec 20, 2024
1 parent 3c0ed34 commit 34060e4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions make_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,18 @@ class Team:
use_biography=team.get('use_biography', True))
for team in yaml.safe_load(t_file)]

# Data for a documentation entry for a single declaration.
@dataclass
class DocDecl:
# Fully qualified name of the declaration
name: str
# Full HTML code for this declaration's entry on its generated documentation page.
decl_header_html: str
# URL of this declaration's entry in the generated documentation.
# This is site-relative, and starts with "/mathlib4_docs/".
docs_link: str
# URL for this declaration's generated source entry: currently,
# is simply a link to the right revision of the mathlib source code.
src_link: str

@dataclass
Expand All @@ -169,6 +176,8 @@ class HundredTheorem:
title: str
decl: Optional[str] = None
decls: Optional[List[str]] = None
# The HTML source code for the generated documentation entry
# for the declaration(s) in |decl| or |decls|.
doc_decls: Optional[List[DocDecl]] = None
author: Optional[str] = None
links: Optional[Mapping[str, str]] = None
Expand All @@ -183,6 +192,8 @@ class ThousandPlusTheorem:
title: str
decl: Optional[str] = None
decls: Optional[List[str]] = None
# The HTML source code for the generated documentation entry
# for the declaration(s) in |decl| or |decls|.
doc_decls: Optional[List[DocDecl]] = None
author: Optional[str] = None
date: Optional[str] = None
Expand Down Expand Up @@ -218,6 +229,11 @@ class Course:

if DOWNLOAD:
print('Downloading header-data.json...') # This is a slow operation, so let's inform readers.
# header-data.json contains information for every single declaration in mathlib
# which has a generated documentation entry (e.g., skipping private declarations by default).
# The resulting file is huge (several hundred MB), hence we use a small HACK:
# doc-gen4 uploads this file as a .bmp file, so GitHub's servers will serve it in
# compressed form. When downloading it locally, we save it (decompressed) with the correct extension.
download(
'https://leanprover-community.github.io/mathlib4_docs/declarations/header-data.bmp',
DATA/'header-data.json'
Expand Down

0 comments on commit 34060e4

Please sign in to comment.