MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   How do I change italic <i> shortcut to use <em> instead? (https://www.mobileread.com/forums/showthread.php?t=329302)

TheTechAuthor 04-27-2020 10:04 AM

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

I've tried searching this sub-forum but I can't seem to find an answer. I'm using Sigil 1.2.0 and I want to modify the Ctrl + I shortcut to use <em>TEXT</em> instead of <i>TEXT</i> as <i> is not accepted by either Google Play Publish or Itunesconnect for ePub 3 submissions.

Can anyone recommend how I make this change? Do I need to edit a specific file as the Edit > Preferences > Keyboard Shortcuts don't allow me to alter the HTML used by the shortcut.

Many thanks!

JSWolf 04-27-2020 10:25 AM

Quote:

Originally Posted by TheTechAuthor (Post 3981439)
Hi,

I've tried searching this sub-forum but I can't seem to find an answer. I'm using Sigil 1.2.0 and I want to modify the Ctrl + I shortcut to use <em>TEXT</em> instead of <i>TEXT</i> as <i> is not accepted by either Google Play Publish or Itunesconnect for ePub 3 submissions.

Can anyone recommend how I make this change? Do I need to edit a specific file as the Edit > Preferences > Keyboard Shortcuts don't allow me to alter the HTML used by the shortcut.

Many thanks!

You can use the TagMechanic plugin to do this.

https://www.mobileread.com/forums/sh...d.php?t=270639

Turtle91 04-27-2020 10:39 AM

I don't think there is an option for that... but, you can either use the plugin JSWolf mentioned, or a simple regex to change them all. I saved the regex as a Saved Search group and it changes several things with a single run like (<i> to <em>, <b> to <strong>, etc)

search: <i>(.*?)</i>
replace: <em>\1</em>

Cheers,

TheTechAuthor 04-27-2020 10:39 AM

Quote:

Originally Posted by JSWolf (Post 3981459)
You can use the TagMechanic plugin to do this.

https://www.mobileread.com/forums/sh...d.php?t=270639

Hi, thanks for the swift reply and the link. I've installed the plug-in and given it a try, However, it only seems to allow you to modify existing href tags after the fact (and not rebind them in advance).

Am I using it wrong? Or is that functionality simply not possible in that plug-in?

Thanks.

TheTechAuthor 04-27-2020 10:43 AM

Quote:

Originally Posted by Turtle91 (Post 3981465)
I don't think there is an option for that... but, you can either use the plugin JSWolf mentioned, or a simple regex to change them all. I saved the regex as a Saved Search group and it changes several things with a single run like (<i> to <em>, <b> to <strong>, etc)

search: <i>(.*?)</i>
replace: <em>\1</em>

Cheers,

Hi,

This sounds like I'd need to accept the fact that <i> is what to run with for speed, and then remember to add a post-processing task at the end to convert them all to <em> afterwards.

Although, bizarrely, <b> is still accepted as valid, but <i> isn't. If you don't mind me asking, how do you go about creating the regex and running it at the end stage of the Sigil production workflow?

Thanks.

Turtle91 04-27-2020 10:55 AM

1 Attachment(s)
You can use the Saved Searches feature (Tools/Saved Searches... or Ctrl-Alt-F) to create a Group of searches.

Then when you want to run one, just highlight the title of the group - or even an individual search within the group to run that particular portion. The link above has all the details...its to the Sigil User Guide and has a section on Saved Searches.

Attached is one of the groups of regex's I use:

KevinH 04-27-2020 11:33 AM

An "i" tag is valid html5 and therefore valid for epub3. It even has a slightly different semantic than the "em" tag. A forign word, a ship name, etc vs just "emphasis". How on earth can Google Play Publish make such a rule. It is not part of the epub3 spec. Itunes ibooks does allow the use of both the "i" tag and the "em" tag. Sounds like the "thought police" are back in action and this time are reading your mind to determine that the "i" tag is somehow inappropriate.

I would file a bug report with Google Play publish and tell them they are neither the owner of the epub3 spec nor can they read minds to determine how the author meant to use "i" vs "em".

So silly.

TheTechAuthor 04-27-2020 11:45 AM

Quote:

Originally Posted by KevinH (Post 3981481)
An "i" tag is valid html5 and therefore valid for epub3. It even has a slightly different semantic than the "em" tag. A forign word, a ship name, etc vs just "emphasis". How on earth can Google Play Publish make such a rule. It is not part of the epub3 spec. Itunes ibooks does allow the use of both the "i" tag and the "em" tag. Sounds like the "thought police" are back in action and this time are reading your mind to determine that the "i" tag is somehow inappropriate.

I would file a bug report with Google Play publish and tell them they are neither the owner of the epub3 spec nor can they read minds to determine how the author meant to use "i" vs "em".

So silly.

Indeed it is silly. Sadly, it just kept spitting up errors (along with Itunesconnect) when I used the <i> tag. I'm not convinced that such a request would be high in their current list of priorities though. Same with Apple.

Apple's own documentation points to this web page: https://www.w3.org/TR/html401/struct/text.html and it was from here I got the idea for using <em> instead (and that just works).

Doitsu 04-27-2020 12:58 PM

Quote:

Originally Posted by TheTechAuthor (Post 3981439)
I've tried searching this sub-forum but I can't seem to find an answer. I'm using Sigil 1.2.0 and I want to modify the Ctrl + I shortcut to use <em>TEXT</em> instead of <i>TEXT</i> as <i> is not accepted by either Google Play Publish or Itunesconnect for ePub 3 submissions.

Try the following:

1. Right-click the toolbar and check Clip Bar, if it isn't already checked.
2. Select Tools > Clip Editor.
3. Highlight the topmost entry and click Add Entry.
4. Enter <em> in the Name field and <em>\1</em> in the Text field.
5. Click the up arrow button to move the new clip to the top.
6. Click Save.

You should see an <em> button in the Clip Bar that allows you to wrap text in <em>...</em>.

KevinH 04-27-2020 04:04 PM

Quote:

Originally Posted by TheTechAuthor (Post 3981486)
Apple's own documentation points to this web page: https://www.w3.org/TR/html401/struct/text.html and it was from here I got the idea for using <em> instead (and that just works).

That is actually a very very old html 4.01 spec that is not part of epub3 which actually calls for the xhtml serialization of html5 not 4.

You should be using an html5 based validator and not that old spec. It actually violates the epub3 spec in more than a few places.

TheTechAuthor 04-27-2020 04:10 PM

Quote:

Originally Posted by Doitsu (Post 3981528)
Try the following:

1. Right-click the toolbar and check Clip Bar, if it isn't already checked.
2. Select Tools > Clip Editor.
3. Highlight the topmost entry and click Add Entry.
4. Enter <em> in the Name field and <em>\1</em> in the Text field.
5. Click the up arrow button to move the new clip to the top.
6. Click Save.

You should see an <em> button in the Clip Bar that allows you to wrap text in <em>...</em>.

:thanks:

I'd never used clips before in Sigil, so that's my TIL for today. I'm just having a poke around now so I can edit the clip keyboard shortcuts for the new <em> clip. CTRL + ALT + 2 doesn't seem to do anything.

But at least I can now just click on it from the 'Clips' menu on the left-hand side.

TheTechAuthor 04-27-2020 04:12 PM

Quote:

Originally Posted by KevinH (Post 3981600)
That is actually a very very old html 4.01 spec that is not part of epub3 which actually calls for the xhtml serialization of html5 not 4.

You should be using an html5 based validator and not that old spec. It actually violates the epub3 spec in more than a few places.

I only used it for the italics/emphasis issue. Otherwise, I've got by using plain-old regular html and CSS tags/classes.

Hopefully Apple will one day update their documentation links to something more beneficial. :)

Notjohn 04-27-2020 05:06 PM

I don't know about "Google Play publish", but all my ebooks are available on Google Play, and all of them use <i> tags for italics. They are epub2.

Tex2002ans 04-27-2020 09:21 PM

Quote:

Originally Posted by TheTechAuthor (Post 3981467)
Although, bizarrely, <b> is still accepted as valid, but <i> isn't.

Like KevinH said, <i> is valid HTML5.

If you want more detailed discussion, see the 2017 thread "Extended <head> chapter: NOT necessary?" (especially my post #43 plus surrounding posts discussing differences between <i> vs. <em>).

TheTechAuthor 04-28-2020 04:03 AM

Quote:

Originally Posted by Tex2002ans (Post 3981795)
Like KevinH said, <i> is valid HTML5.

If you want more detailed discussion, see the 2017 thread "Extended <head> chapter: NOT necessary?" (especially my post #43 plus surrounding posts discussing differences between <i> vs. <em>).

That was an interesting read. Thank you.

However, my main concern is getting a workflow that "just works" across KDP, Google Play Books, and iTunesConnect. Right now, from a speed perspective at least, <em> for emphasising words and <b> for bolding words is the quickest - for me.

I need to work within the currently accepted rules of whatever digital eBook store I want to sell on. And, as it currently stands, as valid as <I> is, it's not accepted in ePub 3 by every eBook retailer. Sadly.


All times are GMT -4. The time now is 09:29 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.