Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-08-2018, 09:45 PM   #1
soparch
Enthusiast
soparch began at the beginning.
 
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
soparch is offline   Reply With Quote
Old 01-08-2018, 11:40 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
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.
Turtle91 is offline   Reply With Quote
Advert
Old 01-08-2018, 11:46 PM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,570
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Turtle91 View Post
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.
Would Doitsu's FootnoteLinker plugin be of any use.

BR
BetterRed is offline   Reply With Quote
Old 01-09-2018, 02:10 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: 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:
Originally Posted by soparch View Post
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
Sigil has always had issues updating 'relative' (to the current file) links like you show. filename.ext#pg12 will update when split or renamed
theducks is offline   Reply With Quote
Old 01-09-2018, 02:32 AM   #5
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
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.
GrannyGrump is offline   Reply With Quote
Advert
Old 01-09-2018, 02:57 AM   #6
Doitsu
Grand Sorcerer
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: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by soparch View Post
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.
You might be able to use my footnote linker plugin if the footnotes definitions are all in one file.
Alternatively, you might be able to use my AddIDs plugin to add sequential ids to footnotes and footnote definitions.
Doitsu is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 04:46 AM.


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