Skip to content

Commit

Permalink
Update Zotero script to accommodate OMR Bibliography
Browse files Browse the repository at this point in the history
Also updated README to include all necessary information without linking a separate repo.
  • Loading branch information
pythonsemicolon authored and maregold committed Aug 9, 2023
1 parent 8834730 commit 26c191e
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 1,281 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,20 @@ There are two parts of this site updated from Zotero group libraries.
https://www.zotero.org/groups/424851/omr_bibliography
https://www.zotero.org/groups/2415821/ddmal

The basic functionality is documented on the SIMSSA site here:
https://github.com/DDMAL/simssa.github.io#updating-citations-locally
Inside the DDMAL folder, there are four subfolders for _Media_, _Posters_, _Presentations_ and _Publications_ respectively.

This repo has two different versions of that script, one for general
DDMAL citation updates and one for the Zotero bibliography.
To create an export, right click on any desired subfolder and select the option **Create Bibliography from Collection...**. At this point, make sure you have installed the _Chicago Manual of Style 17th edition_ inside the **Manage Styles...** popup. Then, set _Output Mode_ to Bibliography and Output Method to **Save as HTML**. Select ok, and name the file one of

(Ideally someone will make a general-purpose parser that works for all
these scenarios but I didn't get to it -EH)
```
DDMAL_< [media, posters, presentations, publications, omr] >.html
```
depending on which folder you are exporting. Then, save it inside the zotero_export/ folder within this directory.

_NOTE: make sure your generated HTML file contains all of the content you want displayed for the given page, old and new. Once the script is run, the existing page content will be replaced with the contents of your generated file, so include previous content you want to keep as well as any new modifications._

Next, run the `html_parser.py` script at the top level of this directory (works on Python 3.7, have not checked others). You will be prompted to input text based on which type of citations you would like to update, one of the three or all. The changes will be reflected in the `content.json` files in each of the specified folders, which are dynamically displayed in the static pages. Open any modified pages locally to ensure they display correctly before pushing to this repository.

_There is another GitHub Actions script called github_html_parser.py that was used in an attempt to automatically update the citation markdown files when zotero_export/ files are updated and pushed to the repo. It is currently deprecated._

## Troubleshooting

Expand Down
8 changes: 4 additions & 4 deletions html_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from urllib.parse import unquote
import json

print('Media (m,M), presentations (pr, PR), publications (pu, PU), posters (po, PO), or all (a,A)?\n')
print('Media (m,M), presentations (pr, PR), publications (pu, PU), posters (po, PO), OMR bibliography (o,O) or all (a,A)?\n')
choice = str(input()).lower()

input_list = ['m', 'pr', 'pu', 'po', 'a']
full_list = ['media', 'presentations', 'publications', 'posters']
input_list = ['m', 'pr', 'pu', 'po', 'o', 'a']
full_list = ['media', 'presentations', 'publications', 'posters', 'omr']
parse_list = []

if choice not in input_list:
Expand All @@ -27,7 +27,7 @@
for type in parse_list:

html_file_name = f'DDMAL_{type}.html'
path = f'activities/{type}/content.json'
path = f'activities/{type}/content.json' if type != 'omr' else f'research/omr/resources/OMRBibliography/content.json'

# Dictionaries for each of the different sources. Keys are the years, values are the html contents.
# These will be stored in JSON files in the corresponding folders.
Expand Down
Loading

0 comments on commit 26c191e

Please sign in to comment.