10-02-2020, 06:16 PM | #1 |
Bookmaker
Posts: 416
Karma: 2143650
Join Date: Sep 2010
Device: Cybook Opus
|
Replacing All Tags Of One Kind With Another
I've gotten into the habit of using <span class="bold"> for bold text because someone told me a long time ago that <b> was deprecated. It's lately become clear to me that this was incorrect and I should probably be using <strong>.
Is there a way to replace every instance of that particular <span> tag in an ePub, including the closing tag with a <strong> tag, other than doing it all manually? |
10-02-2020, 06:44 PM | #2 | |
Bibliophagist
Posts: 35,291
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Find: <span class="bold">(.*?)</span> Replace: <strong>\1</strong> might work for you. Backup your file and test a couple of find/replace before doing a replace all. Note that this uses the PCRE flavour used with Sigil. Others may vary and you may need to remove the ? if the default is lazy (minimal match). Last edited by DNSB; 10-02-2020 at 06:50 PM. |
|
Advert | |
|
10-02-2020, 06:51 PM | #3 | ||
Resident Curmudgeon
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Quote:
|
||
10-02-2020, 07:51 PM | #4 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
If you're using Sigil you can use its TagMechanic plugin, which is essentially the same as the Editing Toolbag that JSWolf pointed to.
I'd forgotten about the strong tag; google brought up this article: https://www.seobility.net/en/wiki/Strong_and_Bold_Tags So you could use strong for things you want to semantically emphasize and style it as bold in your css. In fiction my experience is that when people emphasize something said it's with italics. So now I'm confused about the difference between the strong and em tags. |
10-02-2020, 08:04 PM | #5 | ||
Resident Curmudgeon
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
In that article, it states... Quote:
|
||
Advert | |
|
10-02-2020, 08:20 PM | #6 | ||
Grand Sorcerer
Posts: 5,275
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
Quote:
https://en.wikipedia.org/wiki/Deprecation It means that it is obsolete and should not be used is in new code and will likely not be supported at some possibly unspecified future time. It has nothing to do with whether it works now. Quote:
Is it because you are an European? |
||
10-02-2020, 10:05 PM | #7 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
|
10-02-2020, 11:48 PM | #8 |
Grand Sorcerer
Posts: 5,275
Karma: 98804578
Join Date: Apr 2011
Device: pb360
|
|
10-03-2020, 06:18 AM | #9 | |
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
|
Quote:
It is about semantics. It is about letting applications such as a TTS handle them differently if it makes sense. And honestly, if the TTS isn't indicating a difference, then it is probably because far to many people who code the books have listened to you. There are semantics involved. We should be expressing them where we can. Then the software can start handling things accordingly. @Rand Brittain: Use whichever you feel comfortable with. I personally don't like seeing <span class="bold">, but if it was <span class="telepathicSpeach"> and the class telepathicSpeach only set the style to bold text, it would make sense to me (though most people seem to use italics for that). That makes it easy to go back and restyle it later. And if <strong> makes more sense to you than <b> when you are reading the code, then do it that way. Or if <b> feels better to you, use it. |
|
10-03-2020, 06:27 AM | #10 | |
Resident Curmudgeon
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Prove I'm worog and I'll agree to use <strong> and <em>. Prove to me that you can tell by reading if the text is using <b> or <strong>. |
|
10-03-2020, 06:32 AM | #11 | |
Resident Curmudgeon
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
I have not see a single eBook where <strong> was used correctly.Same with <em>. It's either all <b> or <strong> / <i> or <em>. Also, I've never heard of any TTS that read <strong> or <em> any differemt then <b> or <i>. In most cases, the TTS just reads the text the same as it does without any style. Last edited by JSWolf; 10-03-2020 at 06:35 AM. |
|
10-03-2020, 06:46 AM | #12 | |
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
|
Quote:
It's about recording the semantics so that they can be used later. Even if it is just so that the author/book creator can change something later. |
|
10-03-2020, 06:58 AM | #13 | |
Resident Curmudgeon
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
10-03-2020, 09:58 AM | #14 | |
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
|
Quote:
The question was "how do I do something", not "should I do something". Everything else in this thread is off topic. |
|
10-03-2020, 11:25 AM | #15 | |
the rook, bossing Never.
Posts: 11,075
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
It's alleged than some screen readers differentiate between <b> and <strong>, though mine don't! It's likely you can just search and replace if you feel you need to change it. Note that while ebooks use HTML and CSS largely the same way as web pages, they are not web pages. Also a Chapter Heading might not be using <strong> or <b> but an H class. Probably shouldn't be using <b> or <strong> directly. Arguably only a word or phrase inline in a styled (via CSS) paragraph would directly have <b>, <i> and the semantic alternatives. Last edited by Quoth; 10-03-2020 at 11:31 AM. Reason: Headings |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem replacing tags in custom recipe | Phoebus | Recipes | 2 | 07-05-2016 10:22 AM |
Replacing code without replacing text? | ElMiko | Sigil | 6 | 11-30-2011 08:14 PM |
Amazon Tags - Popular tags vs Unique tags. | chrisanthropic | Writers' Corner | 6 | 09-19-2011 11:18 PM |
Replacing multiple tags over 2 lines | kmckinley | Sigil | 7 | 09-03-2011 10:34 PM |
Replacing tags after using them | hiperlink | Recipes | 2 | 03-28-2011 10:23 AM |