~jonsterling/forester-discuss

1

forester.csl file to create reference trees from Zotero

Details
Message ID
<CAM6oDQdwwb6_7+s+5byaSLxdD=nQ0cWoro3ZnGpb8W1gQx2D-Q@mail.gmail.com>
DKIM signature
pass
Download raw message
Hello everyone,

Creating reference trees can be a bit tedious, especially if you are
creating several at once.
For those who use Zotero, I've created a .csl file
(https://gist.github.com/AyeGill/8ddd7d895dbc5b4f215574c0dae428f6),
which may make things a bit easier.
Using this "citation style", ctrl-shift-c-ing an item in Zotero should
put the text for a serviceable reference tree in the clipboard (you
can also drag and drop from Zotero into your text editor).

It creates a title (the title of the citation item), the date, sets
the external and doi metadata fields (if they exist in the source -
external is read from the URL field in the source), bibtex, and if
there's an abstract, creates a subtree containing it. It also inserts
the authors, although it just puts their names in plain text, so
you'll have to replace them manually with the path of author trees if
applicable.

It's still a bit clunky to do this for each reference separately (and
the same goes for the author stuff), but I couldn't find a good way
around this using the basic Zotero export api. Possibly one could
write a script that consumes the zotero SQL databse and outputs a
folder of trees, but that would be quite a bit more complicated.

Best,
Eigil
Details
Message ID
<CAETRDC=G-_5k7Zseb3KJ5=oDUz4Jetr+Usar1uWym98eP3Adsg@mail.gmail.com>
In-Reply-To
<CAM6oDQdwwb6_7+s+5byaSLxdD=nQ0cWoro3ZnGpb8W1gQx2D-Q@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Hi Eigil,

Thanks for sharing!

Inspired by your CSL file, but because I could not get CSL to properly
handle line breaks and such, I have written a Python script to convert
a bib file (I manually maintain it, but it can be batch exported from
Zotero too) to the corresponding trees.

The script is at https://github.com/utensil/forest/blob/main/split_bib.py .

If you have a properly installed Pandoc[1] and Python, you may just run

```
pip install bibtexparser
python split_bib.py references
```

assuming you have placed the bib file at `trees/refs/references.bib`
and you want trees to be generated to `trees/refs/`.

Some csl json files will be generated and splitted for debugging, you
can add them to .gitignore.

Actually I can write a script that doesn't rely on Pandoc for
converting bib to csl json, but I need it for now to process French
titles or Forest will complain.

[1]: https://pandoc.org/
Reply to thread Export thread (mbox)