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

Bibliographies #1058

Merged
merged 48 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
66c4e3d
add `pybtex` dependency
fredrik-bakke Mar 4, 2024
703fff4
something that works
fredrik-bakke Mar 5, 2024
31387c3
add `no-ref(erence)` option and `#reference` tag
fredrik-bakke Mar 5, 2024
0209052
insert references at end of references
fredrik-bakke Mar 5, 2024
3cd001b
support `citeas` field, and prefix reference links with `reference-`
fredrik-bakke Mar 6, 2024
6e15dcb
test
fredrik-bakke Mar 6, 2024
70f5630
add references to bib file
fredrik-bakke Mar 6, 2024
8be5ac9
add `preprocessor_citations` to `linkcheck` CI
fredrik-bakke Mar 6, 2024
6953a49
process references before git metadata, and implement `#bibliography`…
fredrik-bakke Mar 6, 2024
b28b986
implement usage of macros
fredrik-bakke Mar 6, 2024
b0b49e9
fixes `references.bib`
fredrik-bakke Mar 6, 2024
a613177
fix dates
fredrik-bakke Mar 6, 2024
36bdf07
fix reference types
fredrik-bakke Mar 6, 2024
781eb7e
fix script
fredrik-bakke Mar 6, 2024
f461d69
script and .bib fixes
fredrik-bakke Mar 6, 2024
a617510
add bibliography css
fredrik-bakke Mar 6, 2024
c2abf32
remove superfluous links .bib
fredrik-bakke Mar 6, 2024
f9dfb2f
remove a comment
fredrik-bakke Mar 6, 2024
3764aa0
minor adjustments
fredrik-bakke Mar 6, 2024
a470977
Merge branch 'master' into bibliograph-pybtex
fredrik-bakke Mar 6, 2024
5a4a84f
sort and align .bib
fredrik-bakke Mar 6, 2024
8ccd0b6
citing sources guide
fredrik-bakke Mar 7, 2024
97f69bb
mention `citeas`
fredrik-bakke Mar 7, 2024
e41607a
change reference labels
fredrik-bakke Mar 7, 2024
300da1d
a remark on authors
fredrik-bakke Mar 7, 2024
228c928
magic :)
fredrik-bakke Mar 9, 2024
9073ef1
whoops
fredrik-bakke Mar 9, 2024
e9cc987
Merge branch 'master' into bibliograph-pybtex
fredrik-bakke Mar 9, 2024
2abd3f1
Update book.toml
fredrik-bakke Mar 10, 2024
590b658
remove `references.bib` metafile
fredrik-bakke Mar 11, 2024
20d6ad0
document invisible whitespace
fredrik-bakke Mar 11, 2024
263e1fe
try autopep8 formatted python
fredrik-bakke Mar 11, 2024
c1f7ca9
fix small issues preprocessor
fredrik-bakke Mar 11, 2024
d1046b0
fix small issues citations
fredrik-bakke Mar 11, 2024
ddfbe93
more citation fixes
fredrik-bakke Mar 11, 2024
d00c3d7
more citation fixes
fredrik-bakke Mar 11, 2024
87d0672
disable `no-ref` flag
fredrik-bakke Mar 11, 2024
d9c5a38
don't print bibliography
fredrik-bakke Mar 11, 2024
ac93b64
further citation fixes
fredrik-bakke Mar 11, 2024
cd113ea
achieve perfection
fredrik-bakke Mar 11, 2024
c505128
achieve perfection
fredrik-bakke Mar 11, 2024
92a1a81
disable `check-ast` pre-commit hook?
fredrik-bakke Mar 11, 2024
4d38b72
Merge branch 'master' into bibliograph-pybtex
fredrik-bakke Mar 11, 2024
fb4d415
remove unused python imports
fredrik-bakke Mar 11, 2024
988a2ab
fix format strings
fredrik-bakke Mar 11, 2024
3140780
Add error on unmatched key option
fredrik-bakke Mar 11, 2024
a307a0c
Merge branch 'master' into bibliograph-pybtex
fredrik-bakke Mar 11, 2024
f5d0da1
add file to error message
fredrik-bakke Mar 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,22 @@ jobs:
crate: mdbook-linkcheck
version: '0.7.7'

# Install Python and friends for website generation only where needed
- uses: actions/setup-python@v4
with:
python-version: '3.8'
check-latest: true
cache: 'pip'

- run: python3 -m pip install -r master/scripts/requirements.txt

- uses: actions/cache/restore@v3
with:
key: pre-website-${{ github.run_id }}
path: master/docs

# Tell mdbook to use only the linkcheck backend
- name: Check website links
- name: Check website links and bibtex references
env:
MDBOOK_OUTPUT: '{"linkcheck":{}}'
run: |
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@

"[python]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "ms-python.python"
"editor.defaultFormatter": null,
"editor.formatOnSave": false,
"editor.formatOnType": false,
"editor.formatOnPaste": false
}
}
41 changes: 41 additions & 0 deletions CITING-SOURCES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Citing sources

All of the references and sources of the agda-unimath library are managed in a
[BibLaTeX](https://www.ctan.org/pkg/biblatex) file `references.bib`, and we have
a custom set of macros to work with them.

The macros are as follows:

<!--
We have inserted an invisible whitespace character between the first and second
opening curly braces in the below examples to block the citation preprocessor
from detecting them as macros.
-->

- `{­{#cite referenceXYZ}}` will insert a citation to the reference labeled
`referenceXYZ` (which must be defined in the `references.bib` file) at the
current location, and add that reference to the current page's bibliography.
- `{­{#reference referenceXYZ}}` will add the reference labeled `referenceXYZ`
to the current page's bibliography without inserting a citation.
- `{­{#bibliography}}` is a marker for where the bibliography of the current
page should be inserted. If no such marker is found and the bibliography is
inhabited, it will be inserted at the bottom of the page in a new section
titled `References`.

Note that entries in the BibLaTeX file are expected to have all of the
apropriate fields defined according to their type. For instance, `@book`s _must_
have a defined field for `publisher` and `year`. If this information is not
available, please define them as empty fields. E.g. `publisher = {},`.

If you are unsure about how to structure your BibLaTeX entry, it may be useful
to know that the references are checked by the `linkcheck` GitHub workflow, so
when you post your pull request to `agda-unimath` you can refer to the CI for
possible issues.

**Note:** If the citation label of your reference is not being generated
properly, we support a custom `citeas` field that can be used to overwrite it.
For instance, _Homotopy Type Theory: Univalent Foundations of Mathematics_
should be cited as {{#cite UF13}}, and to make it so we have set
fredrik-bakke marked this conversation as resolved.
Show resolved Hide resolved
`citeas = {UF13}` for its BibLaTeX entry. Keep in mind that if the citation
label is not being generated properly, then it is likely that the author list is
not being parsed properly either.
4 changes: 2 additions & 2 deletions HOWTO-INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ In order to contribute to the `agda-unimath` library you will additionally need:
1. `git`
2. `make`
3. `python` version 3.8 or newer
4. The python libraries `pre-commit`, `requests` and `tomli`. Those can be
installed by running
4. The python libraries `pre-commit`, `pybtex`, `requests` and `tomli`. Those
can be installed by running
```shell
python3 -m pip install -r scripts/requirements.txt
```
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ TIME ?= time
METAFILES := \
ART.md \
CITE-THIS-LIBRARY.md \
CITING-SOURCES.md \
CODINGSTYLE.md \
CONTRIBUTING.md \
CONTRIBUTORS.md \
Expand All @@ -49,7 +50,7 @@ METAFILES := \
STATEMENT-OF-INCLUSION.md \
SUMMARY.md \
TEMPLATE.lagda.md \
USERS.md \
USERS.md

.PHONY: agdaFiles
agdaFiles:
Expand Down
6 changes: 0 additions & 6 deletions TEMPLATE.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,3 @@ concept-subconcept = ...

- An instructive example of a file with the expected structure is
[`order-theory.galois-connections`](https://raw.githubusercontent.com/UniMath/agda-unimath/master/src/order-theory/galois-connections.lagda.md).

## References

1. Univalent Foundations Project, _Homotopy Type Theory – Univalent Foundations
of Mathematics_ (2013) ([website](https://homotopytypetheory.org/book/),
[arXiv:1308.0729](https://arxiv.org/abs/1308.0729))
9 changes: 9 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ output-file = "docs/concept_index.json"
mathswitch-template = "https://mathswitch.xyz/concept/Wd/{wikidata_id}"
wikidata-template = "https://www.wikidata.org/entity/{wikidata_id}"

[preprocessor.citations]
command = "python3 ./scripts/preprocessor_citations.py"
bibtex_file = "references.bib"
citation_style = "alpha"
citation_label_style = "custom_alpha"
error_on_unmatched_keys = true
before = [ "git-metadata" ]

[output.linkcheck]
follow-web-links = false

Expand All @@ -62,6 +70,7 @@ additional-css = [
"website/css/Agda.css",
"website/css/Agda-highlight.css",
"website/css/agda-logo.css",
"website/css/bibliography.css",
"theme/catppuccin.css",
"theme/catppuccin-admonish.css",
"theme/pagetoc.css",
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
python = pkgs.python38.withPackages (p: with p; [
# Keep in sync with scripts/requirements.txt
# pre-commit <- not installed as a Python package but as a binary below
pybtex
requests
tomli
]);
Expand Down
606 changes: 606 additions & 0 deletions references.bib

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scripts/generate_main_index_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def generate_index(root_path, header):
- [File template](TEMPLATE.lagda.md)
- [The library coding style](CODINGSTYLE.md)
- [Guidelines for mixfix operators](MIXFIX-OPERATORS.md)
- [Citing sources](CITING-SOURCES.md)
- [Citing the library](CITE-THIS-LIBRARY.md)
- [Library contents](SUMMARY.md)
- [Art](ART.md)
Expand Down
Loading
Loading