Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/data-processing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ jobs:
cd bibtex_to_apa
node bibtex_to_apa.js -o '../content/glossary/apa_lookup.json'

#========================================
# Enrich cited DOIs with Open Access status and repository links (OpenAlex / Unpaywall)
# Restores the previous cache from build-resources so the 90-day cache persists across runs.
#========================================
- name: Restore previous citation OA cache
continue-on-error: true
run: |
git fetch origin +refs/heads/build-resources:refs/remotes/origin/build-resources || true
git archive origin/build-resources data/citation_oa.json | tar -x || true

- name: Enrich citation open-access metadata
continue-on-error: true # Continue even if external OA APIs are unavailable
run: python3 scripts/enrich_citation_oa.py
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved

#========================================
# Regenerate the glossary reference list page from apa_lookup.json so the
# public "List of References" stays in sync with the dynamic glossary.
Expand Down Expand Up @@ -595,6 +609,7 @@ jobs:
cp data/scholar_citations.json /tmp/generated-resources/scholar_citations.json || true
cp data/get_involved_projects.json /tmp/generated-resources/get_involved_projects.json || true
cp data/open_research_games.json /tmp/generated-resources/open_research_games.json || true
cp data/citation_oa.json /tmp/generated-resources/citation_oa.json || true

# Copy FReD citation if it exists
if [ -f static/data/fred_citation.txt ]; then
Expand Down Expand Up @@ -694,6 +709,9 @@ jobs:
if [ -f /tmp/generated-resources/open_research_games.json ]; then
cp /tmp/generated-resources/open_research_games.json data/open_research_games.json
fi
if [ -f /tmp/generated-resources/citation_oa.json ]; then
cp /tmp/generated-resources/citation_oa.json data/citation_oa.json
fi
if [ -f /tmp/generated-resources/contributors_cache.csv ]; then
mkdir -p scripts/forrt_contribs
cp /tmp/generated-resources/contributors_cache.csv scripts/forrt_contribs/
Expand Down Expand Up @@ -731,6 +749,7 @@ jobs:
git add data/scholar_citations.json 2>/dev/null || true
git add data/get_involved_projects.json 2>/dev/null || true
git add data/open_research_games.json 2>/dev/null || true
git add data/citation_oa.json 2>/dev/null || true
git add static/data/fred_citation.txt 2>/dev/null || true
git add data/summaries.json 2>/dev/null || true
git add data/newsletters.json static/newsletters/ 2>/dev/null || true
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ Hand-written pages can cite works in [`content/glossary/apa_lookup.json`](conten
{{< cite "Nosek2018" "Simmons2011" >}}
{{< cite key="Nosek2018" narrative="true" >}}
(e.g. Smith, 2019; {{< cite key="Nosek2018" bare="true" >}})
{{< cite key="HenrichHeineNorenzayan2010" bare="true" text="Henrich, Heine, & Norenzayan, 2010" >}}
```

These render as “(Nosek et al., 2018; Simmons et al., 2011)”, “Nosek et al. (2018)” and “(e.g. Smith, 2019; Nosek et al., 2018)”. Use `bare` inside brackets you write yourself, for example alongside a work that isn't in the bibliography, so the author's wording stays as it was. Every page that cites must include `{{< references >}}` once, after its last citation, to add an alphabetical reference list. The built-HTML check fails citation links without matching reference entries. Clicking a citation opens its full APA reference with source and copy actions; without JavaScript it jumps to the reference list. Unknown keys produce a build warning and appear in square brackets.
These render as “(Nosek et al., 2018; Simmons et al., 2011)”, “Nosek et al. (2018)”, “(e.g. Smith, 2019; Nosek et al., 2018)” and “Henrich, Heine, & Norenzayan, 2010”. Use `bare` inside brackets you write yourself (for example alongside a work that isn't in the bibliography), and `text` when preserving an author's exact punctuation or author list so the wording stays as written. Every page that cites from the shared bibliography must include either `{{< references >}}` or `{{< local-references >}}…{{< /local-references >}}` once, after its last citation, to render the alphabetical reference list. Use `{{< references >}}` when all cited works are in `apa_lookup.json`; use `{{< local-references >}}…{{< /local-references >}}` instead when the page also has manual APA references not in `apa_lookup.json` (with `heading="none"` if the page already has its own References heading; separate entries with blank lines, or keep each bulleted entry on one line): it merges any shared `{{< cite >}}` entries alphabetically, formats long author lists with a toggle, and lets `citations.js` link unambiguous in-text citations to popovers on that page. The built-HTML check fails citation links without matching reference entries. Clicking a citation opens its full APA reference with source and copy actions; without JavaScript it jumps to the reference list. Unknown keys produce a build warning and appear in square brackets.

To ask readers to cite a work, show it as a card with a copy button: `{{< citation-card key="Asai2026OpenScholar" />}}` takes the reference from the bibliography, and `{{< citation-card >}}…{{< /citation-card >}}` takes one written out. In reference lists, cards and the “cite us” blocks, a reference with more than five authors shows the first three and “et al.”, with a button that shows the rest. Copying always gives the full reference.
To ask readers to cite a work, show it as a card with a copy button: `{{< citation-card key="Asai2026OpenScholar" />}}` takes the reference from the bibliography, and `{{< citation-card >}}…{{< /citation-card >}}` takes one written out. In reference lists, a reference with more than five authors — and in suggested citation cards or “cite us” blocks, more than ten — shows the first three and “et al.”, with an inline control to show the rest. Copying always gives the full reference.

Do not edit the generated bibliography or glossary terms. Request additions to the Glossary BibTeX Doc through an issue; the bibliography generator supplies the APA text. Glossary definitions automatically link citations only when their first author and year identify exactly one of the term’s listed references and their author lists agree. Other citations stay plain text. Citations already linked to a source are left alone.

Expand Down
11 changes: 8 additions & 3 deletions assets/css/doors/citations.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
a.cite{color:inherit;text-decoration:underline dotted 1px var(--soft);text-underline-offset:3px}
a.cite:hover,a.cite:focus{color:var(--link)}
/* The button that shows a reference's full author list (layouts/partials/citations/authors.html). */
.ref-authors-toggle{display:inline;margin:0 .15em;padding:0 .55em;background:#fff;border:1px solid var(--line);border-radius:999px;color:var(--link);font:600 15px/1.45 var(--text);white-space:nowrap;cursor:pointer;vertical-align:baseline}
.ref-authors-toggle:hover{border-color:var(--link);text-decoration:underline}
/* Hanging-indent APA reference lists on articles and pages (glossary term/hub lists set their own rules in glossary.css).
Keep to the 28.4em paragraph measure so hanging-indented first lines stay under 80 characters. */
.article-layout .article-style ul.references-list:not(.term-references){margin:0 0 22px;padding:0;list-style:none;max-width:28.4em}
.article-layout .article-style ul.references-list:not(.term-references) li{margin:0 0 10px;padding-inline-start:1.5em;text-indent:-1.5em;list-style:none;overflow-wrap:anywhere}
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved
.article-layout .article-style ul.references-list:not(.term-references) li:last-child{margin-bottom:0}
/* Inline control that expands a shortened author list (layouts/partials/citations/authors.html). */
.ref-authors-toggle{display:inline;margin:0 .15em;padding:0;background:none;border:0;color:var(--link);font:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px;white-space:nowrap;cursor:pointer;vertical-align:baseline}
.ref-authors-toggle:hover{color:var(--ink)}
27 changes: 25 additions & 2 deletions assets/css/doors/popover.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Shared by citation and term popovers. Below the header, cookie banner and chat. */
.doors-popover{position:fixed;z-index:800;box-sizing:border-box;width:min(28rem,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;background:#fff;border:1px solid var(--line);border-radius:var(--r-small);box-shadow:0 8px 24px rgba(38,45,53,.18);padding:14px 36px 14px 16px;color:var(--ink);font:400 .95rem/1.5 var(--text)}
/* Shared by citation and term popovers. Above the chat launcher (900); below the header (1000), cookie banner and open chat (10000). */
.doors-popover{position:fixed;z-index:950;box-sizing:border-box;width:min(28rem,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;background:#fff;border:1px solid var(--line);border-radius:var(--r-small);box-shadow:0 8px 24px rgba(38,45,53,.18);padding:14px 36px 14px 16px;color:var(--ink);font:400 .95rem/1.5 var(--text)}
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved
.doors-popover{animation:popover-in 120ms ease}
.doors-popover-close{position:absolute;top:2px;right:2px;width:32px;height:32px;padding:0;background:none;border:0;color:var(--soft);font:inherit;font-size:1.3rem;cursor:pointer}
.doors-popover-close:hover,.doors-popover-close:focus{color:var(--ink)}
Expand All @@ -8,6 +8,29 @@
/* "Copied" is a state, not a link, and stays where "Copy reference" began (references.js). */
.popover-actions button.is-copied{text-decoration:none;text-align:start;color:var(--ink)}
.doors-popover :is(em,i){font-style:italic!important;font-weight:400}
/* Citation popover (Option B): compact APA body, quiet OA header row, surface footer toolbar. */
.doors-popover--citation{padding:0;border-radius:10px;box-shadow:0 10px 26px rgba(38,45,53,.16);overflow:hidden}
.cite-pop{display:flex;flex-direction:column;max-height:inherit}
.cite-pop-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 8px 0 14px}
.cite-oa{display:inline-flex;align-items:center;gap:6px;font-size:.82rem;font-weight:600;line-height:1.3}
.cite-oa-icon{width:14px;height:14px;flex-shrink:0}
.cite-oa--open{color:#1f5c38}
.cite-oa--green{color:var(--edu)}
.cite-oa--closed,.cite-oa--neutral{color:var(--soft)}
.cite-pop-close{position:relative;width:30px;height:30px;padding:0;border:0;border-radius:6px;background:none;color:var(--soft);font:inherit;font-size:1.25rem;line-height:1;cursor:pointer;display:grid;place-items:center;flex-shrink:0}
.cite-pop-close::after{content:"";position:absolute;inset:-7px}
.cite-pop-close:hover,.cite-pop-close:focus-visible{background:var(--surface);color:var(--ink)}
.cite-pop-body{padding:var(--box-pad);overflow-y:auto;overflow-wrap:anywhere;font-size:.93rem;line-height:1.5;color:var(--ink)}
.cite-pop-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;padding:9px 14px;background:var(--surface);border-top:1px solid var(--foot)}
.cite-pop-links{display:flex;align-items:center;flex-wrap:wrap;gap:12px}
.cite-link-primary{font-size:.86rem;font-weight:600;color:var(--link);text-decoration:underline;text-underline-offset:2px;white-space:nowrap}
.cite-link-primary:hover{color:var(--ink)}
.cite-link-secondary{font-size:.84rem;font-weight:600;color:var(--soft);text-decoration:underline;text-underline-offset:2px;white-space:nowrap}
.cite-link-secondary:hover{color:var(--ink)}
.cite-copy-btn{display:inline-flex;align-items:center;gap:5px;padding:4px 11px;background:#fff;border:1px solid var(--line);border-radius:999px;color:var(--ink);font:600 .82rem/1.4 var(--text);white-space:nowrap;cursor:pointer}
.cite-copy-btn:hover{border-color:var(--ink)}
.cite-copy-btn.is-copied{border-color:var(--edu);color:var(--edu)}
.cite-copy-icon{width:14px;height:14px;flex-shrink:0}
@keyframes popover-in{from{opacity:0}to{opacity:1}}
@media(max-width:599px){.doors-popover{width:calc(100vw - 32px)}}
@media(prefers-reduced-motion:reduce){.doors-popover{animation:none!important}}
Expand Down
3 changes: 2 additions & 1 deletion assets/js/doors/citation-matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function citationMatches(text, references) {
: String.raw`,\s*${escapeRE(name)}`).join('');
let others = full;
if (ref.etal) others = full ? String.raw`(?:\s+et\s+al\.?|${full})` : String.raw`\s+et\s+al\.?`;
const pattern = new RegExp(String.raw`(?<![\p{L}\p{M}\p{N}])${escapeRE(ref.first)}${others}(?:(?:,\s*|\s+)${escapeRE(ref.year)}|\s+\(${escapeRE(ref.year)}\))(?![\p{L}\p{N}])`, 'giu');
const locator = String.raw`(?:(?:,\s*|\s+)pp?\.\s*\d+(?:[–-]\d+)?)?`;
const pattern = new RegExp(String.raw`(?<![\p{L}\p{M}\p{N}])${escapeRE(ref.first)}${others}(?:(?:,\s*|\s+)${escapeRE(ref.year)}${locator}|\s+\(${escapeRE(ref.year)}${locator}\))(?![\p{L}\p{M}\p{N}])`, 'giu');
for (let match; (match = pattern.exec(text));) {
// A coauthor or the end of a longer surname is not the first author.
const before = text.slice(0, match.index);
Expand Down
Loading
Loading