Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

add publications with Zotero #16

Closed
bbest opened this issue May 21, 2021 · 8 comments
Closed

add publications with Zotero #16

bbest opened this issue May 21, 2021 · 8 comments

Comments

@bbest
Copy link
Collaborator

bbest commented May 21, 2021

Hi @torieketcham,

For adding publications (per #10 (comment)), 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

  • Setup a group and add my Zotero username bdbest; or share your Zotero login with me and I can add you to my marinebon Zotero group.
  • When you export the BibTex, choose to Keep it synchronized.
  • Get the free Zotero desktop app for any OS (Win/Mac/Linux) + Chrome plugin. Then you can visit any article online and click a button to import the reference.

Images

@torieketcham
Copy link
Collaborator

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
Copy link
Member

7yl4r commented May 22, 2021

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
Copy link
Collaborator

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
Copy link
Collaborator Author

bbest commented May 23, 2021

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator Author

bbest commented Jun 2, 2021

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
Copy link
Member

7yl4r commented Jul 17, 2021

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.

@7yl4r 7yl4r added this to the publish to marinbon.org milestone Jul 21, 2021
7yl4r pushed a commit that referenced this issue Jul 27, 2021
@7yl4r 7yl4r closed this as completed Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants