01-08-2018, 09:45 PM | #1 |
Enthusiast
Posts: 28
Karma: 10
Join Date: Jun 2010
Device: none
|
Help with links
I have a couple of thousand links I need to link to anchors and I was wondering if there was a regex or something like that that would help me do this.
currently I have <a href="#pg11">11<a/> etc etc and I need to link them to the correct id's (which are already in place) which are scattered across several files within the same book. The early versions of sigil used to do this automatically but now it doesn't so I wondered if anybody could help Thanks in advance soparch |
01-08-2018, 11:40 PM | #2 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
The only way I think a regex will help is if you have already used some kind of logical method to link the two. eg <a href="#pg11">11</a> and <p id="link11">
Can you show us a sample of the kinds of id's you used?? Also, Sigil automagically UPDATES existing, valid, links when you change things like renaming files, but I don't think it will create the links from scratch for you... perhaps one more knowledgeable than I will chime in for that. |
Advert | |
|
01-08-2018, 11:46 PM | #3 | |
null operator (he/him)
Posts: 20,570
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
01-09-2018, 02:10 AM | #4 | |
Well trained by Cats
Posts: 29,803
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
01-09-2018, 02:32 AM | #5 |
Obsessively Dedicated...
Posts: 3,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
It sounds to me as though your trouble is caused by lack of file-name in the href. If you don't mind klunkyness, this is what I have done when faced with this same kind of situation:
1--Insert a split marker at the top of every file except the very first one(patience, you will see why) 2--Merge all your files into one. Rename it if you like. 3--Using Search and Replace, go through and redo all the href's to include the full path as follows: <a href="#pg to <a href="../Text/Merged.xhtml#pg Of course, you would use the ACTUAL filename and extension. If you have other prefixes for some id's, you need to follow the same procedure for those. 4--In BookView, test at least some of the links to see if they still work. Tweak if needed. When all is ok, 5--Go to Edit>Split At Markers. Re-name the new splits if desired. Your href's should update to show the new file name where the target id resides. To prevent this from happening in future, ALWAYS use the full path in the href string : ="../Text/filename.extension#idname. Then your links should survive no matter how many times you split, merge, and/or re-name the files. Hope this helps. Good luck! Last edited by GrannyGrump; 01-09-2018 at 05:31 AM. |
Advert | |
|
01-09-2018, 02:57 AM | #6 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Alternatively, you might be able to use my AddIDs plugin to add sequential ids to footnotes and footnote definitions. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Touch Normal links becomes footnotes links in epub made with Calibre | il_mix | Kobo Reader | 15 | 08-10-2014 01:19 PM |
Convert external links to internal links | sup | Recipes | 2 | 11-28-2013 09:39 AM |
Links in Wikipedia | Araucaria | Workshop | 0 | 04-04-2013 07:04 AM |
Links | Bather | General Discussions | 2 | 02-04-2011 03:26 PM |
Links to URLs work, internal links don't? | NewDay | ePub | 36 | 10-27-2010 04:09 AM |