Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

references page and links #117

Merged
merged 16 commits into from Feb 22, 2021
Merged

references page and links #117

merged 16 commits into from Feb 22, 2021

Conversation

bryangingechen
Copy link
Collaborator

@bryangingechen bryangingechen commented Feb 18, 2021

Adds a references.html page, generated from mathlib's docs/references.bib and creates links from all strings of the form "[bib_entry_key]" in docstrings to the entry on that page. The keys are replaced with auto-generated labels following the BibTeX "alpha" style.

Also includes backrefs for both bib entries and library notes (links back from the bib / note entries to the pages that cite them). Some of the entries without backrefs correspond to links in archive/ (e.g. Hofstadter-1979) and some are truly missing (e.g. joyal1977, there's a joyal1997 in set_theory.pgame which is probably a typo).

Finally, I added functionality that turns raw URLs in the markdown into links.

I did basically the bare minimum, copying as much as I could from leanprover-community.github.io, so any styling / formatting suggestions are welcome!

Screen Shot 2021-02-20 at 12 11 41 AM

Zulip thread here.

@bryangingechen bryangingechen linked an issue Feb 18, 2021 that may be closed by this pull request
@gebner
Copy link
Member

gebner commented Feb 18, 2021

#deploy 🙏

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

print_docs.py Outdated Show resolved Hide resolved
@bryangingechen
Copy link
Collaborator Author

#deploy

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

@bryangingechen
Copy link
Collaborator Author

bryangingechen commented Feb 18, 2021

Two problems at https://leanprover-community.github.io/mathlib_docs_demo/topology/sheaves/sheaf_condition/opens_le_cover.html#backref1

  • There's an extra linebreak before the link to Spectral Algebraic Geometry.
  • On Firefox, the link is still covered by the header.

Unfortunately, these both seem to be related to the CSS hack that I don't fully understand yet.

edit: I fixed both of these issues in Chrome and Firefox by using scroll-margin-top in the CSS. Unfortunately Safari doesn't yet support this, so I kept the old hack in a fallback feature query. While the extra linebreaks are still there in Safari, at least the link targets don't get covered.

@bryangingechen
Copy link
Collaborator Author

#deploy

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

@bryangingechen
Copy link
Collaborator Author

#deploy

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

@bryangingechen
Copy link
Collaborator Author

bryangingechen commented Feb 19, 2021

3 things I want to add before this is merged:

There's an active discussion about Stacks tags on Zulip, so that may be the next PR.

@bryangingechen
Copy link
Collaborator Author

#deploy

@bryangingechen
Copy link
Collaborator Author

#deploy

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

# count will track number of times label has been finalized
count = Counter()

for key, data in bib.entries.items():
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ordering of the bib entries here is whatever it is in mathlib's docs/references.bib. This could potentially lead to strange ordering of the a, b, c that are appended to labels.

@@ -79,6 +81,63 @@
# root directory of mathlib.
local_lean_root = os.path.join(root, cl_args.r if cl_args.r else '_target/deps/mathlib') + '/'

bib = pybtex.database.parse_file(f'{local_lean_root}docs/references.bib')

label_style = LabelStyle()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using LabelStyle here is a bit of a hack since I couldn't figure out how to use pybtex's bibliography formatting classes here. (If someone can figure it out, feel free to fix this!)

@bryangingechen
Copy link
Collaborator Author

#deploy

@github-actions
Copy link

This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo!

@robertylewis
Copy link
Member

@bryangingechen this looks fantastic. I'm happy to merge if you are. @gebner ?

@gebner
Copy link
Member

gebner commented Feb 22, 2021

Yeah, looks great, Bryan!

@bryangingechen
Copy link
Collaborator Author

Thanks! I'll merge this now then!

@bryangingechen bryangingechen merged commit 03d2a81 into master Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

references.bib
3 participants