Skip to content

Add more citation support#33081

Open
kyriv-lab wants to merge 6 commits into
idaholab:nextfrom
kyriv-lab:citations
Open

Add more citation support#33081
kyriv-lab wants to merge 6 commits into
idaholab:nextfrom
kyriv-lab:citations

Conversation

@kyriv-lab

@kyriv-lab kyriv-lab commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

This Pr resolves issue #22982 :

This PR enhances the MooseDocs bibtex extension, which renders citations on the MOOSE documentation website. Previously the extension supported only author-year inline citations and a static reference list. The PR adds two reader-facing capabilities and refines the documentation.

Numbered inline citation style. A new citation_style configuration option (author-year default, or number) controls how every in-text marker renders site-wide. In number mode, inline citations appear as bracketed numbers ([1], [2]) assigned in order of first appearance, and the reference list is reordered to match. This helps pages that cite many works by the same authors or year, where author-year labels collide. The textual/parenthetical distinction is preserved under both styles: !cite/!citet keep the author ("Slaughter et al. [1]" or "Slaughter et al. (2014)"), while !citep renders just the bracketed number ("[1]") or the parenthetical form ("(Slaughter et al., 2014)").

Citation export formats. Each entry in the reference list gains an [Export] modal offering the same citation in three machine-readable formats — BibTeX (for LaTeX), RIS (for Word/EndNote/Zotero/Mendeley), and plain text — so people who don't write in LaTeX can reuse MOOSE citations. Because pybtex has no RIS writer, RIS is produced by a hand-written bibtex_to_ris() with a BibTeX-to-RIS type map, preserving author name particles and suffixes. The three export blocks are each tagged with a language-* class so Prism wraps them consistently with a Copy button and contained side-scrolling (RIS and plain text use language-none, which gives the toolbar without syntax coloring).

Documentation. bibtex.md was updated so the !cite/!citep usage guidance lives in the Usage section (covering both styles) rather than buried in the configuration descriptions, the worked examples are clarified as rendering in the default author-year style used across the site, and a bare [1] was escaped to fix the doc build.

Testing and status. New tests in test_bibtex.py cover author-year rendering, the numbered style (textual, parenthetical, and reference ordering), RIS conversion (including LaTeX authors and name particles), and the export modal's three formats. The materialize gold fixture was regenerated to match. The bibtex page was built locally and verified against gold in both materialize and html forms; the work is committed and pushed to kyriv-lab/moose, with CIVET running.

kyriv-lab and others added 2 commits June 8, 2026 17:13
The bibtex extension previously rendered inline citations only in
author-year form, e.g. "Hansel et al. (2024)". On pages that cite many
works by the same authors or year, these labels are hard to tell apart
and difficult to match against the reference list.

Add a global 'citation_style' option to the bibtex extension. The
default, 'author-year', preserves the existing behavior exactly. Setting
it to 'number' renders inline citations as bracketed numbers, e.g.
"[1]", numbered in order of first citation, and reorders the reference
list to match so that "[1]" always points to the first entry.

Refs idaholab#22982

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The bibtex extension previously exposed only a "[BibTeX]" export in the
references list, which serves LaTeX authors but not the many users who
write in Microsoft Word or manage references with EndNote, Zotero, or
Mendeley.

Replace the per-entry "[BibTeX]" link with an "[Export]" modal that
offers three formats: BibTeX (unchanged), RIS, and a plain-text
reference string. RIS is the interchange format those non-LaTeX tools
import; pybtex provides no RIS writer, so the common fields are mapped
by hand.

Refs idaholab#22982

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kyriv-lab kyriv-lab requested a review from cticenhour as a code owner June 9, 2026 15:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fd0b6420f

ℹ️ 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".

Comment thread python/MooseDocs/extensions/bibtex.py Outdated
@kyriv-lab kyriv-lab force-pushed the citations branch 4 times, most recently from 2744a5e to de1257e Compare June 9, 2026 17:34
The RIS author export joined only last_names, dropping pybtex's
prelast_names and lineage_names. Entries such as "van Genuchten, M. Th."
were exported as "Genuchten, M. Th.", corrupting the metadata on import
into reference managers. Include the particle in the family name and
append the lineage as an RIS name suffix.

Refs idaholab#22982

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moosebuild

moosebuild commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Job Documentation, step Docs: sync website on 3a3078d wanted to post the following:

View the site here

This comment will be updated on new commits.

Comment thread python/doc/content/python/MooseDocs/extensions/bibtex.md Outdated
@moosebuild

Copy link
Copy Markdown
Contributor

Job Precheck, step Python: black format on fb30daa wanted to post the following:

Python black formatting

Your code requires style changes.

A patch was generated and copied here.

You can directly apply the patch by running the following at the top level of your repository:

curl -s https://mooseframework.inl.gov/docs/PRs/33081/black/black.patch | git apply -v

Alternatively, you can run the following at the top level of your repository:

black --config pyproject.toml --workers 1 .

In 'number' style, !cite/!citet now prepend the author (e.g. "Slaughter
et al. [1]") so textual citations read as part of the sentence, while
!citep renders just the bracketed number. Previously every command
produced a bare number, which reads poorly in running text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The numbered-citation paragraph contained a bare [1], which the MooseDocs
autolink extension resolves as a shortcut link to a page named "1",
matching many files and failing every documentation build. Wrap it in
backticks like the adjacent examples so it renders as literal text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moosebuild

moosebuild commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Job Coverage, step Generate coverage on 3a3078d wanted to post the following:

Framework coverage

Mutiple base shas were found when retrieving head reports:
343a8b4
cdafd92

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

@cticenhour cticenhour left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few adjustments to note.

Comment thread python/doc/content/python/MooseDocs/extensions/bibtex.md Outdated
Comment thread python/doc/content/python/MooseDocs/extensions/bibtex.md Outdated
Comment thread python/MooseDocs/extensions/bibtex.py
- Move the !cite/!citep textual-vs-parenthetical usage notes out of the
  Configuration section and into Usage, covering both author-year and
  number styles.
- Clarify that the citation examples render with the default author-year
  style used across the documentation website.
- Give the RIS and Plain Text export blocks a 'language-none' class so
  Prism wraps them in its toolbar (Copy button and overflow scrolling),
  matching the BibTeX block; update the materialize gold to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@moosebuild

Copy link
Copy Markdown
Contributor

Job CUDA public apps on 3a3078d : invalidated by @kyriv-lab

@moosebuild

Copy link
Copy Markdown
Contributor

Job Test, step Results summary on 3a3078d wanted to post the following:

Framework test summary

Compared against cdafd92 in job civet.inl.gov/job/3900932.

No change

Modules test summary

Compared against cdafd92 in job civet.inl.gov/job/3900932.

No change

@moosebuild

Copy link
Copy Markdown
Contributor

Job Framework 2 on 3a3078d : invalidated by @kyriv-lab

@moosebuild

Copy link
Copy Markdown
Contributor

Job Coverage, step Verify coverage on 3a3078d wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate framework coverage rate (required: 81.0%)

@moosebuild

Copy link
Copy Markdown
Contributor

Job Coverage on 3a3078d : invalidated by @kyriv-lab

@moosebuild

Copy link
Copy Markdown
Contributor

Job Coverage, step Verify coverage on 3a3078d wanted to post the following:

The following coverage requirement(s) failed:

  • Failed to generate framework coverage rate (required: 81.0%)

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.

3 participants