marinebon / www_marinebon2

MBON Website 2021 Rebuild in progress
https://marinebon2.netlify.app/
MIT License
1 stars 1 forks source link

add publications with Zotero #16

Closed bbest closed 3 years ago

bbest commented 3 years ago

Hi @torieketcham,

For adding publications (per https://github.com/marinebon/www_marinebon2/issues/10#issuecomment-846038036), I highly recommend using Zotero to export to BibTex, then import into Wowchemy with their Python command all at once.

# install python module
pip3 install -U academic

# import BibTex file (*.bib)
academic import --bibtex <path_to_your/publications.bib>

Documentation

Tips

Images

torieketcham commented 3 years ago

Hi @bbest - This is very cool - I saw it mentioned in the wowchemy docs but didn't realize that you could actually import references with the Chrome plugin. That will save me so much time (I've been manually entering everything via the netlify CMS, which is excruciating). Thanks! I'll set it up and let you know.

7yl4r commented 3 years ago

Oooh. This publications functionality is even cooler than I realized!

Torie: you can just put all the .bib files in a directory here and then I will run the python script on all of them in one go.

torieketcham commented 3 years ago

Will do @7yl4r - I'm going to work on getting them all together in the next few days. @bbest - I've registered for Zotero with the username torie.ketcham

bbest commented 3 years ago

Right on @torieketcham and @7yl4r,

I invited you to marinebon Zotero group. Feel free to tweak that for your purposes. You can export as BibTex the whole group folder or subfolders.

If @7yl4r you also have a Zotero account, I could add you and then opening Zotero will similarly sync your exported BibTex file and you can run the Python from there. The beauty of a shared Zotero group is that others could also contribute and export.

Eventually we might be able to setup a Github Action to automatically handle the Python updating.

image

torieketcham commented 3 years ago

Awesome, thanks @bbest - I think I will start by adding all of the pubs that are currently on the MBON site to my library and then exporting that folder as BibTex for @7yl4r to help me run. Then I guess we could merge that with the MBON group (does it check for dupes or would it be better just to keep the folder separate anyway?). I'd also like to add specialized tags per the current site organization (i.e. ‘Omics and eDNA, Ocean Obs ‘19, Seascapes etc) so I will play around with that.

torieketcham commented 3 years ago

Hi @7yl4r - I've uploaded a .bib file of the publications to the /content/publication folder - let me know if I did it right and if you're able to run the script on it? @bbest I saved the publications to my zotero app, and I can't seem to get the sync working with my web library. If I can figure that out then maybe I can add these files to the marinebon group - you can let me know if there is a specific way in which you'd like to add them (as a subfolder, etc).

bbest commented 3 years ago

Notes from attempts with @7yl4r ...

Reference

Error

academic import --bibtex content/publication/MBON_publications.bib --overwrite
FileNotFoundError: [Errno 2] No such file or directory: 'content/publication/djurhuus-environmental-2020/index.md'
Bens-MBP:www_marinebon2 bbest$ academic import --bibtex content/publication/MBON_publications.bib --overwrite
Error: from config: failed to resolve output format "WebAppManifest" from site config
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/academic", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/cli.py", line 26, in main
    parse_args(sys.argv[1:])  # Strip command name, leave just args.
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/cli.py", line 90, in parse_args
    dry_run=known_args.dry_run,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/import_bibtex.py", line 40, in import_bibtex
    entry, pub_dir=pub_dir, featured=featured, overwrite=overwrite, normalize=normalize, dry_run=dry_run,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/import_bibtex.py", line 85, in parse_bibtex_entry
    page.load(Path("index.md"))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/editFM.py", line 27, in load

Error verbose

academic import --bibtex content/publication/MBON_publications.bib --overwrite -v
12:57:18PM INFO: Parsing entry djurhuus_environmental_2020
12:57:18PM INFO: Creating folder content/publication/djurhuus-environmental-2020
12:57:18PM INFO: Saving citation to content/publication/djurhuus-environmental-2020/cite.bib
Error: from config: failed to resolve output format "WebAppManifest" from site config
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/academic", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/cli.py", line 26, in main
    parse_args(sys.argv[1:])  # Strip command name, leave just args.
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/cli.py", line 90, in parse_args
    dry_run=known_args.dry_run,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/import_bibtex.py", line 40, in import_bibtex
    entry, pub_dir=pub_dir, featured=featured, overwrite=overwrite, normalize=normalize, dry_run=dry_run,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/import_bibtex.py", line 85, in parse_bibtex_entry
    page.load(Path("index.md"))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/academic/editFM.py", line 27, in load
    with self.path.open("r", encoding="utf-8") as f:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pathlib.py", line 1183, in open
    opener=self._opener)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pathlib.py", line 1037, in _opener
    return self._accessor.open(self, flags, mode)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: 'content/publication/djurhuus-environmental-2020/index.md'

So something

Dry Run

academic import --bibtex content/publication/MBON_publications.bib -dr
12:56:31PM WARNING: Skipping creation of content/publication/djurhuus-environmental-2020 as it already exists. To overwrite, add the `--overwrite` argument.
12:56:31PM ERROR: Invalid date for entry `vestfals_seasonal_nodate`.
12:56:31PM ERROR: Invalid date for entry `sutton_functional_nodate`.
12:56:31PM ERROR: Invalid date for entry `noauthor_deep_nodate`.
12:56:31PM ERROR: Invalid date for entry `noauthor_fish_nodate`.
7yl4r commented 3 years ago

I think the error above is caused by a failure of the hugo command used to create index.md here. Because that command is being run as a subprocess without error checking, the script ignores any failures and then breaks later.

Documented the issue here.