Mobileread
Replacing All Tags Of One Kind With Another
#11  JSWolf 10-03-2020, 06:32 AM
Quote davidfor
After all this time, you really don't get it, do you? But, yet you would scream at someone who suggested using a <p class="chapterHeading"> where the class "chapterHeading" was the same style as a h1 or h2 tag. As you keep saying, why does it matter if they look the same on the screen?

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.
If that really is the case, then <strong> should not be used everyplace bold text is wanted. <b> should be used where the text should be bold but not emphasized. A good example is Star Trek books. They use italics for speech on the other side of the communicator. That should be <i> as it is not emphasized text and should not be read that way. <em> is not appropriate there.

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.
Reply 

#12  davidfor 10-03-2020, 06:46 AM
Quote JSWolf
If that really is the case, then <strong> should not be used everyplace bold text is wanted. <b> should be used where the text should be bold but not emphasized. A good example is Star Trek books. They use italics for speech on the other side of the communicator. That should be <i> as it is not emphasized text and should not be read that way. <em> is not appropriate there.
Thank you for proving my point. In that case, <i> probably is the better tag as is not about emphasis. But, if it was about emphasis, such as someone shouting, then using <em> or <strong> could be a better choice.

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.
Reply 

#13  JSWolf 10-03-2020, 06:58 AM
Quote davidfor
Thank you for proving my point. In that case, <i> probably is the better tag as is not about emphasis. But, if it was about emphasis, such as someone shouting, then using <em> or <strong> could be a better choice.

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.
Going back to the OPs question, there is no way to to change <span class="bold"> to <strong> correctly as every instance would have to be looked at to see if it each instance should be <b> or <strong>. A chapter header should be <b> (for example).
Reply 

#14  davidfor 10-03-2020, 09:58 AM
Quote JSWolf
Going back to the OPs question, there is no way to to change <span class="bold"> to <strong> correctly as every instance would have to be looked at to see if it each instance should be <b> or <strong>. A chapter header should be <b> (for example).
Sorry, that's just plain silly. Several methods have been mentioned for exactly how to do this. Hell, you even said how it could be done. And yes, of course they might need to be examined to check that it make sense. Or which change to use. But, the OP has said nothing about where the code has been used, just wants to know how to do the work.

The question was "how do I do something", not "should I do something". Everything else in this thread is off topic.
Reply 

#15  Quoth 10-03-2020, 11:25 AM
Quote Rand Brittain
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>.
It was depreciated and then un-depreciated. They (Web Standards) then decided <b> is literally bold and <strong> is semantic, but always rendered bold unless the CSS does something different. They can be the same via CSS.

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.
Reply 

#16  Rand Brittain 10-03-2020, 01:58 PM
This is useful advice; I'll give it a try once the ePub is completed and backed up.
Reply 

#17  JSWolf 10-03-2020, 04:52 PM
Quote Quoth
It was depreciated and then un-depreciated. They (Web Standards) then decided <b> is literally bold and <strong> is semantic, but always rendered bold unless the CSS does something different. They can be the same via CSS.

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.
Very well said!
Reply 

#18  Rand Brittain 10-04-2020, 12:43 PM
These extensions did exactly what I wanted; thank you for your advice!
Reply 

#19  Tex2002ans 10-15-2020, 04:22 PM
Quote Rand Brittain
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?
As a few other users have pointed out, DiapDealer's two plugins are perfect for this.

For Calibre, you could use his Diap's Editing Toolbag.

For Sigil, you could use his TagMechanic.

I wrote some instructions with pictures just a few months ago in:

"How do I change italic <i> shortcut to use <em> instead?"

In order to go from <span class="bold"> -> <b>, you have to use slightly different settings:

Action Type: Modify
Tag name: span
Having the attribute: class
Whose value is (no quotes): bold
Change tag to: b

Quote hobnail
So now I'm confused about the difference between the strong and em tags.
For all the technical details on <i> vs. <em>, <b> vs. <strong>, and <span class="italics"> vs. <i>/<em>, see the famous thread from earlier this year:

"<i>, <em> or <span> for italics?"

<em> = emphasis, like:

Code
"Don't you know <em>you're</em> supposed to walk the dog today?"
<strong> is meant for "important information", like:

Code
<strong>WARNING!</strong> Minefield ahead!
Also see MDN's article on it, where they also explain the differences between:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong
Reply 

 « First  « Prev   (2/2)
Today's Posts | Search this Thread | Login | Register