Skip to content

fix(foxaholic): preserve volume and chapter order when fetching novels with volumes - #2767

Open
7ui77 wants to merge 2 commits into
lnreader:masterfrom
7ui77:fix/madara-volume-chapter-order
Open

7ui77 wants to merge 2 commits into
lnreader:masterfrom
7ui77:fix/madara-volume-chapter-order

Conversation

@7ui77

@7ui77 7ui77 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes an issue where novels with multiple volumes/arcs on Madara WordPress sources (such as Foxaholic's strange-grief-wants-to-retire-the-weakest-hunters-hero-dream) had their chapter lists rendered out of order.

Previously, loadedCheerio(".wp-manga-chapter") was collected across all volumes and completely reversed with chapters.reverse(). When a novel listed volumes in ascending chronological order (Short Story -> Arc 1 -> ... -> Arc 11) but chapters inside each volume in descending order, reversing the entire flat list inverted the order of the volumes (putting Arc 11 at the beginning and Arc 1 at the end).

Changes

  • Detect whether volumes are ordered in ascending or descending order using volume title identifiers (Roman numerals, numbers), chapter numbers, or release dates.
  • Reverse chapters within each volume to ascending order while preserving the overall chronological volume sequence.
  • Re-index chapterNumber sequentially from 1 to N.
  • Bump Foxaholic's versionIncrements.

Checklist

  • Update version code if an existing plugin was modified
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (e.g. Closes #xyz)
  • Commit messages follow type(scope): description (e.g. feat(<generator>): add new source)

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The change affects chapter ordering across sources built from the shared Madara parser.

Fix the missing chapters and shared version bump before merging.

Findings

  1. P1 Chapters outside volumes disappear ▶
  2. P1 Other plugins miss the update ▶
  3. P2 Roman volumes stay backward ▶

Summary

The PR groups chapters by volume, chooses a volume direction from titles, chapter numbers, or dates, and assigns sequential chapter numbers.

  • Madara chapter lists keep volumes in order while sorting their chapters.

Reviews (1) · Last reviewed commit: "fix(madara): preserve volume and chapter..." · Reviewed by Greptile


const orderedRawChapters: Omit<Plugin.ChapterItem, 'chapterNumber'>[] = [];

if (volumeElements.length > 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Chapters outside volumes disappear

If a novel has both volume groups and ungrouped chapter siblings, finding any volume makes this branch collect only chapters inside those groups. The global chapter search runs only in the other branch, so ungrouped chapters disappear from the returned list. Keep those chapters in the result rather than making the two searches mutually exclusive.

"useNewChapterEndpoint": true,
"resolveCoverDataUri": true
"resolveCoverDataUri": true,
"versionIncrements": 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Other plugins miss the update

Only Foxaholic gets a new version, but every Madara plugin is generated from the changed template. The other plugins keep their existing versions despite receiving different chapter ordering and numbering code. Bump the shared version so existing installations of those plugins can receive this fix through normal updates.

Comment on lines +53 to +55
const romanMatch = title.match(
/(?:(?:vol(?:ume)?|arc|book|part|chapter|season|act|tome)\s+|^\s*)(XX|XIX|XVIII|XVII|XVI|XV|XIV|XIII|XII|XI|IX|X|VIII|VII|VI|IV|V|III|II|I)\b/i,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Roman volumes stay backward

extractVolumeNumber accepts Vol. 2 and Vol II, but not Vol. II: the Roman numeral branch requires whitespace immediately after the keyword. If ascending volumes use Vol. I and Vol. II, restart chapter numbers at 1, and have no release dates, both scores stay zero and the fallback reverses the volumes. Allow the optional period in the Roman numeral branch too.

Suggested change
const romanMatch = title.match(
/(?:(?:vol(?:ume)?|arc|book|part|chapter|season|act|tome)\s+|^\s*)(XX|XIX|XVIII|XVII|XVI|XV|XIV|XIII|XII|XI|IX|X|VIII|VII|VI|IV|V|III|II|I)\b/i,
);
const romanMatch = title.match(
/(?:(?:vol(?:ume)?|arc|book|part|chapter|season|act|tome)\.?\s+|^\s*)(XX|XIX|XVIII|XVII|XVI|XV|XIV|XIII|XII|XI|IX|X|VIII|VII|VI|IV|V|III|II|I)\b/i,
);

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@7ui77 7ui77 changed the title fix(madara): preserve volume and chapter order when fetching novels with volumes fix(foxaholic): preserve volume and chapter order when fetching novels with volumes Oct 24, 2026

This branch has not been deployed

No deployments
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.

1 participant