11-18-2012, 06:21 PM | #1 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
0.6 best way to insert hyperlinks??
Still experimenting with 0.6.
Have a question about the best method / technique to insert and maintain hyperlinks Not the mechanics, that's very easy and strieght-forward thanks to the developers, but keeping the links right esp during chapter splits If I split a a chapter the href's sometimes will point to the wrong file: Example of what originally was Section0001 but now is Section0003 Code:
<!-- 'Original One' used to be in this file hence no file prefix but after some Chapter Splitting, this file is now ../Text/Section0003.htm instead of Section0001 Relinking them manually works but is tedious --> <div> <a href="#1">Original One</a><br /> </div> <div> <a href="../Text/Section0001.html#1">Revised One</a><br /> </div> Looking for ideas, suggestions, best practices, etc. Thanks Paul |
11-18-2012, 09:51 PM | #2 |
350 Hoarder
Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
|
Honestly what I do is just ignore links until everything else is done, all page and chapter splits, merges, etc. Only then do I go back and clean up the links as the final step.
|
Advert | |
|
11-18-2012, 11:55 PM | #3 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
yes, I was thinking about that way also.
Insert the anchors as I go, and then the links at the end. I guess I'd have to insert a "plain text" placeholder / reminder where the link will eventually go and then later actually insert the real links at the end when I'm done Your thoughts? |
11-19-2012, 12:16 AM | #4 |
350 Hoarder
Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
|
If it's more than just chapter titles, you could insert any text as your placeholder, even just type <LINK> there, so you can easily search and find those locations later. If it's just for Chapter titles, I wouldn't bother with placeholders, but then I like to make a new page for each new chapter, so I wouldn't have to search through a page for the chapters. But you have multiple chapters on one page, use the placeholders.
|
11-19-2012, 06:32 AM | #5 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
If you use clips, insert a link placeholder is very easy. If you use an odd character sequence you can avoid search ending up within a word.
It is not really so bad to do it at the end, since you will want to test your links anyway. I insert one, jump to the reference, insert the link there and jump back then go on. That way I can see them working. |
Advert | |
|
11-19-2012, 06:57 AM | #6 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
The issue of broken anchor links where they consist of an href without a file prefix is really a bug/limitation in Sigil (that also occurred in 0.5.3). I will take a look at how easy that is to fix. Any valid anchor links which are fully quallified with a filename should be preserved no matter what split, merge or rename operations you perform, but this is one edge case which has been missed.
The other known case is NCX links not surviving merge operations, but that is intentional for the moment. Edit: Actually I thought I had replicated a splitting issue like the OP posted, but subsequently realised it is actually behaving correctly (my href was to a different id than the one I thought, thereby being on the same page after the split and hence untouched). So if you are able to come up with a repro case where splitting does indeed break initially valid links then I would be interested to see it. Last edited by kiwidude; 11-19-2012 at 07:28 AM. |
11-19-2012, 05:29 PM | #7 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Well ... here's what I was doing.
'Single File.epub' has 4 H1's with the links to the first 3 in the fourth. Works just as I'd expect. Everything in Section0001 (because there is only one) Created an anchor in the first 3 H1's and links in the fourth (below): Code:
<h1 id="sigil_toc_id_22">Here there be links</h1> <div> This is <a href="#Link_One">link one</a> </div> <div> This is <a href="#Link_Two">link two</a> </div> <div> and this is <a href="#Link_Three">link 3</a> </div> so this used to be in Section0001 with its anchor also in Section001. Code:
<a href="#Link_One">link one</a> Similarly for the other two href's -- their anchors are in Section002 and Section003 HTH Paul |
11-20-2012, 03:21 AM | #8 |
Sigil developer
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Using Split at Cursor just above the H1's in your single file epub works okay for me in the latest source. The filenames are added and are correct. I don't think anything in split changed since 0.6.0 but we'll re-test.
Now if you use just the code fragment in your post (the one without the id=Link_One in it), then when you split the filenames are not added - this is because the href points to a non-existent link so it can't find it again to re-link it. But this doesn't seem to be your issue. |
11-20-2012, 04:58 AM | #9 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@meme - no there is definitely a problem in there. In fact possibly two issues.
Open the Single file.epub. In Book View, place the cursor on the line before "Heading 1c", and do a split. Now if you click on "link one", you will find it works, and you think "hey, no problem". However note that (1) if you switch back to the Section0002.html file and try to click it again the link does not work a second time (nor does link two). And (2) if you switch to code view and look at the underlying html that they remain as href="#Link_One" without the file prefix which explains why it won't work for subsequent clicks. So I'm not sure why it works for that first click, and it seems it isn't doing all the relinking completely as far as the hrefs are concerned. |
11-20-2012, 05:09 AM | #10 |
Sigil developer
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Yep, I see the issue - in Book View. Of course, I was working in Code View where I usually work and it splits ok there.
|
11-20-2012, 05:34 AM | #11 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Yeah I think that it works in Code View but not in Book View is what fooled me with my original post above - where I thought I had replicated the problem and subsequently couldn't. I must have been in Book View that first time causing me to post.
It doesn't work in 0.5.3 in *either* view, so it looks like something that got "partially improved" with 0.6. |
11-20-2012, 07:48 AM | #12 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
1. Thanks for looking at it
2. I wasn't saying it was a bug, I figured it was a. Working the way it was programmed b. Just one of those things 3. I usually check what I'm done so far by opening the saved .epub in ADE 4. If it is something that gets fixed, that's be great and will make it easier for us newbies to not make silly mistakes Paul Last edited by phossler; 11-20-2012 at 07:51 AM. Reason: Hit the wrong button on the **$#&*#^ keyboard |
11-20-2012, 01:52 PM | #13 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Thought occurs ... If I were to merge 2 or more files, would the file references be incorrect?
I usually do that kind of Chapter Splitting stuff in Book View, I'll have to try doing it in Code View, at least as a workaround Paul |
11-20-2012, 02:13 PM | #14 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
11-20-2012, 06:10 PM | #15 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
Not better, not worse -- just different As regards your reccomendation, I can see the merit in that, but I'm a WYSIWYG kind of person, and just not good enough to work in code view all the time. But for anything complicated, I'll try that way Paul |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hi, I am new here, Who can tell me how to insert my signature? | yakest | Introduce Yourself | 1 | 06-23-2011 12:12 AM |
Metadata insert | Bluebaize | Calibre | 4 | 06-22-2011 06:51 PM |
Insert a Picture? | MickeyC | Feedback | 6 | 06-13-2011 12:39 PM |
Insert Hyperlinks in Feed Articles | Bushwil | Recipes | 1 | 01-21-2011 02:51 PM |
Insert metadata | Landrovan | Calibre | 1 | 10-05-2009 01:36 PM |