Repository navigation
fix(multisrc/novelfire): restore chapter numbers and optimize parsing (#2840) - #2843
Conversation
…nd document Cheerio fast-path (lnreader#2840)
[Medium impact] The PR affects chapter lists and chapter content for two sources sharing one parser. The PR appears safe to merge, with a non-blocking chapter-title edge case. Findings
SummaryRestores chapter numbers for Novel Phoenix and shares title formatting with Novel Fire.
Reviews (1) · Last reviewed commit: "fix(multisrc/novelfire): restore chapter..." · Reviewed by Greptile |
| (num.length > 0 && | ||
| cleanTitle.startsWith(num) && | ||
| (cleanTitle.length === num.length || !/\d/.test(cleanTitle[num.length]))); |
There was a problem hiding this comment.
Chapter numbers still go missing
formatChapterTitle mistakes numbered subtitles for chapter numbers. For chapter 1 with the subtitle 1st Nightmare, the s passes the non-digit check, so the function returns 1st Nightmare without Chapter 1. This leaves the display-name fix incomplete for titles starting with an ordinal. Require a chapter-number separator rather than accepting any non-digit character.
Checklist
type(scope): description(e.g.feat(<generator>): add new source)Closes #2840
Summary
Novel Phoenix updated its backend/CMS to separate chapter sequence numbers (
n_sort) from subtitles (title), causing the plugin to strip chapter numbers from chapter names (e.g. displaying "The Beginning" instead of "Chapter 1 The Beginning"). Additionally, the HTML fallback scraper inparsePageshort-circuited when$a.attr("title")contained a subtitle without chapter numbers.formatChapterTitle): Unifies title formatting across AJAX and DOM fallback paths; prepends chapter numbers only when missing, preventing duplicates on unchanged sibling sources like Novel Fire.tag.substring(0, 1) == "nf"tag.startsWith("nf").novelphoenix(1.0.21.0.3) andnovelfire(1.4.51.4.6) insources.json.Evidence
https://novelphoenix.com/novel/shadow-slave):[ { "name": "Chapter 1 Nightmare Begins", "chapterNumber": 1 }, { "name": "Chapter 2 Slave Caravan", "chapterNumber": 2 }, { "name": "Chapter 3 The Strings of Fate", "chapterNumber": 3 } ]Merge Danger
Door: Two-way
Easily revertible scoped change affecting only
novelfiremultisrc generator sources.Blast Radius: Low
Isolated to the
novelfiremultisrc template (novelphoenixandnovelfire). Verified zero regressions against both live sites.