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
1 change: 1 addition & 0 deletions .github/scripts/verify-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ actual_php="$(find . -name '*.php' \
-not -path './tests/*' \
-not -path './packages/*' \
-not -path './scripts/*' \
-not -path './playground/*' \
-not -path './output/*' \
-not -path './build/*' \
-print0 | xargs -0 wc -l | tail -1 | awk '{print $1}')"
Expand Down
2 changes: 1 addition & 1 deletion .wordpress-org/blueprints/blueprint.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Three matching read-only abilities on WordPress 6.9+, with the same `edit_post` requirement: `borges/validate-bibliography`, `borges/find-duplicate-citations`, and `borges/preview-bibliography-style`. Each takes `post_id` and either `index` or `bibliography_id`.
- Stable IDs (Phase 05, Tier 0). The read-only REST collection and single-bibliography routes, and the `borges/get-bibliographies` ability, now report each block's `bibliographyId`, a UUID that stays put when blocks before it are added or removed, as the future write routes will need. It is `null` for a block saved before IDs were assigned (or with an unusable value) until the post is next edited. Every citation already carried an `id`; the editor now guarantees one, unique within its block.

- The Playground demos (release, main build, and WordPress.org Preview) open on a demo page with copy-ready samples of every accepted input format, an empty Bibliography block to paste them into, brief notes on the key features, and three example bibliographies (Chicago notes-bibliography with Cite / Export, APA 7, IEEE). The Welcome Guide no longer covers the page. The page is defined once in `playground/demo-content.json` and `playground/demo-content.php`, and `npm run playground:build` writes it into every Blueprint.

### Fixed

- A bibliography block no longer opens as invalid ("Attempt Block Recovery") when an editor using a different language from the one who saved it opens the post. `save()` used to write the Cite / Export labels ("Cite / Export", "Copy citation", "Copied", "RIS", "CSL-JSON", "BibTeX", "BibLaTeX") and the "Link to publication" link label into post content in the saving editor's language. The editor checks saved markup against `save()` in the *current* editor's language, so the two did not match. Saved markup is now the same in every language: the panel labels are stored in English and translated for visitors on the server as the block renders (`includes/frontend-labels.php`, a `render_block` filter), so they are translated without JavaScript and the view script loads no `wp-i18n`, and a link whose citation has no title or container title carries no `aria-label`, so screen readers announce its visible URL. Existing posts still validate in any language, because the new deprecation reads the labels back from the saved markup. The exception is blocks saved in the oldest markup shapes (before the biblioentry role was removed) that contain a linked URL in a citation with no title or container title: those still validate only in the language they were saved in, as before. They switch to the new markup the next time they are saved. The PHP port of `save()` (`includes/save-markup.php`) matches.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ A Gutenberg block plugin that accepts DOI identifiers, PubMed/PMID records, BibT

### Playground

The Playground blueprint at `playground/blueprint.json` configures the GitHub/readme demo (released version). It installs the latest GitHub Release ZIP through the WordPress Playground CORS proxy, installs Block Accessibility Checks from WordPress.org, and requires both `"phpExtensionBundles": ["kitchen-sink"]` and `features.intl` for the CSL formatter. A second blueprint at `playground/blueprint-main.json` powers the README "Main build" badge: it installs the `main-preview` rolling pre-release ZIP that CI's `publish-main-preview` job refreshes on every push to `main` — after the full CI suite passes and only when the commit is still `main`'s tip (live Playground can't use `git:directory`, so a stable release asset is how main HEAD boots). The WordPress.org Preview blueprint at `.wordpress-org/blueprints/blueprint.json` is separate; WordPress.org installs Borges automatically there. The E2E tests (`npm run test:e2e:playground`) run against the GitHub/readme blueprint.
The Playground blueprint at `playground/blueprint.json` configures the GitHub/readme demo (released version). It installs the latest GitHub Release ZIP through the WordPress Playground CORS proxy, installs Block Accessibility Checks from WordPress.org, and requires both `"phpExtensionBundles": ["kitchen-sink"]` and `features.intl` for the CSL formatter. A second blueprint at `playground/blueprint-main.json` powers the README "Main build" badge: it installs the `main-preview` rolling pre-release ZIP that CI's `publish-main-preview` job refreshes on every push to `main` — after the full CI suite passes and only when the commit is still `main`'s tip (live Playground can't use `git:directory`, so a stable release asset is how main HEAD boots). The WordPress.org Preview blueprint at `.wordpress-org/blueprints/blueprint.json` is separate; WordPress.org installs Borges automatically there. All three open post 1 as a demo page that is generated, not hand-edited: edit `playground/demo-content.json` / `demo-content.php`, then run `npm run playground:build` (`src/playground-demo.test.js` fails on stale blueprints). The E2E tests (`npm run test:e2e:playground`) run against the GitHub/readme blueprint.

### Release

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Install the public release from [WordPress.org](https://wordpress.org/plugins/bo
- **[Try the released version](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/dknauss/Borges/main/playground/blueprint.json)** — installs the latest GitHub Release ZIP (the same build published to WordPress.org) through the WordPress Playground CORS proxy. Use this to try the current stable plugin.
- **[Try the current main build](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/dknauss/Borges/main/playground/blueprint-main.json)** — installs the development build of the `main` branch from the rolling `main-preview` pre-release, which CI refreshes on every push to `main`. Use this to preview unreleased changes ahead of the next release; it is not a stable build.

Every demo opens the block editor on a ready-made demo page, with the Welcome Guide out of the way:

- Copy-ready samples of every accepted input: DOIs (bare, `doi:`, and doi.org links), PMIDs, PMCIDs, arXiv IDs (modern, legacy, arxiv.org links, and arXiv DOIs), ISBN-13 and ISBN-10, BibTeX and BibLaTeX entries, and formatted book, article, chapter, and webpage citations. An empty Bibliography block waits below them.
- Short notes on the key features: styles, editing, manual entry, duplicates, ordering, exports, per-entry Cite / Export, machine-readable output, and the REST data.
- Three example bibliographies: Chicago notes-bibliography with Cite / Export, APA 7, and IEEE. These need a release with the PHP port of `save()` (1.7.0 or later); older releases show a note in their place.

Both demo Blueprints explicitly request PHP `intl` support because editor-time CSL formatting runs through the plugin's local PHP formatter. The WordPress.org Preview blueprint is separate; WordPress.org installs Borges automatically there, and the blueprint only seeds demo content and auxiliary plugin setup.

## Screenshots
Expand Down Expand Up @@ -357,7 +363,9 @@ The Playground demos and WordPress.org Preview all rely on the PHP formatter use
- `.wordpress-org/blueprints/blueprint.json` deploys to WordPress.org SVN as `assets/blueprints/blueprint.json` for the plugin-directory Preview button. WordPress.org installs the plugin automatically in that preview, so this blueprint does not install Borges itself.
- All three files intentionally declare `phpExtensionBundles: ["kitchen-sink"]` and `features: { "networking": true, "intl": true }`. The bundle form follows WordPress.org Preview documentation; the `features.intl` flag is required by the live browser Playground runtime so formatter requests do not fall back with `bibliography_builder_formatter_extension_missing`.

Run `npm run test -- --runTestsByPath src/blueprint.test.js` after editing any Blueprint.
The demo page is defined once, in `playground/demo-content.json` (samples, feature notes, example bibliographies) and `playground/demo-content.php` (the script that writes post 1 and turns off the Welcome Guide). Blueprints cannot load repository files, so `npm run playground:build` inlines both into each Blueprint's `runPHP` step; edit those two files, not the Blueprints' `runPHP` code. The example bibliographies are formatted by the plugin's own formatter and rendered by its PHP port of `save()` at boot, so they validate against whichever version the demo installs.

Run `npm run test -- --runTestsByPath src/blueprint.test.js src/playground-demo.test.js` after editing any Blueprint or the demo content. The second file fails if a Blueprint is stale, if a sample stops reaching the parser backend it claims, or if an example's stored export strings drift from what the editor computes.

### Plugin File Structure

Expand Down
2 changes: 1 addition & 1 deletion docs/current-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Source and LOC figures last verified: **2026-09-25** against the locale-independ
| Metric | Value | Re-derivation command |
|---|---|---|
| Main plugin file (`bibliography-builder.php`) | **1,978** | `wc -l bibliography-builder.php` |
| All first-party PHP (excl. vendor, tests, scripts, packages, output, node_modules, generated `build/`) | **6,428** | `find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -not -path './tests/*' -not -path './packages/*' -not -path './scripts/*' -not -path './output/*' -not -path './build/*' -print0 \| xargs -0 wc -l \| tail -1` |
| All first-party PHP (excl. vendor, tests, scripts, playground, packages, output, node_modules, generated `build/`) | **6,428** | `find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -not -path './tests/*' -not -path './packages/*' -not -path './scripts/*' -not -path './playground/*' -not -path './output/*' -not -path './build/*' -print0 \| xargs -0 wc -l \| tail -1` |
| JS source (`src/`, excl. `*.test.js`) | **9,956** | `find ./src -name '*.js' -not -name '*.test.js' -print0 \| xargs -0 wc -l \| tail -1` |
| Shipped frontend runtime (`build/view.js`, minified) | **1,449 bytes** | `npm run build` then `wc -c < build/view.js` |

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"assets:screenshots": "node scripts/capture-screenshots.js",
"assets:icons": "node scripts/generate-icons.js",
"assets:banners": "python3 scripts/generate_brand_assets.py",
"assets:banners:quick": "python3 scripts/generate_brand_assets.py --skip-render"
"assets:banners:quick": "python3 scripts/generate_brand_assets.py --skip-render",
"playground:build": "node ./scripts/build-playground-blueprints.js"
},
"jest": {
"testEnvironment": "jsdom",
Expand Down
12 changes: 9 additions & 3 deletions playground/blueprint-main.json

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions playground/blueprint.json

Large diffs are not rendered by default.

Loading
Loading