|
|
Thread Tools | Search this Thread |
07-06-2020, 01:52 PM | #46 | |
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Jackie_w's ScrambleEbook is a separate plugin that basically replaces text and images making the book unusable except for looking for structural issues. See ScrambleEbook: Getting help with copyrighted books for the link or use calibre's search for plugins. There is also a standalone version for those who don't want to add yet another plugin. See EbookScramble utility post #2 Last edited by DNSB; 07-06-2020 at 02:22 PM. Reason: Edit Standalone version no longer exists. |
|
07-06-2020, 04:55 PM | #47 | |
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
In order to make it less confusing, I unscrambled the ncx to show the original titles and unscrambled all the titles in each file and I renamed the html files to match the toc titles, just to make it easy to see what is what. I'm attaching the file here. This one is a pretty good test case for this because it manages to combine practically every problem you can think of in one file. As you can see, in this file:
Hopefully this makes it easier to see what I'm talking about. Let me know if you'd like me to make a 2nd epub which will have the desired results for each title. |
|
Advert | |
|
07-06-2020, 10:31 PM | #48 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Thanks for your spec. I have to again question why you want a plugin to do that if, as I've said before, you can do that quite easily and quickly just using your current NCX TOC as a reference(unchanged). Just mark all the headings in the relevant xhtml files with an h1 tag if you want them in your TOC. You can use the 'h*' button in Sigil to do that. You only have to mark about 8 main headings with h1 in the xhtml files, which shouldn't take you long. After that, using your current NCX file as a reference(unchanged), you can then just use Sigil's Generate TOC dialog to edit and re-build the TOC the way you want it. And all that is achieved without using any regex! The alternative for me is to create a one-off much-more-complex plugin that is only good for one person because it's so specific. That's also why I'm rapidly losing interest in the plugin now -- because, as I see it, a plugin isn't really necessary.
In my ebooks the epub TOC page and NCX TOC are usually always different. I normally build a complex, mutilevel TOC for my epub TOC page and then I build a simpler single level NCX TOC with headings like "Chapter 1 ~ This is my chapter 1 subtitle", "Chapter 2 ~ This is my chapter 2 subtitle" etc. So my NCX TOC also combines the chapter heading with chapter subtitle just like in your spec. And I do all that quickly and easily just using the Generate TOC dialog in Sigil. You should first create your epub TOC page using Generate TOC + Create TOC and then you can create a different NCX TOC just using Generate TOC again on its own. In the Generate TOC dialog, you can edit the headings and just type in and combine the Chapter heading name with the Chapter subtitle name, exclude any unwanted headings and then press the OK button and you will have a brand new NCX TOC that is formatted to your own preference. Last edited by slowsmile; 07-07-2020 at 04:09 AM. |
07-07-2020, 09:21 AM | #49 | |
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
What is the precise function of the plugin you are working on? From your response here I think the problem you are trying to solve is not the same as the problem I am trying to solve. If you are not interested in pursuing this then please do not continue, it is starting to feel like we are talking at cross purposes and you are right, that is not a productive use of either of our time. |
|
07-07-2020, 12:27 PM | #50 | |
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
It was not a simple project and I was never happy with the results but it taught me quite a bit about Python and making sure I had backup copies. |
|
Advert | |
|
07-07-2020, 01:28 PM | #51 | |
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
But, am I wrong in thinking that you also were using, as your starting point, the html files? I think you're completely right, if you do that, there are too many different possibilities to handle and you'll never manage to make something that can deal with all of them, and it's very very likely you'll break something. Which is exactly why I am not trying to do this using regex. But, BUT! if there is a good TOC in the file already and there could be a way to do a "reverse create TOC" basically, instead of having to resolve all those tricky problems you just go around them. I really believe it must be possible to automate that. Everything you need is already in the toc; the text is there, all you have to do is copy-paste, the link is there, all you have to do is follow it... all the necessary elements are already in the file. I really do think it's as close to a perfect solution as it's possible to get to simply find a way to automate copying the original TOC titles back into the files they link to... if you copy the title into an html comment I cannot even see how you could break the file at all, and that would be one single operation so you don't even have to figure out multiple scenarios. Obviously a bit of work would still be required after that to stick this text into the proper tag or add the attribute or whathaveyou but the most fastidious and annoying part would already be done, no copying and pasting by hand between two files, no mucking about with regexes for various wEiRd CaSeS and random spans or one-to-three br's or a's or sup or anything else, and the whole process would be much smoother because you wouldn't have nearly as many variations to adjust for. I guess I am going to have to do like you and use it to "learn a lot about Python" (lesson 1: apparently Python is what I'll have to learn if I want to make my own plugin). I already have learned the painful lesson about having backup copies during previous "experiments". How hard is Python to learn? (serious question). I am completely comfortable with html and css but I don't know any programming languages. |
|
07-07-2020, 03:53 PM | #52 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
But, hey, if you find a way, good on ya. Hitch |
|
07-07-2020, 09:21 PM | #53 | |
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Can't be bothered to try and remember all of it. In short: From what I've seen, previous attempts have been intended to fix or draw from the headings in the html files. DNSB will correct me if I'm wrong about his method. I agree, this is doomed to failure because too complex and unpredictable. No-one has said to me, "I (or someone) tried to automate copying the titles out of the toc.ncx or nav.xhtml and pasting them into the corresponding html files without touching the heading formatting at all, it's impossible for reason X." KevinH understood precisely what I was trying to do and summed it up very succinctly (idea simplified since then to remove danger of breakage, now I just want to paste the titles into html comments instead of a title attribute or h1 tag) but apart from that the discussion has mostly been about how complicated / impossible it would be to make a plugin to fix the headings. Which is 1. 100% true, no argument from me, and also 2. 100% irrelevant, because I don't want a plugin to fix the bleeding headings, I want a plugin to copy the titles out of the toc.ncx or nav and paste them into an html comment in the corresponding files, which is an entirely different proposition and takes a detour around the whole problem of the unpredictable headings (that is a separate problem the way I see it and much better --and easier-- dealt with using regex). You yourself mention the headings in the html file (h1, h2) which makes me think you haven't understood either what I've been getting at, which is understandable if you have only a passing / zero interest in the question and haven't been following the thread very closely, but in fact I am pretty sure I have found a way to do the specific thing I want to do, I just don't have the technical competencies to implement it. Maybe someday I will, in which case at least this thread will have forced me to think about precisely how to do this and what kind of problems need to be avoided. Last edited by Mister L; 07-07-2020 at 09:27 PM. |
|
07-07-2020, 09:57 PM | #54 | |
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Like most programming tasks, it is simple for the person who is not trying to implement it. For the person who is trying to implement it, you find yourself looking for a larger can so all the worms will fit back in. "All the necessary elements are already in the file"? Bah, humbug. The issues are more that the structure of the epub is different. Even things like where the files are stored in the epub can be a PITA as in recent epub I edited where the text files were partly stored in the root of the archive and partly in a text folder. |
|
07-07-2020, 10:03 PM | #55 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@Mister L...I have some good reasons why I am so frustrated with your plugin requirements. These reasons are:
1. In your post above that contains your bullet-point spec you said that you wanted to transform or combine the headings of h1 and h2 in your xhtml files using the NCX TOC headings. So after 3 whole pages of telling me what you want in your plugin, you then -- on the 4th page -- mention for the first time ever in that spec that you want to combine h1 and h2 for certain headings only. That p*ssed me off because that single requirement means that I will have to redesign the plugin more or less from scratch again. 2. Your requirement that your xhtml headings must to look exactly the same as NCX headings really surprises me. Why do you insist on that? In my ebooks my xhtml headings will look like this: CHAPTER 1 The Tiger Steps Out ...but my NCX TOC headings will look like this: Chapter 1 ~ The Tiger Steps Out I don't change my xhtml headings. Your apparent insistence on the xhtml headings being combined look exactly the same as the NCX headings makes more [unnecessary] work for me wrt the plugin. I honestly can't see any good reasons for that requirement since those two different heading formats that I use(shown above), which are very similar to your current epub headings, shouldn't cause any confusion whatsoever for any reader as far as I can see. Last edited by slowsmile; 07-08-2020 at 02:39 AM. |
07-07-2020, 10:20 PM | #56 |
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
@slowsmile: One thing I have learned from years in IT is that unless the customer is willing to write a specification and stand by it, it's time to walk away while you still have your sanity.
|
07-07-2020, 10:37 PM | #57 |
Witchman
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@DNSB...Well said and so true! The worst are the one's that insist that they want this or that in their epub for no good reason. And even though you warn them or point out the dangers or mistakes they will just keep on insisting. Like you say, if there's no bend then it's time to go...
Last edited by slowsmile; 07-07-2020 at 10:43 PM. |
07-07-2020, 11:18 PM | #58 | |||||
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
Quote:
I tried very hard to explain precisely what I meant, which was to copy the text FROM THE NCX file into title="" attributes in the html file, WITHOUT modifying the html headings. I gave examples of why I might want to do this, which included cases where the titles as displayed in the NCX files are *already* combined from h1 and h2 tags. I gave these explanations multiple times in this thread starting in the first post, but specifically in post 28 I gave examples of code showing the html, the toc code, and the desired result: Quote:
Quote:
I am very sorry if this was not clear to you but I tried my best to explain it, multiple times, starting in the first post of the thread, including directly in response to your posts, with examples of the results I was hoping for. I don't think I could explain more clearly than with the example code I included in post 28. I wish, if you did not understand, you had asked me to clarify certain points before continuing, rather than just going ahead. Frankly this was very frustrating for me too. |
|||||
07-07-2020, 11:22 PM | #59 | ||
Groupie
Posts: 159
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
Quote:
|
||
07-07-2020, 11:56 PM | #60 | ||
Bibliophagist
Posts: 35,498
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Quote:
Someone else may have had less trouble with the code. Perhaps someone without fond memories of a Fortran arithmetic if. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
GUI Plugin "TOC View Generator" (was: Define Content) | Mick2nd | Plugins | 19 | 02-03-2022 09:41 AM |
V3 "Feature" Full Screen Add Book Dialog | johnelle | Library Management | 3 | 08-11-2017 02:43 PM |
A warning for Linux users: slow "Add Books", "Unknown" title and Author | rolgiati | Library Management | 8 | 07-24-2013 04:36 PM |
"Add existing files" doesn't show all directories | Ripplinger | Sigil | 5 | 02-23-2013 11:43 AM |
Feature Request - TOC Exclude "> My Books" | chrisparker | Library Management | 2 | 10-13-2012 11:44 AM |