![]() |
#1 |
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
HTML to EPUB, how to keep classes?
We have foot notes that are links:
Code:
<a name="txt51" id="txt51"></a><a class="footnote" href="#ftn51" title="Note 51">51</a> The class is needed because the number 51 is a <sup> tag but made only using CSS. If the class is removed it is not possible to style the link anymore to be a <sup>. Is there any way from stopping Calibre from removing specific classes? ![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
Quote:
However this is not a bug. It's what Calibre does by default. If there is a link as shown in my previous reply, it will be converted to a link with it's own class, Calibre will give it a class on it's own. And it will remove the class called "footnote". What I am asking is this; is it possible to instruct Calibre to keep the class "footnote"? Calibre could keep adding it's own classes but to keep that specific one? It seem it would be simple to do that. Anyone know how? |
|
![]() |
![]() |
#4 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
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:
Calibre will analyze and make its changes/additions that are consistent with the other tasks it is performing. Not all classes get changed. You may be doing something that is inconsistent with other (document wide) instructions, so it has to help it along. |
|
![]() |
![]() |
#5 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,718
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre conversion will try to keep what existing classnames it can thaat are conistent with CSS flattening. That may or may not work for any particular class name. But what conversion will not do is remove formatting (unless you tell it to). So the visual appearance of the text from the input and output documents should be the same (or as similar as format differences allow).
|
![]() |
![]() |
#7 |
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
Let's try it a different way;
Please convert this HTML: https://pastebin.com/Quk0kqxh into the ePUB. And the output of the footnote should look like this: Notice how the footnote number is styled as a superscript. Is smaller and higher than the rest of the text. Can anyone do that using Calibre with that HTML? If yes, how? When I tried the footnote appeared like a regular text size, not a superscript. And it is because Calibre removes classes from footnote links. Last edited by BetterRed; 07-25-2019 at 06:56 PM. Reason: Embed Image - (paper clip icon) |
![]() |
![]() |
#8 | ||
Not Quite Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Quote:
Quote:
Last edited by Brett Merkey; 07-25-2019 at 04:46 PM. |
||
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No it is not because of classes, why dont you paste your own HTML into a standalone HTML and open it in a browser, you will see that the the footnote links are not rendered as superscripts. In order for them to be rendered as superscripts, the linked CSS files also need to be present to give the classes meaning. And if the linked CSS files are also present, calibre will use them. And just for completeness, here is an actual HTML snippet that uses classes for superscripts that will work in a browser and in calibre, because unlike the HTML you posted, it actually contains the style definitions.
Code:
<html><body><style>.ss { vertical-align:super}</style><p>A<span class="ss">superscript</span></p></body><html> |
![]() |
![]() |
#10 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,155
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
In the HTML file, there are references to 3 stylesheets between the head and end of head tags: Code:
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Legislative Summary of Bill C-XX: </title> <link rel="stylesheet" type="text/css" href="/Content/LOP/ResearchPublications/styles/2012pubs.css" media="screen"/> <link rel="stylesheet" type="text/css" href="/Content/LOP/ResearchPublications/styles/2012pubs_print.css" media="print"/> <!--Remove stylesheet below before posting. Only need stylesheets above --> <link href="../../../Styles/2012pubs.css" rel="stylesheet" type="text/css" media="screen"/> </head> Last edited by DNSB; 07-26-2019 at 05:59 PM. |
|
![]() |
![]() |
#11 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
Quote:
The links in the HTML are with a class footnote, it does not have a <sup> tag. And the HTML cannot be changed. Calibre should be able to keep the class footnote in the link if we ask it to. Otherwise I am looking at manually editing thousands of pages just to make it work with Calibre. The class footnote is used in a different stylesheet but that is not relevant. Calibre should leave the class footnote alone if we tell it to. If a class is needed, it should have that option. So far the best solution is the CSS offered by user Brett Merkey. But that is not a solution for the long term. Please give Calibre an option to keep a class if we mention that class. |
|
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
@MistaPrime,
What a sense of entitlement you have! Lots of "calibre should do x" in there. If you have a client who is paying you for a service then the onus is all on you to find a suitable solution. To tell a developer, who is not charging for his services what his software should/shouldn't be doing to make your professional life easier, quite frankly, beggars belief. Of course you could have gone through the normal channel for requesting (nicely) a calibre enhancement and hoped for the best but you chose to try to dictate and belittle instead. Well, good luck with that approach, it rarely works. |
![]() |
![]() |
#13 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,155
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
If you have a class in a stylesheet, calibre will not remove it fom the HTML files. If you don't have a class used in the HTML that is not in a stylesheet, it is an unused reference and will be removed. Even if calibre left an unused class in the HTML, it would not work since there is no stylesheet to supply the information for that class. This leaves out calibre's habit of flattening stylesheets but that still leaves a class in the HTML. Or are you planning to adding a stylesheet into the epub after using calibre to create it in a frenzy of manual editing? So stop trying to convert a naked HTML file to an epub. What you should be doing is generating a file with the HTML and CSS files so calibre has that information available. You can download the webpage and add the files into a .zip file and then use calibre on that .zip file to generate an epub which includes the HTML and CSS (plus any downloaded images, etc.) which you then edit to remove the cruft. Edit: I noticed you used the term "we" and not I several times in your posts. Given that the HTML you posted appears to be from a Canadian government site, you should consider hiring someone semi-competent. Someone who might understand a a webpage is not just the raw HTML files but the supporting code (CSS stylesheets, javascript, etc.). Last edited by DNSB; 07-29-2019 at 12:10 PM. Reason: Added comment about "we"... |
|
![]() |
![]() |
#14 | |
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
Quote:
There is no "sense of entitlement" in there, only your sense of pointlessly reading between the unnecessary lines and your sense of absurdity along with your sense of being very wrong. In my view Calibre "should" have that option, that is not an order or demand, that is just a suggestion. I thank you all for your input on this, I will definitely use the CSS suggestion as that is the quickest and most suitable work-around for this purpose. |
|
![]() |
![]() |
#15 | ||
Member
![]() Posts: 11
Karma: 10
Join Date: Jul 2019
Device: EPUB
|
Quote:
Thanks for your suggestion, I appreciate that. Quote:
Regarding the competency level comment, I am not good at reading between the lines but if you are attempting to judge my competency in HTML based on the request above, you may want to re-read the request. Thanks for the input, your help has been greatly appreciated. |
||
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pseudo classes to be deleted as unused classes | Leonatus | Sigil | 2 | 09-23-2018 09:12 AM |
docx to epub - obsolete classes for italic and bold | krbo | Conversion | 2 | 01-09-2014 05:44 AM |
CSS classes on Android epub readers | MarleneW | ePub | 7 | 05-13-2012 04:57 PM |
txt to Epub - adding classes with textile | Nareshkendel | Conversion | 4 | 11-23-2011 05:30 PM |
Why, During ePub to ePub Conversion does Calibre changes existing CSS classes? | JSWolf | Conversion | 7 | 08-06-2011 07:32 PM |