Skip to content

Fix bibliography formatting for DOI-only citations - #52

Open
edmundmiller wants to merge 2 commits into
feat/citation-formatting-improvementsfrom
claude/beautiful-fermi-silds0
Open

edmundmiller wants to merge 2 commits into
feat/citation-formatting-improvementsfrom
claude/beautiful-fermi-silds0

Conversation

@edmundmiller

Copy link
Copy Markdown
Contributor

Summary

Fixes bibliography formatting to properly identify DOI-only citation entries by tool name, while preserving author-led formatting for entries with full publication metadata. This addresses the issue raised in PR #51 where DOI-only citations were rendered anonymously.

Changes

  • Bibliography formatter logic (NfcoreCitationUtils.formatBibliographyFromData):

    • Restructured to check for presence of publication object first, rather than DOI presence
    • When a publication object exists (author, year, title, source), render as author-led academic reference: "Author. (year). title. source. doi: link"
    • When no publication object exists, identify the entry by tool name and link via DOI or homepage: "toolname. doi: link" or "toolname. url"
    • Removed redundant field guards; the publication object is now treated as all-or-nothing per the meta-schema
  • Test coverage (NfcoreCitationUtilsTest):

    • Added new test case "DOI-only entries are named by tool, publication entries are author-led" to verify the two formatting paths
    • Validates that DOI-only entries (e.g., bowtie2) are identified by tool name
    • Validates that entries with publication metadata (e.g., bwa) are author-led and do not inject the tool name
  • Snapshot updates:

    • Updated validation snapshots to reflect the corrected bibliography output where DOI-only tools are now properly named

Implementation Details

This change aligns with ADR-0002 (structured citations and MultiQC rendering) by ensuring the interim HTML-string output is correct while the migration to structured CSL-JSON output is underway. The fix ensures that the current bibliography rendering is consistent and unambiguous: entries with full publication metadata follow academic citation style, while entries with only a DOI or homepage are identified by tool name to avoid anonymous references.

https://claude.ai/code/session_015EvrftaVNPDUPvdubjHepF

claude added 2 commits June 23, 2026 15:52
formatBibliographyFromData()'s DOI branch dropped the old
`title ?: toolName` fallback, so meta.yml entries with a DOI but no
publication.title produced anonymous bibliography entries (e.g.
`<li>doi: ...</li>`) with no way to tell which tool they referenced.

Restore the tool-name fallback in the title position and add a Spock
spec covering the DOI-without-title and DOI-only cases. Regenerate the
affected citations-on-the-fly and topic-channel-citations validation
snapshots to reflect the now-named entries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EvrftaVNPDUPvdubjHepF
…ranches

Per maintainer feedback, the meta-schema treats `publication` as
all-or-nothing, so the previous `title ?: toolName` fallback was the
wrong shape. Key the formatter on publication presence instead:

- publication present -> author-led academic reference
  (Author. (year). title. source. doi: link)
- no publication     -> identify by tool name (toolName. doi: link)

This fixes the original regression (bare-DOI tools rendered anonymously
now carry the tool name) without injecting the tool name into entries
that already have an author. Lightweight field guards remain so the
partial publications still present in some modules degrade cleanly.

Update the spec to assert the two-branch contract and the
citations-on-the-fly snapshot (only the bare-DOI multiqc entry changes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EvrftaVNPDUPvdubjHepF
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