-
Notifications
You must be signed in to change notification settings - Fork 115
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
[Feature request] BibTeX / Literature in Franklin #555
Comments
So Bibliography.jl doesn't work for me (it's also not registered) but here's a prototype with BibTeX.jl which should show you how things can work; this is with the index.md
utils.jlusing BibTeX
function ref_item(ref, infos)
io = IOBuffer()
author = infos["author"]
author_last, author_first = strip.(split(author, ","))
write(io, "<li id=\"#$ref\">")
write(io, """$author_first $author_last, <span style="font-style:italic;">$(infos["title"])</span>, $(infos["date"]).""")
write(io, "</li>")
return String(take!(io))
end
function hfun_show_refs(refs)
_, allrefs = parse_bibtex(read(joinpath("_assets", "bibex.bib"), String))
out = IOBuffer()
write(out, "<ul>")
for ref in refs
infos = get(allrefs, ref, nothing)
isnothing(infos) && continue
write(out, ref_item(ref, infos))
end
write(out, "</ul>")
return String(take!(out))
end and that's it. The example bib file I'm using is this one and is saved in ResultNotes
|
hmm this could do the job: https://lucianolorenti.github.io/BibTeXFormat.jl/latest/ though it can't handle accents apparently; a good start nonetheless. |
Oh sorry, I wasn't aware that Bibliography.jl is not yet registered, I just saw a propotype with that and Documenter recently and since I am thinking of moving my page from Jekyll to Franklin and this is the only thing I am not yet sure about... this might be a good thing to discuss here. So yes of course, BibTeXFormat and things are a good way, too. I will check. |
Right then in your case you should be able to "just" use my solution tweaking for the desired look. You could also use BibTexFormat but I'm not sure it will help you massively |
I will try that then, maybe next week maybe during JuliaCon and report back. |
Hi, while the above variant with BibTex.jl essentially worked (kudos for being able to parse my messy bibfile after only a few fixes!), presentation of the results in html is quite hard to achieve. OTOH if you have Assuming a bibliography
In
E.g. in
I had this up and running for some custom static site building, now I am a proud owner of a |
This looks really really nice, thanks Jürgen! I will take a closer look hopefully soon. |
beautiful! that's something I can add in the docs as a nice example Btw @j-fu are you happy for me to add a link to your webpage in the README? thanks! |
Well after sleeping over it:
Albeit interesting, all of this is outside my priorities, so i just mention these points here for anyone liking to pick them up... As for linking my home page - well yes, if you think it is ok enough - I won't be that active maintaining it, tough I plan to post my scientific computing course material (julia/pluto based) there in the next couple of months. |
I would contribute to both a CSL based typesetting as well as something that does pandoc-ish things with Franklin, though also for me both topics are not my main priorities so I will not start such projects but would contribute if they exist. |
So I had a look and it seems to me that a good working compromise is to just use citeproc-js which is heavily battle tested. In a way this would be similar to the pandoc option that @j-fu used but the project seems (more?) active and tested, also there would then be two options, one where you just load the js library and one where you pre-render. Franklin could provide some glu code to make this seamless. In a way this is similar to the code highlighting, there could be a Julia based highlighter and in fact there are a couple but they are far from as battle tested as highlight.js or prism. It might then appear that this is somehow too slow or not flexible enough and might seed an effort towards a Julian one but this is an entire project in itself and doesn't look trivial (many finicky details). Ps: on the pandoc front, Franklin is now a bit too far, so there could still be a plugin where the user would say "give that bit to pandoc and plug the results here untouched" (potentially an entire page) but pandoc cannot do some stuff that Franklin does and using both would likely be more annoying than helpful :) |
If the references can be processed before building the site, DOI content negotiation could be of interest. So long as all the publications have a DOI that supports it, the plain text reference can be retrieved with e.g. |
hmm pretty cool and definitely doable |
I'll play around with it a bit, for now I'm pasting each entry in manually. My first hunch for automation is that the output might still need some touching-up, like turning the DOI number into an actual link. |
I've come up with something that will probably suffice for me for now: https://gist.github.com/adigitoleo/52d793e5fa4a8d4787ff556fae7f9454
It's a bit verbose for multiple citations at the moment:
Maybe I'll get around to making it nicer at some point. Also I haven't tested it very much and it is past midnight so please check it before using. Regex might need some tweaking. |
Very nice! and I love the big regex in the middle, does the website for which you're using this have a public repo? in which case it might be good to link to it too so users can see a demo and potentially see your latest updates. |
Working on my first blog article now, then I'll push it as an example, with a fix for the regex which didn't work for textbooks (or anything that doesn't have a journal name). The retrieved reference text has so far been fine in most cases, occasionally I get strange things in the crossref metadata (usually something in place of missing/incorrect page number declarations). But it is easy enough to touch up the refcache. I've also made the citation macro print |
For example, utils.jl.
|
@j-fu I just contructed my publication list using your ideias. Thanks for that. |
Thank you all for the helpful discussion. I wanted to parse bibfiles with my publications and display them neatly on my homepage, together with links to arXiv or the publisher's sites. The above solutions didn't quite work for me so I resorted to the following solution that may also be useful for other people with this use-case:
That's how it looks like: link |
Thanks for this nice package, it looks neat and seems easy to use so far.
Would it be possible to integrate for example Bibliography.jl to have a Publication List (maybe even literature in single pages/blog posts at the bottom)? That would be awesome. Especially a publication list would be nice to have (and my starting point to not only play with Franklin but actually switch).
The text was updated successfully, but these errors were encountered: