Reputation: 1351
Is there an (easy) way to automatically generate a publication list (from a bib-file) on Quarto website using R?
I plan to build a new academic website using quarto. To reduce the weekly/monthly maintenance load, I intend to structure/organize/build this page to fulfill multiple purposes at once. The site should not only be a classic academic website but also provide the basics for my CV. Hence, I want to generate the CV directly from this website. That seems to be pretty easy using Quarto and combining the .qmd files for a PDF.
However, I also want to use a bib-file of my publications to automatically generate a publication list. I want to list them categorized by type (@article or @book) and in descending chronological order (2022, 2021, 2020).
In addition, I want to add two other features to this list. First, I want to add numbers per category to each publication, so that the first publication in the category @book receives [1], the second [2] and so on. Second, I want to highlight (bold text) my name (e.g., John Doe) when there are multiple authors for a publication.
Is there an easy way to use R in Quarto for getting such an output?
I have attached some example bib-file entries:
@article{Doe2022b,
author = {Doe, John},
date-added = {2022-11-20 09:36:34 +0100},
date-modified = {2022-11-20 09:37:52 +0100},
doi = {10.1109/5.771073},
journal = {Daily Prophet},
number = {3},
pages = {1-25},
title = {I still know it better},
volume = {25},
year = {2020},
bdsk-url-1 = {https://doi.org/10.1109/5.771073}}
@article{Doe2020,
author = {Doe, Jane and Doe, John},
date-added = {2022-11-20 09:34:29 +0100},
date-modified = {2022-11-20 09:36:30 +0100},
doi = {10.1109/5.771073},
journal = {Daily Prophet},
number = {1},
pages = {18-35},
title = {We know it better},
volume = {23},
year = {2020}}
@book{Doe2021,
address = {Hogwarts},
author = {Doe, John},
date-added = {2022-11-20 09:34:11 +0100},
date-modified = {2022-11-20 09:34:19 +0100},
publisher = {Flourish and Blotts},
title = {My first Book},
year = {2021}}
@book{Doe2022,
address = {Hogwarts},
author = {Doe, John},
date-added = {2022-11-20 09:32:15 +0100},
date-modified = {2022-11-20 09:33:56 +0100},
publisher = {Flourish and Blotts},
title = {My second Book},
year = {2022}}
Upvotes: 1
Views: 1035
Reputation: 22599
I'm not aware of any existing tool that does what you need. If you want to build it yourself, then use Quarto's Lua support to do so.
For example, to generate a list off all books, you'd write a Lua file like this:
-- This is `books-section.lua`
local function is_book (ref)
return ref.type == 'book'
end
function Pandoc (doc)
local references = pandoc.utils.references(doc)
local books = references:filter(is_book)
doc.meta.references = books
doc.meta.bibliography = nil -- ensure that only books will be used
doc.blocks = pandoc.Blocks{
pandoc.Header(1, 'Books'),
pandoc.Div({}, 'refs')
}
return pandoc.utils.citeproc(doc)
end
and then use it to generate a "Book" section with
quarto pandoc -L books-section.lua my-bibliography.bib \
--to=markdown-citations -o books.qmd
The Lua integration is quite powerful, so you might be able to do everything you need and to integrate the whole process into the normal website generation. See the Quarto docs on Lua development for more details.
Upvotes: 2