Repository navigation
🐛 5e: emit citation text for non-monster notes - #989
Open
dramamoose wants to merge 1 commit into
Open
dramamoose wants to merge 1 commit into
dramamoose wants to merge 1 commit into
Conversation
{@cite} renders a link to a block id defined by the citation text, but
the collected citation text was only written for monster spellcasting.
For all other notes it was discarded ("left unreferenced citations
behind"), leaving dead links.
Append collected citations to the body text of book/adventure chapters,
tables, feats, spells, items and subclasses.
Resolves ebullient#988
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: dramamoose <dramamoose@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #988
Problem
{@cite Name|Source|marker}is rendered byhandleCitationas a link to a block id ([*](#^citation-…)), and the citation text (which defines that block id) is stashed inParseState. The stash is only drained bypopCitations, which is only called for monster spellcasting (Json2QuteMonster).For every other note type the citation text is never written. It is discarded when the outermost parse state is popped, which logs:
…and the generated note is left with a dead
[*](#^citation-…)link.Example: Hit Point Press' Humblewood Tales marks new items/spells with
{@cite New Humblewood Content|HumblewoodTales|*}in its shop inventory tables, feats, subclass spell lists, and adventure chapters.Fix
Add
appendCitations(List<String> text)toJsonTextReplacement. It pops any collected citations and appends them (blank-line separated) to the end of the note body. Call it where note body text is assembled for the types whose data uses{@cite}:Json2QuteBook)Json2QuteTable)The output format is the existing
popCitationsformat, so these notes match how monster spellcasting citations already render. Monster handling is unchanged.I didn't use a single generic hook, such as flushing at the end of the outermost
appendToText.flattenToStringrenders table cells through a top-levelappendToText, so that approach would put citation text inside table cells.Verification
I converted 5eTools v2.41.0 plus homebrew (including Humblewood Tales and Flee, Mortals!) with 3.3.9 and with this branch, then diffed the output:
#^citation-…link with no matching block id: 13 → 0./mvnw testwith live 5eTools, homebrew and UA data: 214 run, 0 failures (1 skipped).Example (
tables/cathus-inventory-humblewoodtales.md), appended after the table:The
[key]: textprefix comes from the existingpopCitationsformat, and the raw key shows up as visible text. I left it alone so these notes stay consistent with monsters, but I'm happy to change both if you'd prefer a nicer label.Not covered:
{@cite}in legendary groups, monster fluff, and item properties (one or two uses each in the homebrew repo). Those still log the error.🤖 Generated with Claude Code