Skip to content

Commit f3c3352

Browse files
authored
Merge pull request #23 from dknauss/codex/fix-pmid-rest-proxy
[codex] Fix PMID imports via REST proxy
2 parents 49a6e7d + 77f77a9 commit f3c3352

17 files changed

Lines changed: 746 additions & 100 deletions

.planning/ROADMAP.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,29 @@ Deferred / demand-gated:
123123

124124
These exports complement the existing metadata-output toggles by giving users tangible bibliography data files they can download and reuse directly.
125125

126+
## Identifier input and metadata-resolution backlog
127+
128+
Future identifier support should be implemented as a resolver layer, not as
129+
format-specific parser hacks. Each resolver must validate the identifier before
130+
making outbound requests, use fixed upstream hosts or vetted provider adapters,
131+
avoid SSRF-prone arbitrary URL fetches, normalize results to CSL-JSON, and keep
132+
CSL-JSON as the source of truth for save output, exports, JSON-LD, COinS, and
133+
CSL-JSON script blocks.
134+
135+
| Identifier | Status | Evaluation |
136+
| --- | --- | --- |
137+
| **ISBN-10 / ISBN-13** | Planned support | High-value next book/monograph importer. Accept `ISBN:` prefixes plus bare, hyphenated, or spaced ISBNs; validate ISBN-10/ISBN-13 checksums before lookup; evaluate metadata providers and terms before choosing a resolver. |
138+
| **PMCID** | Planned support | Strong biomedical follow-up to PMID. Resolve through the same authenticated WordPress REST proxy pattern; prefer NCBI-derived CSL/PMID/DOI metadata when available. |
139+
| **arXiv ID** | Planned support | High-value scholarly preprint importer. Accept modern and legacy arXiv identifiers; resolve through arXiv metadata APIs; map to CSL article/report-ish records while preserving DOI/journal data when present. |
140+
| **ISSN** | Evaluate | Identifies a serial, not a specific cited work. Useful for journal/periodical enrichment and validation, but should not create a standalone bibliography entry unless paired with article-level metadata. |
141+
| **URL** | Evaluate | Useful but risky and unreliable. Consider after fixed-host identifiers; require strict timeout, content-type, size, redirect, and allowlist/denylist controls; prefer standards-based metadata (`citation_*`, Open Graph, JSON-LD, COinS) over arbitrary scraping. |
142+
| **OCLC / WorldCat** | Evaluate | Useful for library/book workflows and edition disambiguation. Needs API/access/licensing review and careful mapping from edition/work records to CSL `book`. |
143+
| **ORCID** | Evaluate as enrichment only | Identifies people, not publications. Useful for author enrichment and disambiguation in manual/resolved records, but not a standalone citation import path. |
144+
| **ISRC** | Evaluate niche media support | Identifies sound recordings. Could map to CSL `song`/audio records if a reliable resolver is available; lower priority than scholarly text identifiers. |
145+
| **ISWC** | Evaluate niche media support | Identifies musical works/compositions. Potentially useful for music scholarship; resolver availability and CSL mapping need investigation. |
146+
| **ISAN** | Evaluate niche media support | Identifies audiovisual works. Could support film/media bibliographies; requires resolver and CSL `motion_picture`/broadcast mapping review. |
147+
| **EIDR** | Evaluate niche media support | Identifies movies/TV and related audiovisual assets. Similar to ISAN; useful for media studies if resolver access and metadata quality are acceptable. |
148+
126149
## Performance hardening track
127150

128151
Grounded in the 2026-04-04 Xdebug/profile review:

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ No changes yet.
1414
### Added
1515

1616
- BibLaTeX export is available from the editor exports panel for LaTeX/Biber workflows with full Unicode support.
17-
- PMID input resolution imports PubMed records through the NCBI Literature Citation Export API.
17+
- PMID input resolution imports PubMed records through the authenticated WordPress REST proxy to the NCBI/PMC Literature Citation Exporter API.
1818
- Numeric citation styles now support manual reordering, including visible move controls and keyboard Alt+Arrow movement.
1919
- New bibliography blocks get style-aware default headings.
2020

@@ -23,15 +23,18 @@ No changes yet.
2323
- Citation mutations now reformat the full bibliography so cached display text, sort order, and metadata stay aligned after edits, deletes, style changes, and structured updates.
2424
- Sorting now uses explicit style-family dispatch, author-date solo-first ordering, contributor-chain tie-breaks, and numeric no-op ordering where appropriate.
2525
- OSCOLA users now see an editor notice explaining the current single-list limitation for grouped bibliographies.
26+
- Readmes and release notes now highlight the 1.2.0 interoperability features, recent 1.1.x accessibility fixes, and ABNT (Associação Brasileira de Normas Técnicas) support targeting NBR 6023:2018.
2627

2728
### Fixed
2829

30+
- PMID resolution now uses an authenticated WordPress REST proxy so PubMed imports work in browsers despite NCBI's missing CORS headers.
2931
- Saved citation URL links and block toolbar controls now expose clearer accessible names.
3032
- Playwright accessibility and Playground smoke tests are more deterministic on GitHub Actions by selecting the block explicitly and serializing tests that share one Playground server.
3133

3234
### Internal
3335

3436
- Added JS/PHP sort-coordination fixtures, citeproc cross-runner conformance checks, targeted Codecov warning coverage, and locale/lock parity audit tests.
37+
- Added compact matrix tests for all nine style save semantics, all nine formatter outputs, export ordering for author-date versus numeric styles, and PMID REST proxy regression coverage before tagging 1.2.0.
3538

3639
## [1.1.1] - 2026-05-07
3740

@@ -81,7 +84,7 @@ No changes yet.
8184
- DOI and BibTeX input parsing via citation-js.
8285
- Supported formatted citation input for books, articles, chapters, webpages, reviews, and theses.
8386
- Manual entry with structured fields and per-type validation.
84-
- Nine citation styles: Chicago Notes-Bibliography (default), Chicago Author-Date, APA 7, MLA 9, Harvard, Vancouver, IEEE, OSCOLA, and ABNT.
87+
- Nine citation styles: Chicago Notes-Bibliography (default), Chicago Author-Date, APA 7, MLA 9, Harvard, Vancouver, IEEE, OSCOLA, and ABNT (Associação Brasileira de Normas Técnicas) targeting NBR 6023:2018.
8588
- Automatic alphabetical sorting per style rules.
8689
- Duplicate detection across paste and manual entry.
8790
- Static save with semantic HTML (`role="doc-bibliography"`, `<cite>` wrappers, `lang` attributes, and no deprecated bibliography-entry ARIA role in newly saved output).
@@ -137,4 +140,4 @@ No changes yet.
137140
- The PHPUnit `wp_strip_all_tags()` stub now matches WordPress behavior and no longer collapses whitespace, exposing plain-text rendering bugs more accurately.
138141
- `jsonld.js` now maps chapter citations with a container title to `isPartOf: { @type: "Book" }`, and maps `review-book` to `Review`.
139142
- `coins.js` now emits dissertation-specific COinS metadata for thesis citations instead of falling back to the journal format.
140-
- ABNT formatter normalization now collapses duplicate page markers such as `p. p.` and `p. pp.`.
143+
- ABNT/NBR 6023:2018 formatter normalization now collapses duplicate page markers such as `p. p.` and `p. pp.`.

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
Named for Jorge Luis Borges (1899–1986), the Argentine writer, essayist, poet, and librarian whose work imagined infinite libraries, invented books, and labyrinths of reference, Borges Bibliography Builder brings that bibliographic spirit to WordPress.
1414

15-
The plugin transforms pasted scholarly references — DOI numbers/URLs, BibTeX entries, and supported formatted citations — into a semantically rich, auto-sorted bibliography with static saved output. Export your work as CSL-JSON, BibTeX, and RIS for Zotero, Mendeley, EndNote, JabRef, BibDesk, and similar tools.
15+
The plugin transforms pasted scholarly references — DOI numbers/URLs, PubMed/PMID identifiers, BibTeX entries, and supported formatted citations — into a semantically rich, auto-sorted bibliography with static saved output. Export your work as CSL-JSON, BibTeX, BibLaTeX, and RIS for Zotero, Mendeley, EndNote, JabRef, BibDesk, and similar tools.
1616

1717
No shortcodes. No database storage. Static HTML output survives plugin deactivation.
1818

19-
Just write out your citations or paste DOIs and BibTeX code, up to 50 at a time. Easily build a formatted, auto-sorted bibliography in any style.
19+
Just write out your citations or paste DOIs, PubMed/PMID identifiers, and BibTeX code, up to 50 at a time. Easily build a formatted, auto-sorted bibliography in any supported style.
2020

2121
## Try it in WordPress Playground
2222

@@ -34,14 +34,14 @@ Install the public release from [WordPress.org](https://wordpress.org/plugins/bo
3434
| Block inserter | Empty-state form | Manual entry |
3535
|---|---|---|
3636
| ![](.wordpress-org/screenshot-3.png) | ![](.wordpress-org/screenshot-4.png) | ![](.wordpress-org/screenshot-5.png) |
37-
| Discover the Bibliography block in the block inserter by searching for "Bibliography." | Paste DOIs, BibTeX entries, or supported citation text into the import form. The sidebar controls citation style, visible heading, and metadata output (JSON-LD, COinS, CSL-JSON). | Switch to Manual Entry to build a citation field by field: Publication Type, Author, Title, Container, Publisher, Year, Pages, DOI, and URL. These fields will be automatically populated from DOIs and pasted input that can be parsed. |
37+
| Discover the Bibliography block in the block inserter by searching for "Bibliography." | Paste DOIs, PubMed/PMID identifiers, BibTeX entries, or supported citation text into the import form. The sidebar controls citation style, visible heading, and metadata output (JSON-LD, COinS, CSL-JSON). | Switch to Manual Entry to build a citation field by field: Publication Type, Author, Title, Container, Publisher, Year, Pages, DOI, and URL. These fields will be automatically populated from DOIs, PubMed/PMID records, and pasted input that can be parsed. |
3838

3939
## Installation
4040

4141
1. Upload the plugin files to `/wp-content/plugins/borges-bibliography-builder/`, or install directly through the WordPress plugin screen.
4242
2. Activate the plugin through the **Plugins** screen in WordPress.
4343
3. Add the **Bibliography** block to any post or page.
44-
4. Paste DOI(s), BibTeX entries, or supported citations.
44+
4. Paste DOI(s), PubMed/PMID identifiers, BibTeX entries, or supported citations.
4545

4646
## Compatibility
4747

@@ -51,30 +51,36 @@ Install the public release from [WordPress.org](https://wordpress.org/plugins/bo
5151

5252
Developer-facing CI/runtime coverage details are listed in the development section below.
5353

54+
## Recent Release Highlights
55+
56+
- **1.2.0** — Adds PubMed/PMID import through an authenticated REST proxy, BibLaTeX export, manual reordering for numeric styles, full-bibliography reformat parity, and compact matrix coverage across all nine styles.
57+
- **ABNT / NBR 6023:2018** — Brazilian bibliography output is available as **ABNT (Associação Brasileira de Normas Técnicas)** with `pt-BR` defaults and the `Referências` heading.
58+
- **1.1.x accessibility** — Adds optional Block Accessibility Checks integration and restores visible keyboard focus on editor row actions.
59+
5460
## Features
5561

56-
- **Multiple input paths** — Add bare DOIs, DOI URLs, BibTeX entries, and supported formatted citations.
57-
- **Nine citation styles** — Chicago Notes-Bibliography by default, with Chicago Author-Date, APA 7, Harvard, Vancouver, IEEE, MLA 9, OSCOLA, and ABNT selectable.
62+
- **Multiple input paths** — Add bare DOIs, DOI URLs, PubMed/PMID records, BibTeX entries, and supported formatted citations.
63+
- **Nine citation styles** — Chicago Notes-Bibliography by default, with Chicago Author-Date, APA 7, Harvard, Vancouver, IEEE, MLA 9, OSCOLA, and **ABNT (Associação Brasileira de Normas Técnicas / NBR 6023:2018)** selectable.
5864
- **Structured editing** — Plain-text editing plus per-field editing for heuristic or warning-marked citations.
5965
- **Semantic output**`role="doc-bibliography"`, `<cite>` wrappers, `lang` attributes, and hanging-indent styling without deprecated bibliography-entry ARIA roles.
6066
- **JSON-LD** — Schema.org structured data for search engines, AI systems, and semantic consumers (on by default).
6167
- **COinS** — Optional OpenURL spans for browser-based citation manager detection, especially Zotero and legacy OpenURL workflows.
6268
- **CSL-JSON output** — Optional machine-readable metadata for citation-manager, citeproc, and scholarly-service interoperability.
63-
- **Export** — Download the current bibliography as CSL-JSON, UTF-8 BibTeX, or RIS; copy individual citations or the full bibliography as plain text.
69+
- **Export** — Download the current bibliography as CSL-JSON, UTF-8 BibTeX, BibLaTeX, or RIS; copy individual citations or the full bibliography as plain text.
6470
- **Static save** — Bibliography HTML and metadata are baked into post content at save time.
6571
- **Accessible editor UX** — Focus management, block-local Gutenberg notices, keyboard escape/cancel flows, and row action controls.
6672
- **Translation-ready interface** — strings use the `borges-bibliography-builder` text domain; WordPress.org publishes language packs as community translations are approved. (See **Language Support** below.)
6773

6874
## Reference Manager Compatibility
6975

70-
Borges is reference-manager-friendly by design. It outputs portable CSL-JSON, BibTeX, RIS, DOI links, Schema.org JSON-LD, and optional COinS metadata so your bibliographies can be imported directly into the most widely used bibliography management and academic publishing software.
76+
Borges is reference-manager-friendly by design. It outputs portable CSL-JSON, BibTeX, BibLaTeX, RIS, DOI links, Schema.org JSON-LD, and optional COinS metadata so your bibliographies can be imported directly into the most widely used bibliography management and academic publishing software.
7177

7278
| Tool or workflow | How Borges supports it |
7379
|---|---|
7480
| **Zotero** | Strong compatibility through DOI links, BibTeX, RIS, CSL-JSON, and optional COinS metadata. Tested with the [@zotero](https://github.com/zotero) SaaS, macOS app, and Chrome browser extension from [@digitalscholar](https://github.com/digitalscholar). |
7581
| **Mendeley** | Compatible with Elsevier's [@Mendeley](https://github.com/Mendeley) SaaS, macOS app, and Chrome browser extension through BibTeX/RIS exports; DOI-backed entries are also browser-importer friendly. Use export/copy actions for non-DOI entries rather than relying on extension autodetection. |
7682
| **EndNote** | Compatible through RIS and BibTeX imports. EndNote XML is deferred as a Borges export format unless user feedback and/or future testing show a practical gap that RIS and BibTeX do not cover. |
77-
| **JabRef, BibDesk, LaTeX** | Compatible through UTF-8 BibTeX exports; BibLaTeX support is on the roadmap. |
83+
| **JabRef, BibDesk, LaTeX** | Compatible through UTF-8 BibTeX and BibLaTeX exports for BibTeX/Biber and LaTeX-family workflows. |
7884
| **CSL / citeproc tools** | Compatible through CSL-JSON, which is the plugin's canonical structured data model. |
7985

8086
## Language Support
@@ -89,6 +95,7 @@ This repository/package currently includes seed PO/MO files for translator revie
8995

9096
- **Bare DOI**`10.1000/xyz123`
9197
- **DOI URL**`https://doi.org/10.1000/xyz123`
98+
- **PubMed/PMID**`PMID:26673779` or `pmid:26673779`, resolved through the authenticated WordPress REST proxy
9299
- **BibTeX**`@article{key, title={...}, ...}`
93100

94101
### Supported Formatted Citation Coverage
@@ -155,15 +162,29 @@ GET /wp-json/bibliography/v1/posts/<post_id>/bibliographies/<index>
155162

156163
The separate editor-only formatter endpoint accepts `POST /wp-json/bibliography/v1/format`, requires `edit_posts`, and returns formatted citation text for submitted CSL-JSON. It does not save changes.
157164

165+
The editor-only PubMed resolver accepts `GET /wp-json/bibliography/v1/pmid/<pmid>`, requires `edit_posts`, validates the PMID as numeric input, and returns normalized CSL-JSON from the fixed NCBI/PMC citation exporter endpoint. It is used for pasted `PMID:` input and does not persist citations by itself.
166+
158167
## External Services
159168

160-
This plugin connects to the [CrossRef REST API](https://api.crossref.org/) when you paste a DOI to resolve citation metadata. No account or API key is required. Requests are made only when you explicitly add a DOI in the block editor — no data is sent automatically or in the background.
169+
This plugin connects to fixed scholarly metadata services only when you explicitly add an identifier in the block editor — no citation data is sent automatically or in the background. No account or API key is required for the supported DOI or PMID lookups.
170+
171+
### DOI metadata
172+
173+
DOI input connects to the [CrossRef REST API](https://api.crossref.org/) to resolve citation metadata.
161174

162175
- [CrossRef](https://www.crossref.org/)
163176
- [CrossRef REST API documentation](https://api.crossref.org/swagger-ui/index.html)
164177
- [CrossRef privacy policy](https://www.crossref.org/privacy/)
165178
- [CrossRef terms of service](https://www.crossref.org/terms/)
166179

180+
### PubMed/PMID metadata
181+
182+
PubMed/PMID input connects through the plugin's authenticated WordPress REST proxy to the [NCBI/PMC Literature Citation Exporter](https://pmc.ncbi.nlm.nih.gov/api/ctxp/) CSL endpoint. The proxy uses a fixed upstream host and validates the PMID before making the outbound request.
183+
184+
- [NCBI APIs](https://www.ncbi.nlm.nih.gov/home/develop/api/)
185+
- [NCBI/PMC Literature Citation Exporter](https://pmc.ncbi.nlm.nih.gov/api/ctxp/)
186+
- [NLM Web Policies](https://www.nlm.nih.gov/web_policies.html)
187+
167188
## Development
168189

169190
Requires Node.js 18+, npm 9+, and Composer.

0 commit comments

Comments
 (0)