From e7a1560734528b11b313ffec4ab907951b0a7086 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 6 Dec 2015 20:10:32 -0600 Subject: [PATCH] Improve basic chapter_title_strip_pattern, add warnings for same. --- calibre-plugin/plugin-defaults.ini | 11 +++++++++-- fanficfare/defaults.ini | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index f64b8d2c..e8888bfe 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -299,14 +299,21 @@ add_chapter_numbers:false ## "1: Start" => "Start" ## "2, Chapter the second" => "Chapter the second" ## etc -chapter_title_strip_pattern:^[0-9]+[\.: -]+ +## Leaves unchanged "1.1" or "1" +## Note that your ToC entry(ies) may be empty if the +## chapter_title_strip_pattern removes everything and you don't have +## add_chapter_numbers:true. +chapter_title_strip_pattern:^[0-9]+[\.: -]+(?=[^0-9]|$) -## This version will strip all of the above *plus* remove 'Chapter 1': +## This version remove leading numbers and 'Chapter 1': ## "Chapter 1" => "" ## "1. Chapter 1" => "" ## "1. Chapter 1, Bob's First Clue" => "Bob's First Clue" ## "Chapter 2 - Pirates Place" => "Pirates Place" ## etc +## Note that your ToC entry(ies) may be empty if the +## chapter_title_strip_pattern removes everything and you don't have +## add_chapter_numbers:true. #chapter_title_strip_pattern:^([0-9]+[\.: -]+)?(Chapter *[0-9]+[\.:, -]*)? ## If true, when updating an epub that already has old chapters, new diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index d09c672d..7cefe6cb 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -308,14 +308,21 @@ add_chapter_numbers:false ## "1: Start" => "Start" ## "2, Chapter the second" => "Chapter the second" ## etc -chapter_title_strip_pattern:^[0-9]+[\.: -]+ +## Leaves unchanged "1.1" or "1" +## Note that your ToC entry(ies) may be empty if the +## chapter_title_strip_pattern removes everything and you don't have +## add_chapter_numbers:true. +chapter_title_strip_pattern:^[0-9]+[\.: -]+(?=[^0-9]|$) -## This version will strip all of the above *plus* remove 'Chapter 1': +## This version remove leading numbers and 'Chapter 1': ## "Chapter 1" => "" ## "1. Chapter 1" => "" ## "1. Chapter 1, Bob's First Clue" => "Bob's First Clue" ## "Chapter 2 - Pirates Place" => "Pirates Place" ## etc +## Note that your ToC entry(ies) may be empty if the +## chapter_title_strip_pattern removes everything and you don't have +## add_chapter_numbers:true. #chapter_title_strip_pattern:^([0-9]+[\.: -]+)?(Chapter *[0-9]+[\.:, -]*)? ## If true, when updating an epub that already has old chapters, new