![]() |
#1 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
element "u" not allowed anywhere
Hi all
So I'm at the final stage of my epub-novel and ran a validation. I get this error message about a hundred times: element "u" not allowed anywhere; expected the element end-tag, text or element "a", "abbr", "acronym", "applet", "b", "bdo", "big", "br", "cite", "code", "del", "dfn", "em", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "tt" or "var" (with xmlns:ns="http://www.w3.org/2000/svg") From what I've read, the <u> shouldn't be a problem as long as it is within a <p>. This is what it all looks like in my html: Code:
<p><u>some text</u></p> What should I do to fix this, and is there an easy way to fix all 100 instances at once? I've heared of regex, but I don't master it yet (not by a long shot). Any help would be grately appreciated, as always. Yours Johan |
![]() |
![]() |
![]() |
#2 |
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
|
You can replace <u> with <span class="u"> even without regexpession and then do the same with </u> to </span> and then write a .u entry in CSS to perform the underlining.
Dale Last edited by DaleDe; 04-17-2014 at 08:31 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 171
Karma: 86271
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
|
you could use the following regex to replace all instances, although i would recommend against blindly doing a global replace, better to go through one-by-one (more or less automated in Sigil with 'Search in all XHTML files' and then clicking 'Replace/Find Next').
Code:
find: <u>(.*?)</u> replace: <span class="underline">\1</span> Code:
.underline{ text-decoration:underline; } |
![]() |
![]() |
![]() |
#4 |
Software Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 190
Karma: 89000
Join Date: Jan 2014
Location: Germany
Device: PocketBook Touch Lux 3
|
As the error message clearly points out, you're not allowed to use <u> anywhere, since <u> is a deprecated element in HTML4 Strict and XHTML Strict. Does Calibre place an <u> in the EPUBs XHTML when clicking on an “underline” button?
|
![]() |
![]() |
![]() |
#5 |
Color me gone
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
It is one of those things which will work in actual readers, but which validators don't like. Not a problem if for personal use, but publishers will use one or another of them.
Underlining is very old school, as there are other ways to emphasize by bolding, italicizing, increasing the font size, etc. About the only use I could see for it these days would be to try to create a form to be filled out. But there are even better ways to do that. The main use would be to copy an original that used them. One of the issues is that underlining can be confused with links, so that hastened its way out the door. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Software Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 190
Karma: 89000
Join Date: Jan 2014
Location: Germany
Device: PocketBook Touch Lux 3
|
Rendering software should be quite tolerant regarding validity, processing tools should not be required to be overly tolerant to all kinds of non-standard data junk, and creation tools should absolutely follow a zero tolerance policy. The fact that underlining is bad typography is a separate issue besides technical correctness. Syntactical and semantical correctness are the bare minimum for 21st century web and e-book technology.
Last edited by skreutzer; 04-17-2014 at 04:53 PM. |
![]() |
![]() |
![]() |
#7 | |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Quote:
![]() Thanks for the tips, I'll try and implement them this evening (European time ![]() |
|
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
To be fair, <b> and <i> are also deprecated but no warnings will be given for those. Honestly I do not see them go away very soon either...
|
![]() |
![]() |
![]() |
#9 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Should I post on the editor forum that the editor toolbar has deprecated elements? Or do you think Goyal has a good reason to be still using them?
|
![]() |
![]() |
![]() |
#10 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Quote:
The <u> element was deprecated in HTML 4.01. (the <u> element was used to define underlined text). The <u> element is redefined in HTML5, to represent text that should be stylistically different from normal text, such as misspelled words or proper nouns in Chinese. Reference: http://www.w3schools.com/Tags/tag_u.asp |
|
![]() |
![]() |
![]() |
#11 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Sure, but how does that answer my question? The toolbar in the editor uses the <u> element to underline text, not to write in Chinese.
|
![]() |
![]() |
![]() |
#12 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
It's an element you can use, you can always define it's style in your stylesheet.
In a couple of hours when I'm back home I'll check this thoroughly. |
![]() |
![]() |
![]() |
#13 |
Software Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 190
Karma: 89000
Join Date: Jan 2014
Location: Germany
Device: PocketBook Touch Lux 3
|
No, you can't (in EPUB at least):
http://www.idpf.org/epub/20/spec/OPS...htm#Section2.2 Since it was already deprecated, I guess they just threw it out in order to define a more futuristic use of HTML elements. |
![]() |
![]() |
![]() |
#14 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
I posted it on the editor forum, maybe Goyal has an explanation.
https://www.mobileread.com/forums/sho...09#post2812109 |
![]() |
![]() |
![]() |
#15 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
And he did. I should just ignore the errors, epub validation is a waste of time.
Cheers y'all! |
![]() |
![]() |
![]() |
Tags |
validation error |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
The element type "p" must be terminated by the matching end-tag "</p>". | uieluck | ePub | 10 | 02-12-2013 07:04 PM |
element "img" not allowed in this context | graniton | Calibre | 5 | 05-14-2012 11:39 PM |
ePub validation error: 'element "span" not allowed here' | nannygoats | ePub | 5 | 11-30-2011 08:47 AM |
element "span" not allowed in this context | jihwan | Calibre | 4 | 07-17-2010 09:25 PM |
Crash on nonexistent "title" metadata element | Valloric | EPUBReader | 3 | 12-10-2009 01:46 PM |