03-12-2011, 09:46 AM | #1 |
Wizard
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
search and replace - drops blanks in replace ?
i tried using S&R in epub to epub conversion to replace all mdash with space ndash space.
it seems that the replace function drops the leading & training spaces so what it actually does is to replace all mdash with ndash - not what I wanted ??? i then tried escaping the space characters but got failed conversion with that approach |
03-12-2011, 10:34 AM | #2 |
creator of calibre
Posts: 44,154
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use –
|
Advert | |
|
03-12-2011, 10:59 AM | #3 |
Wizard
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
that is self defeating, I want to make the change so that lines can be split on either side of the ndash ( once converted to Kindle) if needs be - a non breaking space either side would prevent that I assume.
other search / replace engines ( e.g. sigil) support leading / trailing spaces - they are somewhat essential when using regex to remove unwanted line feeds. as you need constructs like space\1 in your replace box. it would be MUCH faster to do a single find+replace & epub to epub convert in calibre that it is to go to sigil, set it to code view, set its find /replace to all files, all instances & then make the changes that way, but if leading trailing space cant be used.... & I guess there are other valid reasons for wanting to add extra ( normal) space via the search / replace engine |
03-12-2011, 11:45 AM | #4 |
creator of calibre
Posts: 44,154
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use a unicode space character that isn't stripped. Since I didn;t write this bit of code, I cannot comment on why leading/trailing spaces are stripped, but I'd imagine it is to be consistent with the way spaces are handled everywhere else in calibre.
|
03-12-2011, 11:59 AM | #5 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
class Widget function get_value in calibre/gui2/convert/__init__.py is stripping white space at the beginning and end of QLineEdit and QTextEdit. So the spaces are never propagated along to the conversion pipeline.
|
Advert | |
|
03-12-2011, 12:15 PM | #6 |
creator of calibre
Posts: 44,154
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can override that behavior in the widget for search and replace. I don;t want to change it globally.
|
03-12-2011, 12:22 PM | #7 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
03-12-2011, 10:17 PM | #8 |
US Navy, Retired
Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
@cybmole Congratulations!!
In case you hadn't noticed, you just reported a bug that is being corrected. |
03-12-2011, 10:38 PM | #9 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
03-12-2011, 10:56 PM | #10 | |
US Navy, Retired
Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Thanks for the fix, it sounds like one I might have run into in the future if it hadn't been fixed now. |
|
03-13-2011, 03:07 AM | #11 |
Wizard
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search and replace not working | helmerer | Conversion | 4 | 02-25-2011 03:48 AM |
Search and Replace problem | naro_c | Conversion | 5 | 02-25-2011 12:59 AM |
Search & Replace | Pat Nickholds | Sigil | 2 | 10-21-2010 11:18 PM |
Search and replace in 0.2.0 | paulpeer | Sigil | 7 | 03-13-2010 11:59 AM |
Why no search and replace? | charleski | Sigil | 10 | 11-24-2009 04:13 PM |