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

Would that neat join trick also work in https://github.com/Humans-of-Julia/Bibliography.jl/blob/b23a0265a5e6ea4a5bad4e656d5699a458cc2fdd/src/staticweb.jl#L66-L133 ? #30

Closed
Azzaare opened this issue Jun 24, 2021 · 1 comment

Comments

@Azzaare
Copy link
Member

Azzaare commented Jun 24, 2021

From @LazyScholar in #28 (thanks by the way)

Would that neat join trick also work in

function xin(entry)
str = ""
if entry.type == "article"
str *= entry.in.journal * ", " * entry.in.volume
str *= entry.in.number != "" ? "($(entry.in.number))" : ""
str *= entry.in.pages != "" ? ", $(entry.in.pages)" : ""
str *= ", " * entry.date.year
elseif entry.type == "book"
str *= entry.in.publisher
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
elseif entry.type == "booklet"
str *= entry.access.howpublished * ", " * entry.date.year
elseif entry.type == "eprint"
if entry.eprint.archive_prefix == ""
str *= entry.eprint.eprint
else
str *= "$(entry.eprint.archive_prefix):$(entry.eprint.eprint) [$(entry.eprint.primary_class)]"
end
elseif entry.type == "inbook"
aux = entry.in.chapter == "" ? entry.in.pages : entry.in.chapter
str *= entry.booktitle * ", " * aux * ", " * entry.in.publisher
str *= entry.in.address != "" ? ", " * entry.in.address : ""
elseif entry.type == "incollection"
str = "In " * xnames(entry, true) * ", editors, " * entry.booktitle * ", " * entry.in.pages * "."
str *= " " * entry.in.publisher
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
elseif entry.type == "inproceedings"
str *= " In " * entry.booktitle
str *= entry.in.series != "" ? ", " * entry.in.series : ""
str *= entry.in.pages != "" ? ", $(entry.in.pages)" : ""
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
str *= entry.in.publisher != "" ? ". $(entry.in.publisher)" : ""
elseif entry.type == "manual"
str *= entry.in.organization
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
elseif entry.type ["mastersthesis", "phdthesis"]
str *= entry.type == "mastersthesis" ? "Master's" : "PhD"
str *= " thesis, " * entry.in.school
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
elseif entry.type == "misc"
aux = entry.access.howpublished != "" != entry.date.year ? ", " : ""
str *= entry.access.howpublished * aux * entry.date.year
str *= aux != "" && get(entry.fields, "note", "") != "" ? ". " : ""
str *= get(entry.fields, "note", "")
elseif entry.type == "proceedings"
str *= entry.in.volume != "" ? "Volume " * entry.in.volume * " of " : ""
str *= entry.in.series
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
str *= entry.in.publisher != "" ? ". $(entry.in.address)" : ""
elseif entry.type == "techreport"
str *= entry.in.number != "" ? "Technical Report " * entry.in.number * ", " : ""
str *= entry.in.institution
str *= entry.in.address != "" ? ", $(entry.in.address)" : ""
str *= ", " * entry.date.year
elseif entry.type == "unpublished"
aux = get(entry.fields, "note", "")
str *= aux != "" != entry.date.year ? aux * ", " : ""
str *= entry.date.year
end
str *= str == "" ? "" : "."
return str
end
?
I noticed in your example that it might be useful.
ex

Edit:
And

"""
xlink(entry)
Format the download link of an `Entry` for web export.
"""
function xlink(entry)
if entry.access.doi != ""
return "https://doi.org/" * entry.access.doi
elseif entry.access.url != ""
return entry.access.url
end
return ""
end
could also return the arXiv link.

Originally posted by @LazyScholar in #28 (comment)

@LazyScholar
Copy link
Contributor

LazyScholar commented Jun 25, 2021

The arXiv link can be removed from the issue. There is no arXiv field in the BibTex spec and it is recommended to use archivePrefix and eprint field to cite that correctly. So the current workaround to get a url via DocumenterCitations.jl should be to add the arXiv link to the BibTex url field.

For the empty fields with commas my only solution would be to throw a lot of addstr != "" ? ", " : "" onto it.
I think there might be a more elegant way but join might not work here.

Nevertheless this might be fixed or vanish after you add the custom cite/bibliography formats you mentioned somewhere else.

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

No branches or pull requests

2 participants