11-11-2015, 01:25 PM | #46 |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi,
If there are parse errors in an xhtml file, then trying to parse the xhtml to change a link location can in fact mess it up even more. The only way to change the link location is by parsing the xhtml. And adding a css link does not cause parse errors unless you add it improperly. So please post a test case where adding a css link causes previously good xhtml to become bad. Please note, that Sigil 0.9.0 no longer uses Tidy so losing large pieces of text should not be an issue any longer. The official xhtml parsing rules via gumbo are used and they autocorrect just like a web-browser does. KevinH |
11-11-2015, 01:44 PM | #47 |
Addict
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
Hi DiapDealer and KevinH
I am attaching one of the test files that I use that generates the error and the css file. The css file would not upload directly so I have put it in a zip file. To reproduce the error in Sigil 0.9 using Python 3.4: Uncheck "Use bundled Python" option in Sigil on the Preferences (Plugins) dialog. Run the plugin. When the main window for the plugin shows, select the css file by clicking on "Select files" and selecting the required css file (attached). Uncheck all the boxes in the main window for the plugin except "Insert CSS file" Select the xhtml file from the list box in the main window for the plugin. Click "Process text" After running the plugin, switching from the cover view window to the book view window will show the error message. Repeat the same procedure in Sigil 0.87 - the error does not appear. Thanks. |
Advert | |
|
11-11-2015, 02:03 PM | #48 |
Addict
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
PS I forgot to mention that if you run the plugin without ticking "Insert CSS file" then the error does not occur.
|
11-11-2015, 02:24 PM | #49 |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Something's definitely botching up the self-closing tags, but I'm having a hard time following what all is going on in the plugin. I may need to make a test plugin that just adds a css file.
|
11-11-2015, 03:14 PM | #50 |
Addict
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
|
I am attaching a plugin that will do this - you will need to edit the filename & path in the plugin (this did not corrupt the ePub when it ran).
|
Advert | |
|
11-11-2015, 04:01 PM | #51 |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It seems to me that a plugin that adds a file to an epub is fine. And a plugin that writes to a file in an epub is fine. But for whatever reason ... a plugin that tries to do both is exposing some sort of crack that broken xhtml leaks out of.
Thanks for the report. |
11-12-2015, 08:32 AM | #52 |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
What is the exact sequence of actions that causes the issue? Perhaps there is a bug in the launcher code here someplace? Is it? 1) add a css file 2) write to a xhtml file the new css link Or is it? 1) write to an existing css file 2) add an xhtml file that references it Or some other plugin sequence? KevinH |
11-12-2015, 09:01 AM | #53 |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
As far as I can see, the file type isn't really relevant. Nor is the sequence. Just the simple act of adding a file to an epub, AND writing to an existing xhtml file in the same plugin seems to be enough to make things go pear-shaped. Doing one or the other alone alone, doesn't.
Your test3 plugin that you used to verify hunspell/gumbo stuff was working in plugins causes the issue for me as well (at least on Windows). Using the Bundled Python3 OR External Python3 I'm pretty sure there is a launcher-code bug here somewhere, but I haven't been able track down where. EDIT: Whatever it ends up being, it seems that writing to an existing file with a plugin seems to bypass the Preserve Entities logic. Last edited by DiapDealer; 11-12-2015 at 09:16 AM. |
11-12-2015, 09:16 AM | #54 |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Wow, that is strange. I just ran my testme3 plugin which both adds a file and writes to a file and everything worked just fine with no warnings about anything (Mac OS X with Embedded Python Interpreter) For the testme3 plugin, exactly what error do you get? Is it the file you wrote too or the file you added that gets messed up? KevinH |
11-12-2015, 09:27 AM | #55 | |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
1) Launch Sigil 2) Open Test3.epub 3) Verify that you can switch from CV to BV (Section0001.xhtml) with no errors. 4) leave Section0001.xhtml open in Code View. 5) run the testme3 plugin. 6) the Section0001.xhtml file becomes corrupted. When switching to BV a "not Well formed" error is issued (at or above line 5: html, head ...) 7) Entities that were set to be preserved are lost. |
|
11-12-2015, 09:33 AM | #56 | |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Quote:
I need to check that. But if you are seeing testme3 cause problems, then I doubt it is is an entity issue as it only reads a file and then writes it back unchanged. KevinH ps. Just saw your post above, I will give it a try. |
|
11-12-2015, 09:48 AM | #57 | |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Quote:
I will try to see what is going on here. The file being modified is being changed when all the plugin does is read from it and write it back so something is broken in the launcher/pluginrunner code that is improperly cleaning the file when it should not. Kevin |
|
11-12-2015, 10:04 AM | #58 |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
Modified testme3 to print out exactly what it read in then write it out, and then reread it and print it again. Everything was completely valid and byte for byte identical. So whatever is creating the problem is somehow either in PluginRunner after completion of the plugin or somewhere else inside sigil when those files are copied back to the real resource before being reloaded. Interesting bug ... KevinH |
11-12-2015, 10:19 AM | #59 |
Sigil Developer
Posts: 7,675
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi DiapDealer,
The bug is in: bool PluginRunner::checkIsWellFormed() In this snippet ... Code:
if (!xmlFilesToCheck.isEmpty()) { foreach (QString href, xhtmlFilesToCheck) { // can't really validate without a full dtd so // auto repair any xml file changes to be safe QString filePath = m_outputDir + "/" + href; ui.statusLbl->setText("Status: checking " + href); QString data = Utility::ReadUnicodeTextFile(filePath); QString newdata = CleanSource::ProcessXML(data); Utility::WriteUnicodeTextFile(newdata, filePath); } } Code:
if (!xmlFilesToCheck.isEmpty()) { foreach (QString href, xmlFilesToCheck) { // can't really validate without a full dtd so // auto repair any xml file changes to be safe QString filePath = m_outputDir + "/" + href; ui.statusLbl->setText("Status: checking " + href); QString data = Utility::ReadUnicodeTextFile(filePath); QString newdata = CleanSource::ProcessXML(data); Utility::WriteUnicodeTextFile(newdata, filePath); } } We still might want to check out entity handling. KevinH ps: fix now pushed to master pps: rebuilt and I can confirm this fixes the issue my test platform Mac OSX Last edited by KevinH; 11-12-2015 at 10:27 AM. |
11-12-2015, 10:20 AM | #60 |
Grand Sorcerer
Posts: 27,568
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Sigil Release: Sigil-0.8.901 | KevinH | Sigil | 137 | 11-03-2015 09:42 AM |
Sigil on Nook vs Sigil on Kobo vs Sigil on iBook | rosshalde | Sigil | 12 | 11-13-2014 09:34 AM |
Release : New Tool to Edit ePubs TOC, Edit with Sigil and keep you TOC | Nigol | ePub | 105 | 10-29-2012 11:40 AM |
Sigil 0.2.0 Release Candidates | Valloric | Sigil | 46 | 05-10-2010 09:55 PM |
Lead time for Kindle book release ahead of print release date - experiences? | Buran | Amazon Kindle | 6 | 05-04-2009 02:29 PM |