12-15-2016, 01:49 AM | #511 | |
Junior Member
Posts: 9
Karma: 10
Join Date: Oct 2016
Device: Hypen app for iOS
|
css option
Quote:
<span class=\"initial\">(.*?)</span>(.*?)\s and did chapters one at a time. I since discovered this css trick that lets me assign a paragraph class that make the first letter a drop cap while automatically accounting for quotes and also starting with span (<p class="first><span class=<italic">), or <i>, <em>, and seemingly anything until the first letter is found. The only condition I have found where the first letter is not drop capped is if dash, en-dash or em-dash are the first character. I also set the entire first line of text as smallcaps dynamically, meaning smallcaps for the first line no matter how many words are displayed. The result is much like books are formatted. As a result I do much less regex editing than I was doing before. The css is: .parafirst { your format options for first paragraph } .parafirst:first-letter { your format options for drop cap } .parafirst:first-line { font-variant: small-caps; } < could also be any format you like, such as bold or convert to all uppercase I found the above solution looking for a way for css to handle a first word of a paragraph but that does not seem to exist. Just letter and line as options. |
|
12-15-2016, 01:50 AM | #512 | |
Junior Member
Posts: 9
Karma: 10
Join Date: Oct 2016
Device: Hypen app for iOS
|
css option
Quote:
<span class=\"initial\">(.*?)</span>(.*?)\s and did chapters one at a time. I since discovered this css trick that lets me assign a paragraph class that make the first letter a drop cap while automatically accounting for quotes and also starting with span (<p class="first><span class=<italic">), or <i>, <em>, and seemingly anything until the first letter is found. The only condition I have found where the first letter is not drop capped is if dash, en-dash or em-dash are the first character. I also set the entire first line of text as smallcaps dynamically, meaning smallcaps for the first line no matter how many words are displayed. The result is much like books are formatted. The css is: .parafirst { your format options for first paragraph } .parafirst:first-letter { your format options for drop cap } .parafirst:first-line { font-variant: small-caps; } I do much less regex than I was doing before. I found the above solution looking for a way for css to handle a first word of a paragraph but that does not seem to exist. Just letter and line as options. |
|
02-05-2017, 08:09 AM | #513 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Nov 2014
Device: kobo h2O
|
Hi,
I'm looking to remove, in Sigil: name="54614" The numbers change, but there are always 6 [edit: 7 in one xhtml file]. I can't determine how to use regular expressions in Sigil to remove every name="######" Anyone know a specific expression? Thank you. Last edited by GalacticHull; 02-05-2017 at 08:12 AM. Reason: additional information |
02-05-2017, 08:24 AM | #514 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
You could use:
Find: Code:
name="(\d+)" Last edited by Doitsu; 02-05-2017 at 08:28 AM. |
02-05-2017, 08:52 AM | #515 | |
Enthusiast
Posts: 30
Karma: 10
Join Date: Nov 2014
Device: kobo h2O
|
Quote:
I appreciate the help. I've rarely encountered the need for regular expressions and so you're dealing with a total idiot. |
|
02-05-2017, 09:16 AM | #516 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Code:
name="(\d+)" |
|
02-05-2017, 09:28 AM | #517 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Nov 2014
Device: kobo h2O
|
Know what? Whatever you did or didn't do, I'm a fool. This was my second attempt, and after about a dozen I posted here. The fact is, I didn't recognize that Sigil had a specific option to run regex, so I just kept running it in normal search!
And, if not for your help making me confident of that regex, I probably never would have noticed. So thank you |
02-05-2017, 09:28 AM | #518 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'd consider changing that "name=" attribute to "id=" instead of just removing it. It's obsolete, but there still may be operating links that refer to it in their hrefs.
|
02-05-2017, 09:42 AM | #519 | |
Enthusiast
Posts: 30
Karma: 10
Join Date: Nov 2014
Device: kobo h2O
|
Quote:
|
|
02-05-2017, 09:46 AM | #520 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Sounds good. Just wanted to be sure that internal links had been considered.
|
07-18-2017, 11:16 AM | #521 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
To avoid a disgraceful linebreak between the name of a ruler and his number, the French insert a no-break space between them (here represented by _. Thus we find, Charles_XII, Henri_II. This rule applies even for Louis_XVI... I'd like to write a regex to add automatically the missing no-break spaces. We have two parts: a surname beginning with a capital letter and a number written with Roman numerals. The following regex finds all of them Code:
([A-Z])([a-z]+)\s(I|V|X)+ However, this regex is a little too greedy because it also works for Hans Viktor, Si Votre..., Pour Vienne..., So I'd like to be sure it should not work if the Roman numerals are followed by lower case letters. Could some kind helping hand improve this regex? Last edited by roger64; 07-18-2017 at 11:22 AM. |
07-18-2017, 01:11 PM | #522 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
So after the roman numerals all you want to allow is whitespace or punctuation (.,) is that right? If so couldn't you can add them as [\s.,]+ at the end? You might want to include single and double quotes as well and even an exclamations point such as Louis XVI! LouisXVI. etc.
If you really want anything other than a lowercase letter you could add [^a-z] or something along those lines to negate the set. |
07-18-2017, 03:42 PM | #523 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
@Kevin
Thanks for your help. After some trials, it seems I get good results this way: Code:
([A-Z])([a-zé]+)\s([I|V|X]+)([\s.,?!]+|<sup>er</sup>) Code:
\1\2\u00a0\3\4 Last edited by roger64; 07-18-2017 at 03:54 PM. Reason: Napoléon Ier |
07-19-2017, 06:17 AM | #524 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
A small suggestion. Rather than using the possible punctuation, use "\b". That is a word break, so will match to everything you have, plus all the other possible punctuation that might end a word.
|
07-23-2017, 02:41 AM | #525 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
|
|
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 |