09-08-2013, 07:03 AM | #286 | |
Guru
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
|
Quote:
BobC |
|
09-08-2013, 07:34 AM | #287 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
If you posted a code snippet of a paragraph with a footnote reference, the actual footnote code and the desired transformation, the regex gurus might come up with a solution. |
|
10-10-2013, 03:38 PM | #288 |
Member
Posts: 18
Karma: 11216
Join Date: Sep 2013
Device: Kindle and iPad Mini 4
|
Hi there,
I'm looking for a Regex expression in order to automatically generate IDs ! So, I actually have the following code: Code:
<sup>8</sup> Code:
<a id="note8">8</a> Is there a simple way to do this with Regex ? (I've 1232 IDs to generate!) TIA, |
10-10-2013, 03:46 PM | #289 | |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
<sup>(\d+)</sup> Code:
<a id="note\1">\1</a> |
|
10-10-2013, 03:52 PM | #290 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Spot on, Ducky!
It's not part of the original request, but I would consider adding brackets around the digits to give fat fingers a slightly bigger "tap" zone to aim for. Code:
<a id="note\1">[\1]</a> |
10-10-2013, 04:41 PM | #291 |
Member
Posts: 18
Karma: 11216
Join Date: Sep 2013
Device: Kindle and iPad Mini 4
|
Wow! That was SUPER fast!!! Thanks a lot theducks and DiapDealer! In two seconds I've made all the IDs!
Just one more question Is there a way to make a for… to request in order to execute the command, for example, 200 times only ? Last edited by LuCouto; 10-10-2013 at 04:58 PM. |
10-10-2013, 06:39 PM | #292 | |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
You can set the range to selected files and highlight those files in the book browser. That limits Replace All to those files |
|
10-10-2013, 06:42 PM | #293 | |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Did I mention 'I hate touch'. Too Sensitive for my kind of swipe. too tiny a zone for big fingers. Last edited by theducks; 10-10-2013 at 06:50 PM. |
|
02-25-2014, 04:19 AM | #294 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Setting up a div container around quotes.
My converter creates paragraphs only, but not div containers. I have a very long book to deal with, with a lot of quotes, some of them very long. I use two main paragraph styles, "bodytext" (100%) and "quote" with a smaller size. The problem is that these quotes may include from one to four paragraphs. I would like to neatly separate the quote from the bodytext for readability purposes, but if I do it using only paragraphs, long quotes look weird because the space between paragraphs is too big. Obviously I need to enclose each quote within a div which will take care of the needed whitespace. Say a div with bottom and top margins of 1em, while the quote paragraphs themselves will have much smaller margins (or not at all). I can do that manually... or set up a regex. This is the question. |
02-25-2014, 04:40 AM | #295 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
If not, it'd would be extremely difficult to use a regex, because in order to use a regex the text to be found needs to follow a predictable pattern. |
|
02-25-2014, 04:47 AM | #296 | |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thanks for your interest
Quote:
But the predictable pattern is that there can be from one to four successive Code:
<p class="quote"> These "quote" paragraphs make them stand out from the other bodytext paragraphs where I use only Code:
<p> Last edited by roger64; 02-25-2014 at 04:53 AM. |
|
02-25-2014, 06:09 AM | #297 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
1. Insert opening <div> before first quote paragraph: Find:<p>(.*?)</p>\s*<p class="quote"> Replace:<p>\1</p>\n<div class="quote">\n<p class="quote"> 2. Insert closing </div> after last quote paragraph: Find:<p class="quote">(.*?)</p>\s*<p> Replace:<p class="quote">\1</p>\n</div>\n<p> Obviously this only works if there's at least one non-quote paragraph before the first and after the last quote paragraph. |
|
02-25-2014, 08:50 AM | #298 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thanks a lot for your kind help which saves me a lot of time.
Yes all the quotes are enclosed withing plain p tags, so this is working. I had tried to figure out a one step process and miserably failed. Setting into place first all the opening div tags and then the closing div tags is indeed a safe way. I keep Sigil for regex because I have there all my saved searches. Yours will join the others. |
02-28-2014, 09:00 PM | #299 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
So I did a practical try with a book including 89 quotes. It worked very well.
On the first run, it produced 87 opening tags and 89 closing tags. This discrepancy triggered a reporting mistake. It was due to the fact that two times I had NOT a plain <p> style before the quote, so, of course, these two times the regex did not create any tag. It's better to prevent the problem than trying to solve it once it happened. That's why, before performing these two separate regexes, it would have been better for me to ask Sigil to number the occurrences for each of them. If the figures are equal (say 89 all): go for it. If not, look for the explanation. Last edited by roger64; 02-28-2014 at 09:15 PM. |
02-28-2014, 09:46 PM | #300 |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Well that case isn't particularly a good example. When quoting multiple paragraphs it is normal not close the quote until the last paragraph but have open ones at the start of each one.
Dale |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Examples of Subgroups | emonti8384 | Lounge | 32 | 02-26-2011 06:00 PM |
Accessories Pen examples | Gunnerp245 | enTourage Archive | 15 | 02-21-2011 03:23 PM |
Stylesheet examples? | Skitzman69 | Sigil | 15 | 09-24-2010 08:24 PM |
Examples | kafkaesque1978 | iRiver Story | 1 | 07-26-2010 03:49 PM |
Looking for examples of typos in eBooks | Tonycole | General Discussions | 1 | 05-05-2010 04:23 AM |