Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-09-2016, 03:07 AM   #1
arthurattwell
Member
arthurattwell is on a distinguished road
 
Posts: 12
Karma: 56
Join Date: Dec 2008
Device: None
Internal links not updating after file split (Sigil 0.9.3, Win 10)

I have an epub with internal links between HTML files, and Sigil <hr> split markers. When I run Split Markers:

* internal links in the split files update correctly;
* links to the split files from other files do not update.

Is this expected behaviour, or should Sigil be updating internal links in all files?

Here are more details:

I've attached two sample epubs:

* test-pre-split.epub
* test-post-split.epub

They include a contents page (0-3-contents.html) with internal links to chapters (1.html). And each chapter has a linked footnote. I'm splitting 1.html into three files: 1.html (chapter 1), 1_0001.html (chapter 2), 1_0002.html (Notes).

If I run Split Markers on test-pre-split.epub, the footnote links (within 1.html) update correctly, as does the NCX. But the links on the contents page to ID anchors in 1.html do not update when splitting. (See test-post-split.epub.)

(Incidentally, while test-post-split.epub passes FlightCrew, EpubCheck 4.0.1 throws a 'fragment identifier is not defined' error at the Contents page file.)

I'm using Sigil 0.9.3 on Windows 10.
Attached Files
File Type: epub test-pre-split.epub (29.5 KB, 44 views)
File Type: epub test-post-split.epub (30.9 KB, 48 views)
arthurattwell is offline   Reply With Quote
Advert
Old 03-09-2016, 03:39 AM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 3,852
Karma: 10339686
Join Date: Dec 2010
Device: Kindle PW2
I just tested your files with Sigil 0.9.3 on my Windows machine and I wasn't able to reproduce your results.

The links in 0-3-contents.html are changed from:

Code:
<ol>
  <li><a href="../Text/1.html#hello-world">Chapter 1 – Hello world</a></li>
  <li><a href="../Text/1.html#goodbye-world">Chapter 2 – Goodbye world</a></li>
</ol>
to:

Code:
<ol>
  <li><a href="../Text/1.html#hello-world">Chapter 1 – Hello world</a></li>
  <li><a href="../Text/1_0001.html#goodbye-world">Chapter 2 – Goodbye world</a></li>
</ol>
and the report tool doesn't report any broken links.

However, I occasionally experienced broken links after file splitting with older Sigil versions, but I never could figure out what caused the problem.
Attached Thumbnails
Click image for larger version

Name:	LinkReport.jpg
Views:	86
Size:	19.8 KB
ID:	146993  
Doitsu is offline   Reply With Quote
Old 03-09-2016, 09:41 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 16,729
Karma: 87034980
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Doitsu View Post
However, I occasionally experienced broken links after file splitting with older Sigil versions, but I never could figure out what caused the problem.
I did occasionally too (when splitting/merging), but it hasn't happened to me in a long, long time. That's not to say that there couldn't be a long-standing bug still present that my workflow just doesn't expose. I think there just might be one, actually. I've seen too many similar reports (all through Sigil's evolution) to dismiss it. I just wish someone could nail down the steps to reproduce it consistently (if it exists) so we could stomp on it.
DiapDealer is online now   Reply With Quote
Old 03-09-2016, 09:46 AM   #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: 20,790
Karma: 20350408
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
I have occasionally had 'now broken' issues caused by deleted files

messing with/leaving behind those with relative anchors
Code:
<a href="../Text/1.html#goodbye-world">Chapter 2 – Goodbye world</a>
leaves
Code:
<a href="../#goodbye-world">Chapter 2 – Goodbye world</a>
but I have not had a properly formed (in original) end up broken in a simple split

(I use both the 'at marker' method and the immediate split)
theducks is offline   Reply With Quote
Old 03-09-2016, 10:31 AM   #5
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,524
Karma: 772404
Join Date: Nov 2009
Device: many
I can not recreate this on Mac OS X either. All links are properly updated. I have been studying the split and merge code and it is reasonably complex using both regular expressions in some places as well as anchor updates throughout all xhtml files. Both the splitting and the updating of links use multiple threads to handle the updating more quickly and if split markers are put in more than one xhtml file at the same time, these two concurrent things could conceivably interfere where one is reading in from a file while the other is writing something to it. That said, the Qt Read/Write Locks should prevent this but I have no idea if these locks allow rentry by the same thread. Outside of that possibly non-existant issue, I can not see how updating can be skipped randomly.

So as DiapDealer said, if anyone can get this issue to happen in a repeatable manner, we should be able to "stomp" on it ;-)

KevinH
KevinH is offline   Reply With Quote
Old 03-09-2016, 03:21 PM   #6
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 629
Karma: 1771606
Join Date: Nov 2011
Device: none
Does the book pass validation before the splitting?
exaltedwombat is offline   Reply With Quote
Old 03-09-2016, 03:22 PM   #7
arthurattwell
Member
arthurattwell is on a distinguished road
 
Posts: 12
Karma: 56
Join Date: Dec 2008
Device: None
Thanks, everyone, for the lightning-fast replies. I'm sorry, it seems I was hasty and missed something important: the links do update correctly if I close and open the epub *before* running Split at Markers. That is, if I first let Sigil rewrite all internal link paths according to its `../Text/` folder structure.

In all my testing, I never tried closing and opening the epub in Sigil before running Split at Markers.

I'm assembling epubs from standalone HTML files. My source HTML files' internal links are relative within their folder:

href="1.html#hello-world"

Upon opening an epub, Sigil (correctly) rewrites all existing internal links according to its folder structure:

href="../Text/1.html#hello-world"

But if I add files to an open epub in Sigil (using 'Add Existing Files…'), internal links in those files are not updated until I close and reopen the epub. If I close and reopen the epub, the paths update to `../Text/`.

When running Split at Markers, only the `../Text/` paths are updated, and any relative links in the file being split.

So if I've added HTML files to an epub, it's important to close and open the epub before running Split at Markers.

I've attached a zip file containing two HTML files for testing with.

Steps to get incorrect links:

1. Open blank epub in Sigil
2. Add files containing relative links
3. Run Split at Markers
4. Only links in the file being split (1.html) are updated to new paths. Links in 0-3-contents.html are not updated.

Steps to get correct links:

1. Open blank epub in Sigil
2. Add files containing relative links
3. Save epub, close, reopen. Sigil rewrites all link paths by adding `../Text/`
4. Run Split at Markers
5. All links update to new paths correctly.

The workaround (close, reopen, Split) is simple enough. I don't know whether it would be difficult to get Sigil to update relative links when new files are added to an epub, rather than just on opening an epub. Or, alternatively, to get Sigil to update all internal links first when Split at Markers is run.

Or, of course, if I'm still missing something.
Attached Files
File Type: zip test.zip (5.9 KB, 50 views)
arthurattwell is offline   Reply With Quote
Old 03-09-2016, 03:34 PM   #8
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,524
Karma: 772404
Join Date: Nov 2009
Device: many
Hi,
So something is broken. You should not need to save and close the epub. In what order are you adding existing html files? If you add an existing html file that has links to other htmlfiles, it should automatically pull them all in. Does this issue happen when you use the ImportHTML menu on a file with links to other html files? Does that approach automatically pull in all of the new html files?
KevinH is offline   Reply With Quote
Old 03-09-2016, 03:54 PM   #9
arthurattwell
Member
arthurattwell is on a distinguished road
 
Posts: 12
Karma: 56
Join Date: Dec 2008
Device: None
Hi @KevinH

I've tried adding the files in different orders: files with links to other HTML files first, and the reverse. And I've tried using both 'Add Existing Files' and 'File > Open'.

In all cases, internal link paths do not update, and linked HTML files are not automatically pulled in.

Linked images and linked stylesheets *are* pulled in correctly.
arthurattwell is offline   Reply With Quote
Old 03-09-2016, 04:11 PM   #10
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,524
Karma: 772404
Join Date: Nov 2009
Device: many
Hi,
I think the assumption made by earlier developers is that adding existing xhtml assumes no links to other unloaded xhtml pages. Not sure why they would make that assumption when they allow for links to unloaded images and stylesheets.

KevinH

Last edited by KevinH; 03-09-2016 at 07:52 PM.
KevinH is offline   Reply With Quote
Old 03-09-2016, 05:35 PM   #11
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,524
Karma: 772404
Join Date: Nov 2009
Device: many
@arthurattwell

Yes, this is an issue. When added **sequentially** in any order there is no way to know those other targets exist and therefore the relative links are not updated (in other words why would a individual file you imported have valid relative links to files already inside the epub and visa versa.

So we need to completely rewrite the ImportHTML to pull in multiple linked html files if they exist and then update the whole shebang together, much like how it loads an epub now.

We are simply too close to Sigil-0.9.4 release to change that much code. I will add it to my to-do list for Sigil-0.9.5.

So please continue to use your workaround.

Thanks for your bug report.

KevinH
KevinH is offline   Reply With Quote
Old 03-10-2016, 01:59 AM   #12
arthurattwell
Member
arthurattwell is on a distinguished road
 
Posts: 12
Karma: 56
Join Date: Dec 2008
Device: None
Thanks, @KevinH. I'm very happy to use my workaround.

Just to mention: the links are not updated whether adding the files one at a time or adding multiple files at once with 'Add Existing Files'.

Thanks for all the work on this great tool.
arthurattwell is offline   Reply With Quote
Old 03-10-2016, 06:40 AM   #13
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,524
Karma: 772404
Join Date: Nov 2009
Device: many
Yes, it seems Add Existing even with multiple files just adds them one by one.
KevinH
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
split html files not updating links ni_c Editor 4 11-24-2015 11:48 PM
When you split a file does Sigil update links? JimmyG Sigil 2 10-31-2013 01:02 PM
Sigil TOC breaks internal links LarsEighner Sigil 1 09-03-2013 10:23 AM
Internal links not working after Packaging (copying) indb file MHC ePub 6 03-09-2013 01:50 PM
Links to URLs work, internal links don't? NewDay ePub 36 10-27-2010 04:09 AM


All times are GMT -4. The time now is 09:11 PM.


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