Repository navigation
Conversation
[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. FindingsSummaryThe PR groups chapters by volume, chooses a volume direction from titles, chapter numbers, or dates, and assigns sequential chapter numbers.
Reviews (1) · Last reviewed commit: "fix(madara): preserve volume and chapter..." · Reviewed by Greptile |
|
|
||
| const orderedRawChapters: Omit<Plugin.ChapterItem, 'chapterNumber'>[] = []; | ||
|
|
||
| if (volumeElements.length > 0) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| 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, | ||
| ); |
There was a problem hiding this comment.
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.
| 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!
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 withchapters.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 (puttingArc 11at the beginning andArc 1at the end).Changes
chapterNumbersequentially from 1 to N.versionIncrements.Checklist
type(scope): description(e.g.feat(<generator>): add new source)