Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 03-09-2023, 02:08 PM   #1
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 776
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Forma
Files with <a...></a> Tags Don't Beautify

I run into this quite a bit. It might be with other tags as well, but it looks like files that include <a...></a> tags don't want to beautify (Tools > Beautify All Files) in the Editor. Nothing seems to happen when I try. Is that expected behavior?

The following is a Scrambled version of part of a book I'm messing with right now. Supposedly, it's been beautified. But, the heading and paragraph don't even get indented. Just removing the leading <a> tag pair lets the indentations happen.
Code:
<a id="GBS.0245.01"></a>

  <section class="aboutauthorpage">

<h2><span epub:type="pagebreak" id="pg_2" title="2"></span>Zqpsi zhs Cn*jmxp</h2>

<p class="center"><img src="../images/epub_Scalzi_2016_no_cr_fmt.jpeg" alt="Photo of John Scalzi" class="imgsetwidth"/><a id="GBS.0245.02"></a></p>

<p><a href="http://us.macmillan.com/author/johnscalzi?utm_source=ebook&amp;utm_medium=adcard&amp;utm_term=ebookreaders&amp;utm_content=johnscalzi_authorpage_macdotcom&amp;utm_campaign=9780765388926"><span class="smallcaps">Yxty Tojzak</span></a> pf evu xd okf moam nae*k*qhk vzs di*uaticmp BC ik*wwauq vo yywwat xh thk qgvi dncwuj. Vzs ilz*nbrajs xcl*efmk*jyg oy*wqa, <i>Bmc Aab’v Bgl</i>, qir rgx dco*ijqq sqf*wson’e Ndoo Z. Zdjg*hdun Elzvn cym Lnvn Ktj Ncsmze. Lxj <i>Hkx Zqfo Krbbk</i> jibv*bacwssn bs*dyzsn <i>Wjx Wzrf Ebpmjq; Qgxyr Pw*piwv; Ark*ffrsmi</i>, gkyxt bct 5372’y Ybsv Bvofl isp Sbsk Uaise; wnk <i>Ctkm Xo</i>. Ql*cy*gzqy nsiv lhb uoehbm wmnc qcap, <i>Izen*idyk</i> (<a href="http://whatever.scalzi.com">mpan*mctr.vdbmmh.rnn</a><a id="GBS.0245.03"></a>), pgi oqeb sdgcnr oyr hwi scvom Kvbh Icaphd. Bk taobr ps Wfbk mtnf qfy sqoy anj upaco*ywl. Ysw tda gcno mh ckz bzekb jn*saewk <a href="http://us.macmillan.com/authoralerts?authorName=johnscalzi&amp;authorRefId=1351591&amp;utm_source=ebook&amp;utm_medium=adcard&amp;utm_term=ebookreaders&amp;utm_content=johnscalzi_authoralertsignup_macdotcom&amp;utm_campaign=9780765388926">beci</a>.</p>

<a id="GBS.0246.01"></a><a id="GBS.0246.02"></a>
</section>

</body>
enuddleyarbl is offline   Reply With Quote
Old 03-09-2023, 02:25 PM   #2
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
I think <a> tags are supposed to be enclosed in a block tag, e.g. <p> or <div>. Correcting them will probably make Beautify work properly. I've often seen "detached" <span> tags similarly misused in epubs.

In your particular example those Google Books epub <a> tags are usually worthless (IMO) so just removing them will also make the Beautify problem go away.
jackie_w is offline   Reply With Quote
Advert
Old 03-09-2023, 05:19 PM   #3
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 776
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Forma
I'd been wondering what those "GBS..." tags were. Yes. A Google Books book. I'll probably just delete the lot of them. But, this happens in quite a few books where they're just trying to put in dead-tree page numbers. I also see them with simple non-page number ids: <a id="frontmatter"> or something. Again, with these GBS ids, I'll probably just trash them. For the others, I try to preserve them. If I'm lucky, I can just do a regex search/replace and move the id into a <section> or <h#> tag. But, sometimes, those already contain another id and I don't know what to do with those.

I can't find anything about anchor elements (<a> tags) having to be enclosed in a block-type tag anywhere. AFAICT, the spec doesn't talk about it and the examples don't indicate one way or another. But, neither Calibre's Check Book tool or EPubCheck have any problem with them that way.

It's just odd that the Beautify tool just seems to do nothing with pages that start out like that if the checking tools don't see anything wrong.
enuddleyarbl is offline   Reply With Quote
Old 03-09-2023, 05:27 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,064
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by enuddleyarbl View Post
I'd been wondering what those "GBS..." tags were. Yes. A Google Books book. I'll probably just delete the lot of them. But, this happens in quite a few books where they're just trying to put in dead-tree page numbers. I also see them with simple non-page number ids: <a id="frontmatter"> or something. Again, with these GBS ids, I'll probably just trash them. For the others, I try to preserve them. If I'm lucky, I can just do a regex search/replace and move the id into a <section> or <h#> tag. But, sometimes, those already contain another id and I don't know what to do with those.

I can't find anything about anchor elements (<a> tags) having to be enclosed in a block-type tag anywhere. AFAICT, the spec doesn't talk about it and the examples don't indicate one way or another. But, neither Calibre's Check Book tool or EPubCheck have any problem with them that way.

It's just odd that the Beautify tool just seems to do nothing with pages that start out like that if the checking tools don't see anything wrong.
I think reverse of your logic is the norm.
If it ain't a block tag, then it needs to be in one.
(and yes, you are not the only one seein' Naked anchors. There is a ton of bad/messy code and it ain't all from indies.)
theducks is offline   Reply With Quote
Old 03-09-2023, 05:43 PM   #5
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,188
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Use the modify epub plugin to remove the google play page maps. see screenshot.

bernie
Quote:
Originally Posted by enuddleyarbl View Post
I'd been wondering what those "GBS..." tags were. Yes. A Google Books book. I'll probably just delete the lot of them. But, this happens in quite a few books where they're just trying to put in dead-tree page numbers. I also see them with simple non-page number ids: <a id="frontmatter"> or something. Again, with these GBS ids, I'll probably just trash them. For the others, I try to preserve them. If I'm lucky, I can just do a regex search/replace and move the id into a <section> or <h#> tag. But, sometimes, those already contain another id and I don't know what to do with those.

I can't find anything about anchor elements (<a> tags) having to be enclosed in a block-type tag anywhere. AFAICT, the spec doesn't talk about it and the examples don't indicate one way or another. But, neither Calibre's Check Book tool or EPubCheck have any problem with them that way.

It's just odd that the Beautify tool just seems to do nothing with pages that start out like that if the checking tools don't see anything wrong.
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2023-03-09 17-39-07.png
Views:	122
Size:	82.0 KB
ID:	200224  
gbm is offline   Reply With Quote
Advert
Old 03-09-2023, 06:22 PM   #6
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 776
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Forma
I've removed those GBS anchors without problem.

I'll also note that the <div> and <figure> tag also suffer the same lack of Beautification if there's an <a></a> tag in there with an image (I usually see it between the <div> or <figure> start tag and the <img> start tag it contains. For instance:
Code:
<div id="fig_1"><a></a><img src="../images/00005.jpeg" alt="Thror's Map" class="imgfull"/></div>
will not beautify (ditto for the <figure> version). But, delete the <a> tag pair and it beautifies just fine.

Last edited by enuddleyarbl; 03-09-2023 at 07:05 PM.
enuddleyarbl is offline   Reply With Quote
Old 03-09-2023, 06:56 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Beautify is very conservative in what it will beautify because in general changing white-space in an HTML file is not safe, it can change rendered appearance.
kovidgoyal is offline   Reply With Quote
Old 03-10-2023, 01:30 AM   #8
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by jackie_w View Post
I think <a> tags are supposed to be enclosed in a block tag, e.g. <p> or <div>.
Hate to disagree, but I've seen <a> tags used at block level, even encompassing <div> and <section> tags.
It turns the whole block into a hyperlink (if a href is added)
Karellen is offline   Reply With Quote
Old 03-10-2023, 05:01 AM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,763
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by gbm View Post
Use the modify epub plugin to remove the google play page maps. see screenshot.

bernie
It doesn't work. I tried it yesterday with an eBook from Google Play Books. I've reported it this morning. I hope it can be fixed easily.

Last edited by JSWolf; 03-10-2023 at 05:10 AM.
JSWolf is offline   Reply With Quote
Old 03-10-2023, 06:43 AM   #10
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by Karellen View Post
Hate to disagree, but I've seen <a> tags used at block level, even encompassing <div> and <section> tags.
It turns the whole block into a hyperlink (if a href is added)
Perhaps I could have worded it better. My use of the phrase "supposed to be" was purely pragmatic in the context of the OP's wish to get a better result from calibre's Beautify. It was not a comment about valid HTML.

I tend to stay out of conversations about HTML/CSS "best practice" which seem to quickly escalate into a thread more suited to MR's "Politics & Religion".
jackie_w is offline   Reply With Quote
Old 03-10-2023, 09:06 AM   #11
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,188
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
I have no idea what you did wrong , but it works for me.

bernie
Quote:
Originally Posted by JSWolf View Post
It doesn't work. I tried it yesterday with an eBook from Google Play Books. I've reported it this morning. I hope it can be fixed easily.
gbm is offline   Reply With Quote
Old 03-10-2023, 10:20 AM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,763
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by gbm View Post
I have no idea what you did wrong , but it works for me.

bernie
It doesn't remove the <a GB stuff.
JSWolf is offline   Reply With Quote
Old 03-10-2023, 10:31 AM   #13
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,188
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
It works. I do not know what you are doing that is incorrect.


bernie
Quote:
Originally Posted by JSWolf View Post
It doesn't remove the <a GB stuff.
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2023-03-10 10-24-51.png
Views:	103
Size:	593.5 KB
ID:	200230   Click image for larger version

Name:	Screenshot from 2023-03-10 10-25-50.png
Views:	90
Size:	213.0 KB
ID:	200231   Click image for larger version

Name:	Screenshot from 2023-03-10 10-27-43.png
Views:	89
Size:	589.3 KB
ID:	200232  
gbm is offline   Reply With Quote
Old 03-10-2023, 10:52 AM   #14
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
@gbm and @JSWolf,

I don't use Modify Epub anymore but I took a quick look at the plugin code. I think the problem may be that the plugin is currently only looking for GBS anchors in their self-closing form
Code:
<a id="GBS..."/>
i.e. not
Code:
<a id="GBS..."></a>
ETA: If Beautify has been run all anchors will look like the latter.

Last edited by jackie_w; 03-10-2023 at 10:55 AM. Reason: ETA
jackie_w is offline   Reply With Quote
Old 03-10-2023, 03:18 PM   #15
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,763
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jackie_w View Post
@gbm and @JSWolf,

I don't use Modify Epub anymore but I took a quick look at the plugin code. I think the problem may be that the plugin is currently only looking for GBS anchors in their self-closing form
Code:
<a id="GBS..."/>
i.e. not
Code:
<a id="GBS..."></a>
ETA: If Beautify has been run all anchors will look like the latter.
That would do it. Thank you. Do you think this is an easy fix?
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
beautify files icon rjwse@aol.com Editor 2 03-26-2021 04:00 PM
Problem with setting "Beautify individual files automatically when they are opened"? Capricorn Editor 3 03-17-2020 07:40 AM
Completion popup - fix all html/beautify all files retiredbiker Editor 7 08-30-2018 01:44 AM
Kindle files and tags Care Calibre 5 12-09-2010 08:17 PM
Break tags don't work in epub conversions Amalthia Calibre 0 04-06-2010 01:07 PM


All times are GMT -4. The time now is 04:47 PM.


MobileRead.com is a privately owned, operated and funded community.