fix: strip 'Chapter N - N: ' prefix from chapter titles in content menu
This commit is contained in:
@@ -281,6 +281,11 @@ func SplitChapterTitle(raw string) (title, date string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip "Chapter N - N: " prefix (novelfire double-number format).
|
||||||
|
// Also handles "Chapter N: " (single number) and "Chapter N - Title" without colon.
|
||||||
|
chNumRe := regexp.MustCompile(`(?i)^chapter\s+\d+(?:\s*-\s*\d+)?\s*:\s*`)
|
||||||
|
raw = strings.TrimSpace(chNumRe.ReplaceAllString(raw, ""))
|
||||||
|
|
||||||
// Match a trailing relative date: "<n> <unit>[s] ago"
|
// Match a trailing relative date: "<n> <unit>[s] ago"
|
||||||
dateRe := regexp.MustCompile(`\s*(\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago)\s*$`)
|
dateRe := regexp.MustCompile(`\s*(\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago)\s*$`)
|
||||||
if m := dateRe.FindStringSubmatchIndex(raw); m != nil {
|
if m := dateRe.FindStringSubmatchIndex(raw); m != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user