python
! pip install pyzotero
! pip install git+https://github.com/JoFrhwld/zotero2qmd.git
zoetero2qmd
is a quick and dirty package I wrote to convert the output from pyzotero
to compatible data structures for quarto headers.
python
If you are reusing this code, you’ll need to get your own API key: pyzotero getting started
python
The zotero.Zotero.publications()
method pulls down all citations you’ve added to “My Publications”.
Everything that isn’t a talk is going into one big pile for now. I’ll figure out what to do with talks later. Also, I don’t know why I started using “main” to refer to the publication info.
Each dictionary can be yaml dumped into valid quarto headings.
python
{'params': {'key': 'BNWT43F9', 'notes': 'DOI: 10.5281/ZENODO.10212099'},
'author': [{'name': {'given': 'Josef', 'family': 'Fruehwald'}},
{'name': {'given': 'Santiago', 'family': 'Barreda'}}],
'title': 'fasttrackpy',
'date': '2023-11-28',
'date-format': 'YYYY',
'description': 'v0.3.0',
'abstract': 'This is a python implementation of the FastTrack method.',
'citation': {'type': 'software',
'issued': '2023-11-28',
'url': 'https://fasttrackiverse.github.io/fasttrackpy/',
'version': 'v0.3.0'}}
It took a bit of work to generate mostly legible but unique file names. I decided to append the Zotero key
value to each.
python
def make_file_names(all_mains):
first_aut = [x["author"][0]["name"]["family"] for x in all_mains]
years = [x["date"].split("-")[0] for x in all_mains]
keys = [x["params"]["key"] for x in all_mains]
all_stem = [f"{aut}_{year}_{key}" for aut, year, key in zip(first_aut, years, keys)]
all_stem = [re.sub(r"_$", "", x) for x in all_stem]
return all_stem
I started dumping everything into “papers”… so now I’m stuck with it.
I only want to write new files, since I may manually edit the results here and there.