10-27-2023, 02:57 PM | #16 | |
Resident Curmudgeon
Posts: 76,446
Karma: 136564696
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
I want to replace all en-dashes with and without spaces to en-dashes without spaces. Also, I want all em-dashes with spaces to be em-dashes without spaces. |
|
10-27-2023, 07:02 PM | #17 | ||
Wizard
Posts: 2,304
Karma: 12587727
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
I only use Diap's Editing Toolbag for smartening quotation marks. Quote:
Regex #3: SPACE + EN DASH + SPACE -> No-space EM DASH
or various mixes of \s or whatever types of spaces you're trying to find/fix. - - - Personally, if I was adjusting those dashes, I'd:
I don't believe it's a very smart idea to mass change "spaced dashes" like this without verification (or deciding on a case-by-case basis), because you don't know what sort of madness might be inside the book. I've seen too many cases of:
or all sorts of weird spacing mixed around the dashes too. Again, see the 2022 topic: "False paragraph breaks & RegEx" where I went into all the edge-case details. (Like em dashes signifying "cut off" dialogue.) - - - Side Note: I've even seen the (definitely wrong):
This is why it all has to be on a book-by-book, case-by-case basis. Trying to mass change this type of stuff isn't smart without looking through the text first. Luckily, every book I work with uses and enforces the proper EM DASH with no spaces around it. And I don't have to worry about the quotation dashes or anything like that. Makes it much easier on my end. - - - Side Note #2: Personally, this is what I use. 3 sets of Regex: Regex #1: Remove spaces from EM DASH
Regex #2: Inserting EN DASH
Regex #3: Converting to EN DASH (Accidental EM DASH)
I run:
Before: Code:
<p>This is a small— very small — example of text.</p> <p>The 2000-2010 period was the root cause.</p> <p>See pp. 5—9.</p> Code:
<p>This is a small—very small—example of text.</p> <p>The 2000–2010 period was the root cause.</p> <p>See pp. 5–9.</p> Last edited by Tex2002ans; 10-28-2023 at 04:39 AM. |
||
Advert | |
|
11-09-2023, 02:09 PM | #18 |
Member
Posts: 17
Karma: 10
Join Date: Jan 2021
Device: Kobo Forma
|
That's a useful approach thanks. I was previously thinking I would have to do it in two separate steps, first to deal with the ones with spaces, and then any remaining without.
It also occurred to me that where I most need this feature is for fixing up book descriptions ("Comments" metadata) in Calibre. It would be great if a smarten punctuation button could be added to the formatting toolbar for that. But in the meantime I typically copy and paste the text into Notepad++ for editing where I can make use of regex replacements if desired. I hadn't come across that editing option in Sigil nor Calibre before so great to learn about too thank you |
Tags |
dashes, edit, polish, polishing, smarten punctuation |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Smarten Punctuation | hiteshp | Calibre | 4 | 06-13-2021 03:15 AM |
Smarten punctuation | crutledge | Editor | 7 | 04-26-2014 03:02 AM |
Smarten punctuation only? | Psymon | Conversion | 3 | 10-20-2013 10:28 AM |
Simpler Way to Smarten Punctuation | Rand Brittain | Calibre | 3 | 10-10-2010 09:16 PM |
Thanks for new 'Smarten Punctuation' feature | jackie_w | Calibre | 1 | 09-21-2010 03:53 PM |