Skip to content

Instantly share code, notes, and snippets.

View sjgknight's full-sized avatar

Simon Knight sjgknight

View GitHub Profile
@sjgknight
sjgknight / american-medical-association-no-url-auth-date.csl
Last active September 15, 2026 01:53
AMA modified brief citation style
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" delimiter-precedes-last="always" demote-non-dropping-particle="sort-only" initialize-with="" initialize-with-hyphen="false" name-as-sort-order="all" name-delimiter=", " page-range-format="expanded" sort-separator=" " version="1.0" default-locale="en-US">
<info>
<title>American Medical Association (AMA) Manual of Style 11th edition (wo URLs, author-date, alphabetical)</title>
<title-short>AMA (mods: author-date, alphabetical, no URLs)</title-short>
<id>http://www.zotero.org/styles/american-medical-association-no-url-auth-date</id>
<link href="http://www.zotero.org/styles/american-medical-association-no-url-auth-date" rel="self"/>
<link href="http://www.zotero.org/styles/american-medical-association" rel="template"/>
<link href="https://doi.org/10.1093/jama/9780190246556.003.0003" rel="documentation"/>
<link href="https://zotero.org/groups/2205533/collections/QW4JGG9G" rel="documen
@sjgknight
sjgknight / gist:5af2da3ebbb8c500d2f4f151e3833fcd
Last active September 15, 2026 01:30
Bulk append extra field in zotero
const items = ZoteroPane.getSelectedItems();
for (const item of items) {
let extra = item.getField("extra") || "";
if (!extra.includes("note: *")) {
item.setField(
"extra",
extra ? extra + "\nnote: *" : "note: *"
);
{
"translatorID": "b7e4a9c2-1f3d-4e8a-9c5b-2a6d8f0e1c34",
"label": "CSV-with-citekey",
"creator": "Philipp Zumstein and Aurimas Vinckevicius (w minor modification by sjgknight)",
"target": "csv",
"minVersion": "4.0.26",
"maxVersion": "",
"priority": 100,
"displayOptions": {
"exportCharset": "UTF-8xBOM",
@sjgknight
sjgknight / APA-7-markdown-urls.csl
Created March 18, 2025 22:50
Minor mod of APA 7 CSL for inline markdown URL linking of author (date)
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" page-range-format="expanded">
<info>
<title>American Psychological Association 7th edition inline markdown URLs</title>
<title-short>APA-markdown-URLs</title-short>
<id>http://www.zotero.org/styles/american-psychological-association-7th-edition-inline-markdown-urls</id>
<link href="http://www.zotero.org/styles/american-psychological-association-7th-edition-inline-markdown-urls" rel="self"/>
<link href="http://www.zotero.org/styles/apa-6th-edition" rel="template"/>
<link href="https://apastyle.apa.org/style-grammar-guidelines/references/examples" rel="documentation"/>
<author>
@sjgknight
sjgknight / tablefilter.html
Last active August 26, 2024 06:23
Interface to reorder a table based on the sum of matches from applied rules. Here, dynamic table for matching synthesis methods based on user-defined rules. Generated with assistance from ChatGPT.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Interface to reorder a table based on the sum of matches from applied rules. Here, dynamic table for matching synthesis methods based on user-defined rules. Generated with assistance from ChatGPT.">
<meta name="author" content="sjgknight with prompting of ChatGPT and customisation">
<meta name="keywords" content="HTML, JavaScript, Dynamic Table, Matching Logic">
<title>Method Match Example</title>
<style>
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
@sjgknight
sjgknight / csv_to_mermaid.html
Created August 26, 2024 03:50
Single page tool to take CSVs and map across columns into an LR mermaid flowchart.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Tool to take CSVs and map across columns into an LR mermaid flowchart.">
<meta name="author" content="sjgknight with prompting of ChatGPT and customisation">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSV to Mermaid Converter</title>
<!-- Load Mermaid.js -->
<script type="module">
@sjgknight
sjgknight / cv-presentations.csl
Last active December 7, 2023 03:29
APAish style for exporting personal talks.run regex search (- .*,)(.*)(thatsallfolks) to replace with - With:\2\. and then a find-replace on your own name.
<?xml version="1.0" encoding="utf-8"?>
<style class="in-text" version="1.0" name-delimiter=", " delimiter-precedes-et-al="never" delimiter-precedes-last="never" et-al-min="3" initialize-with="" demote-non-dropping-particle="sort-only" default-locale="en-US" xmlns="http://purl.org/net/xbiblio/csl">
<info>
<title>APAish style for CV styled presentations only</title>
<title-short>cv-presentations</title-short>
<id>http://www.zotero.org/styles/apaish-style-for-cv-styled-presentations-only</id>
<link rel="self" href="http://www.zotero.org/styles/apaish-style-for-cv-styled-presentations-only"/>
<author>
<name>Simon Knight</name>
</author>
@sjgknight
sjgknight / Nature - humanities and social sciences communications (author-date).csl
Last active August 5, 2026 07:37
Nature - humanities and social sciences communications (author-date).csl
<?xml version="1.0" encoding="utf-8"?>
<style class="in-text" version="1.0" name-delimiter=", " delimiter-precedes-et-al="never" delimiter-precedes-last="never" et-al-min="3" initialize-with="" demote-non-dropping-particle="sort-only" default-locale="en-US" xmlns="http://purl.org/net/xbiblio/csl">
<info>
<title>Nature - humanities and social sciences communications (author-date)</title>
<title-short>palcomms</title-short>
<id>http://www.zotero.org/styles/nature-humanities-and-social-sciences-communications</id>
<link href="http://www.zotero.org/styles/nature-humanities-and-social-sciences-communications" rel="self"/>
<link href="https://www.nature.com/palcomms/author-instructions/submission-instructions#References%20and%20endnotes" rel="documentation"/>
<author>
<name>Simon Knight</name>
@sjgknight
sjgknight / batch_names_twofields.js
Created November 15, 2023 00:56
A javascript snippet to be used in zotero js developer interface, batch select in the UI and it will convert '1 field' names into '2 field' names. Likely to be quite imperfect...
var newFieldMode = 0; // 0: two-field, 1: one-field (with empty first name)
const zoteroPane = Zotero.getActiveZoteroPane();
const selected = zoteroPane.getSelectedItems();
for (const item of selected) {
let creators = item.getCreators();
let newCreators = []; // Initialize newCreators array
for (let creator of creators) {
if(creator.fieldMode == 1){
@sjgknight
sjgknight / apa-single-spaced-citekey.csl
Last active October 31, 2023 04:27
A csl citation style for use with zotero. It takes the APA single space bibliography and prepends a citekey for export to markdown with citekey headings. Revision 1 creates its own citation key. Revision 2 uses the citation-key field which matches BBT
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" page-range-format="expanded">
<info>
<title>American Psychological Association 7th edition (single-spaced bibliography) w/citekey</title>
<title-short>APA (single-spaced) + citekey</title-short>
<id>http://www.zotero.org/styles/apa-single-spaced-citekey</id>
<link href="http://www.zotero.org/styles/apa-single-spaced-citekey" rel="self"/>
<link href="http://www.zotero.org/styles/apa" rel="template"/>
<link href="https://apastyle.apa.org/style-grammar-guidelines/references/examples" rel="documentation"/>
<author>