Skip to content

Mark bibliography entries as h-cite microformats - #257

Merged
dknauss merged 1 commit into
mainfrom
feat/hcite
Nov 6, 2026
Merged

dknauss merged 1 commit into
mainfrom
feat/hcite

Conversation

@dknauss

@dknauss dknauss commented Nov 6, 2026

Copy link
Copy Markdown
Owner

As a page renders, each bibliography entry now becomes an h-cite. IndieWeb tools (Webmention receivers, readers and other microformats parsers) can then read the bibliography as a list of citations.

Each one carries:

  • its title
  • each author as an h-card, linked to the author's ORCID iD when there is one; organizations get p-org
  • the date, to the precision the record has (2018, 2018-05 or 2018-05-14, never an invented month or day)
  • the DOI as https://doi.org/… (u-uid)
  • the URL
  • the journal or book it appears in (p-publication)
  • the publisher

The values sit in a hidden span of <data> elements built from the stored CSL-JSON, the same source as the JSON-LD and COinS. The visible entry, and what screen readers announce, don't change. Like the other render-time enrichments, save() is untouched (includes/microformats.php, priority 11), so there's no deprecation, and published posts get the markup without being re-saved. Feeds skip it, and the email output strips it. The new bibliography_builder_enrich_microformats filter turns it off.

This implements the "Microformats" item from SPEC.md's roadmap. The citations in #256 are already marked h-cite and point at these entries.

How it was checked

  • New MicroformatsTest (10 tests, 34 assertions). The full PHPUnit suite (723 tests), PHPCS and Psalm pass, and verify-metrics.sh is updated and passes.
  • I rendered a post in WordPress Playground (WP 7.1.4, PHP 8.3) and parsed it with php-mf2. Each entry came out as an h-cite with the expected name, authors (including a particle, an ORCID and an organization), date, uid/url, publication and publisher. The RSS feed had no microformats markup.
  • The start tag is read with a quote-aware regex, because WP_HTML_Tag_Processor can't insert markup and the PHPUnit bootstrap has no copy of it. CLAUDE.md notes this.

npm ci fails on main because package-lock.json is out of step with package.json (eslint 10 in the lock, 9 wanted). That's not this PR's doing, but it's worth fixing.

Merge order: this branch, #256 (citations) and the other new Borges PR touch the same docs (CHANGELOG.md, SPEC.md, README.md, readme.txt) and the line counts in docs/current-metrics.md. Whichever merges later needs a rebase and a re-run of verify-metrics.sh. No version is bumped, so merging releases nothing.


Generated by Claude Code

A render_block filter (includes/microformats.php) adds the class h-cite to
each entry's <li id="ref-…"> and, right after its start tag, a hidden span
of <data> elements built from the stored CSL: p-name, a p-author h-card per
author, dt-published, the DOI as u-uid u-url, the URL as u-url,
p-publication, and p-publisher. The visible text and save() are unchanged,
so no deprecation is needed and published posts get it without re-saving.
Feeds skip it and the email markup strips it. The
bibliography_builder_enrich_microformats filter turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.11321% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.47%. Comparing base (b11d72b) to head (a3de73d).

Files with missing lines Patch % Lines
includes/microformats.php 98.05% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #257      +/-   ##
============================================
+ Coverage     89.38%   89.47%   +0.08%     
  Complexity       67       67              
============================================
  Files            94       95       +1     
  Lines         10303    10409     +106     
  Branches        816      816              
============================================
+ Hits           9209     9313     +104     
- Misses          410      412       +2     
  Partials        684      684              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dknauss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T15:06:35.034491Z a3de73d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: a3de73d80c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dknauss
dknauss merged commit b3ef682 into main Nov 6, 2026
22 checks passed
@dknauss
dknauss deleted the feat/hcite branch November 6, 2026 15:26
@dknauss dknauss mentioned this pull request Nov 6, 2026
dknauss added a commit that referenced this pull request Nov 7, 2026
In-text and margin citations with Update citations after a style change
(#256); annotated bibliographies (#258); h-cite microformats (#257); full
citation records in Yoast SEO's graph and Yoast context fix (#252, #254);
RIS journal abbreviations; sentence case in Harvard; the Playground demo
example of citations and annotations (#259).


Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants