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

Add support for note and eprint fields #32

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Conversation

goerz
Copy link
Member

@goerz goerz commented Jul 30, 2023

Closes #20

There is also a workaround for Humans-of-Julia/BibInternal.jl#22. If @Azzaare can merge Humans-of-Julia/BibInternal.jl#23 before we merge this, I can remove the monkeypatched Bibliography.BibInternal.make_bibtex_entry.

I've also rewritten the "Syntax for the .bib file" section in the documentation a bit to include some of the discussion in #15, with some tips on how to write a "good" .bib file.

Currently, this builds on top of PR #31. Once that is merged, I will rebase.

@kellertuer
Copy link
Contributor

I would be fine with this in style if I could read the docs – are they pushed somewhere (into some previews/PR32/)? Adding this manually did not work.

@goerz
Copy link
Member Author

goerz commented Jul 31, 2023

Good point! I (manually) added a preview at https://juliadocs.org/DocumenterCitations.jl/previews/PR32

I also tweaked the CI so that it uploads the built documentation as an artifact, e.g., in https://github.com/JuliaDocs/DocumenterCitations.jl/actions/runs/5718645355

Lastly, if you can clone the branch, you should be able to run make servedocs, or equivalently julia --project=test -e 'include("devrepl.jl"); servedocs(port=8000, verbose=true)'

@goerz
Copy link
Member Author

goerz commented Jul 31, 2023

TIL about the push_preview option! I'll have to try setting that up here...

For my own reference: https://discourse.julialang.org/t/documenter-not-uploading-previews-of-pull-requests/93786

@kellertuer
Copy link
Contributor

Yes that one I meant. That usually even creates a link in the list of CI checks to directly look at the preview.
I am still travelling today, but will take a closer look tomorrow.

docs/src/gallery.md Outdated Show resolved Hide resolved
@kellertuer
Copy link
Contributor

This looks good so far, but there is no mention of note nor an example in the docs, maybe that might be helpful? One could add an unpublished example?

@goerz
Copy link
Member Author

goerz commented Aug 2, 2023

Good point, I'll rephrase that part of the documentation.

There is an example for a note, technically: [GoerzSPIEO2021]. That even has html code in the note to render a link, although I don't think that's really going to be an officially supported feature (better to have some latex syntax like \url, or maybe markdown, supported in Bibliography.jl)

I'll add some more examples for things with notes, including @unpublished/@misc.

Thanks for the feedback!

Just a heads up: I'll be on conference travel myself next week, so I'll probably keep this (and #31) open until I get back on Aug 14.

@kellertuer
Copy link
Contributor

Cool! And no worries about the time line, this is not urgent. Enjoy your conference!

@goerz goerz force-pushed the mg/20-notes-and-preprint branch 2 times, most recently from e1dcaf8 to 9235cf6 Compare September 5, 2023 03:55
@goerz
Copy link
Member Author

goerz commented Sep 5, 2023

I've added a significant number of additional examples for notes/eprints, see https://juliadocs.org/DocumenterCitations.jl/previews/PR32/references/

As part of this, I've also fixed some formatting issues (punctuation, and handling missing fields). See NEWS.md.

In principle, this should also be ready to merge, except that I have to rebase after #31 is merged.

@@ -165,6 +165,8 @@ @article{GoerzJPB2011
Doi = {10.1088/0953-4075/44/15/154011},
Pages = {154011},
Volume = {44},
eprint = {1103.6050},
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a question on this one – how do you know this is an arXiv preprint? Or is that the default? In BibLaTeX there is EPRINTTYPE for that, see, e.g. https://github.com/JuliaManifolds/Manopt.jl/blob/b574950cf349013232e8ab07fa355046bd90e8d3/docs/src/references.bib#L504-L517, and I already have a few that are HAL ( https://hal.science/?lang=en, mainly French authors) which would require a different url prefix.

Copy link
Member Author

Choose a reason for hiding this comment

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

The field for that is Archiveprefix. It's supposed to be an alias for eprinttype (cf. the biblatex manual). I don't think Bibliography.jl understands eprinttype, though (but it should, so that would be something to open an issue on; also primaryclass/eprintclass). ArXiv itself recommends Archiveprefix.

The one thing I did was make Archiveprefix={arxiv} the default (which you can also do in LaTeX). See the notes on the Syntax for the .bib file in the PR.

Other Archiveprefixes (e.g., Archiveprefix={bioRxiv}) are supported and will render correctly, but currently aren't linked. I'm very open to adding support (i.e., automatic linking) for other preprint servers. All I need to know is the mapping from eprint to a URL for a given preprint server.

Actually, bioRxiv is the only other preprint server I was even aware of, and I couldn't find any LaTeX .bst file that has linking support for it (or any other preprint server besides arXiv). Not that that should prevent me from adding support, as soon as someone requests it.

So yeah, if you can open a new issue for HAL with a link to how HAL defines eprint identifiers and how that maps to a URL/DOI, I'll be happy to add linking support for it in another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification :)

Sure we should link probably at least bioRxiv and HAL – I can check for the URL, since I have that somewhere in my LaTeX/BibLaTeX document header.

if archive_prefix == "arXiv"
link = "https://arxiv.org/abs/$eprint"
end
return linkify(text, link)
Copy link
Contributor

@kellertuer kellertuer Sep 7, 2023

Choose a reason for hiding this comment

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

Here we could add for archive_prefix == "HAL"

Suggested change
return linkify(text, link)
if archive_preprint == "HAL"
link = "https://hal.science/$(eprint)/"
end
if archive_preprint == "biorxiv"
link = "https://www.biorxiv.org/content/$doi"
end
return linkify(text, link)

For HAL see e.g. https://hal.science/hal-03909427/, where the eprint id is hal-XXXXXXXX.

For biorXiv I am not sure they have IDs still, since e.g. https://www.biorxiv.org/content/10.1101/2023.03.06.531268v1 just uses the DOI as identifier – one could still do exactly that, use the doi, though that leaves the eprint field ignored in this case. I sketched the code above and hope that works as intended :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add bioRxiv and HAL support in another PR after this is merged

Copy link
Member Author

Choose a reason for hiding this comment

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

#35. Looks like the official ID for bioRxiv is only the last part of the DOI (excluding the 10.1101 prefix).

Copy link
Contributor

Choose a reason for hiding this comment

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

A new PR is of course fine – and yes you are correct, since the first part of the DOI identifies the publisher.

This includes a significant number of formatting fixes.
@goerz goerz marked this pull request as ready for review September 12, 2023 17:22
@goerz
Copy link
Member Author

goerz commented Sep 12, 2023

This is ready to be merged. If there are no further comments/reviews, I'll merge on Friday and then immediately start addressing #35 in a new PR.

If someone else wants to merge this before Friday, that's fine too ;-)

@goerz goerz merged commit 1a0ac06 into master Sep 15, 2023
14 checks passed
@goerz goerz deleted the mg/20-notes-and-preprint branch September 16, 2023 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Note = not displayed (or: add customs fields in display of a BibteX entry)
2 participants