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

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 01-02-2019, 12:28 PM   #1
rjwse@aol.com
Connoisseur
rjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud ofrjwse@aol.com has much to be proud of
 
Posts: 80
Karma: 27138
Join Date: Dec 2013
Location: Houston
Device: kindle epub readers on android
hyperlink endnotes

A new feature in calibre lets you produce hyperlinks with a saved template. I have searched the user documentation of calibre and have not seen a tutorial to this. I am confused on how to use this. I would be grateful if someone could provide detailed instructions how to make use of this. I cannot understand the far-right panel "choose a location (anchor) in the file" nor how to set up in general. Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2019-01-02 10-18-10.png
Views:	68
Size:	398.7 KB
ID:	168791  
rjwse@aol.com is offline   Reply With Quote
Old 01-03-2019, 01:48 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,939
Karma: 10254170
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You pick a file on the left, the right panel gets populated with all linkable locations in the file (anchors), you pick one and calibre will insert the link for you. If there are no linkable locations in the destination file, then the right list will beblank.
kovidgoyal is offline   Reply With Quote
Advert
Old 01-03-2019, 01:51 AM   #3
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,126
Karma: 6100283
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by rjwse@aol.com View Post
I cannot understand the far-right panel "choose a location (anchor) in the file" nor how to set up in general.
Example. Let's say you want to create a link that jumps to a specific location in the book.

The way you achieve this is to give parts of your book a unique name. In HTML, this is called an "id" anchor.

Chapter02.xhtml:

Code:
<h2 id="HeadingCh2-2">This is Heading 2</h2>
This is the important information you need:
  • It's located in file Chapter02.xhtml
  • Has an id of HeadingCh2-2

Now let's say elsewhere in your book, you wanted to create a link that jumps to this location.

Code:
<p>This is a link to Chapter 2, Heading 2.</p>
First, you select whatever text you want to link:

Code:
<p>This is a link to Chapter 2, Heading 2.</p>
Then you push the Insert Hyperlink button (looks like a chain).

Now you want to tell it where to link to.

The Insert Hyperlink Screen

Click image for larger version

Name:	Calibre.Insert.Hyperlink.png
Views:	27
Size:	11.0 KB
ID:	168802

On the left-hand side, you have a list of Files. Select which one you want the link to jump to (in this case, Chapter02.xhtml).

(Optional) On the right-hand side, you'll see all the "id"s in that file. So it will display all "id"s located in Chapter02.xhtml. Like Kovid said, if no "id"s exist, this side can be completely blank.

Scroll down and select the one you want to jump to.

This will prepopulate all the bottom boxes for you.

After

Once you push OK, Calibre will convert your previous code

Code:
<p>This is a link to Chapter 2, Heading 2.</p>
into:

Quote:
<p>I want this to point to <a href="Chapter02.xhtml#HeadingCh2-2">Chapter 2, Heading 2</a>.</p>
This is an <a> tag. In HTML, <a> is used for links.

Now you can see all your important information located within the link:

Quote:
<p>I want this to point to <a href="Chapter02.xhtml#HeadingCh2-2">Chapter 2, Heading 2</a>.</p>
  • Red tells you the link will jump to Chapter02.xhtml.
    • This is what you selected in the left-side box.
  • (Optional) Blue tells you the link will jump to the id HeadingCh2-2.
    • This is what you selected in the right-side box.

Last edited by Tex2002ans; 01-03-2019 at 01:55 AM.
Tex2002ans is offline   Reply With Quote
Old 01-03-2019, 07:20 AM   #4
thiago.eec
Connoisseur
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 83
Karma: 71600
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Hyperlink template

Quote:
Originally Posted by rjwse@aol.com View Post
A new feature in calibre lets you produce hyperlinks with a saved template. I have searched the user documentation of calibre and have not seen a tutorial to this. I am confused on how to use this. I would be grateful if someone could provide detailed instructions how to make use of this. I cannot understand the far-right panel "choose a location (anchor) in the file" nor how to set up in general. Best regards, Pop
I guess you are interested on the the Template feature, right?
Since your post title is about endnotes, let me give you an example:

Take a look at this normal text inside a chapter:
Code:
<p>This is a normal text with an endnote reference1</p>
Supose your reference is the number "1" left in there:
  1. Select the text you want to be your clickable link (in this case: "1")
  2. Click on the button "Insert Hyperlink"
  3. On the new window, choose the file you will link to and its anchor (see @Tex2002ans detailed explanation above)
  4. Now, on the template field, you must create a pattern that will be repeatable for all you hyperlinks

Since you want to format endnotes, here is an example of a template for an endnote on a EPUB3 file:
Code:
<a href="_TARGET_" class="notes" epub:type="noteref" role="doc-noteref" title="Endnote reference" id="noteref__TEXT_">_TEXT_</a>
Every link will have this structure, so you don't have to repeat it everytime. This is just an example and you can change it to fit your needs.

The only thing I suggest is not to use <sup> on you code. Use css 'vertical-align' instead:

Code:
a.notes {
   vertical-align: super;
   line-height: normal;
   font-size: smaller;
}
thiago.eec is offline   Reply With Quote
Old 01-03-2019, 11:35 AM   #5
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 777
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
I think it'd be helpful if there were a _FILENAME_ placeholder similar to _TARGET_ and _TEXT_ since the_TEXT_ parameter (1, 2, 3, …) might be used in more that one file

I believe that having the option to create the id like this would make it much easier when the user adds the 'back to' link in the end notes

So in chap_01.xhtml when inserting a hyperlink using the template

Code:
<p>text text text more text<a id="chap_01_noteref_.1." href="endnotes.xhtml#endnote_chap_01_.1.">[1]</a> some more text</p>
<p>text text text more text<a id="chap_01_noteref_.2." href="endnotes.xhtml#endnote_chap_01_.2.">[2]</a> some more text</p>
<p>text text text more text<a id="chap_01_noteref_.3." href="endnotes.xhtml#endnote_chap_01_.3.">[3]</a> some more text</p>
and in chap_02.xhtml

Code:
<p>text text text more text<a id="chap_02_noteref_.1." href="endnotes.xhtml#endnote_chap_02_.1.">[1]</a> some more text</p>
<p>text text text more text<a id="chap_02_noteref_.2." href="endnotes.xhtml#endnote_chap_02_.2.">[2]</a> some more text</p>
<p>text text text more text<a id="chap_02_noteref_.3." href="endnotes.xhtml#endnote_chap_02_.3.">[3]</a> some more text</p>

Seems like it would make it easier when generating the 'back to' in Endnotes

Code:
<p><a id="endnote_chap_01_.1." href="chap_01.xhtml#chap_01_noteref_.1.">[1]</a> - Footnote One in Chapter 1</p>
  <p><a id="endnote_chap_01_.2." href="chap_01.xhtml#chap_01_noteref_.2.">[2]</a> - Footnote Two in Chapter 1</p>
  <p><a id="endnote_chap_01_.3." href="chap_01.xhtml#chap_01_noteref_.3.">[3]</a> - Footnote Three in Chapter 1</p>

  <p><a id="endnote_chap_02_.1." href="chap_02.xhtml#chap_02_noteref_.1.">[1]</a> - Footnote One in Chapter 2</p>
  <p><a id="endnote_chap_02_.2." href="chap_02.xhtml#chap_02_noteref_.2.">[2]</a> - Footnote Two in Chapter 2</p>
  <p><a id="endnote_chap_02_.3." href="chap_02.xhtml#chap_02_noteref_.3.">[3]</a> - Footnote Three in Chapter 2</p>
phossler is offline   Reply With Quote
Advert
Old 01-03-2019, 01:21 PM   #6
thiago.eec
Connoisseur
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 83
Karma: 71600
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by phossler View Post
I think it'd be helpful if there were a _FILENAME_ placeholder similar to _TARGET_ and _TEXT_ since the_TEXT_ parameter (1, 2, 3, …) might be used in more that one file

I believe that having the option to create the id like this would make it much easier when the user adds the 'back to' link in the end notes
I agree. It could be handy to have variables for both the target and the file being edit. Something like _TARGET_FILENAME_ and _CURRENT_FILENAME_.

Also, it would be great to SAVE those templates. So we could select then from a drop-down menu, or maybe using code snippets (ctrl+j, on Windows). This way we could have various templates for diferent situations: footnote/endnote reference, footnote/endnote backlink, links to external resources, etc.
thiago.eec is offline   Reply With Quote
Old 01-03-2019, 08:10 PM   #7
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 777
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by thiago.eec View Post
I agree. It could be handy to have variables for both the target and the file being edit. Something like _TARGET_FILENAME_ and _CURRENT_FILENAME_.

Maybe _THISFILE_ and _REFFILE_


Shorter
phossler is offline   Reply With Quote
Old 01-04-2019, 01:28 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,939
Karma: 10254170
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
sure easy to add.
kovidgoyal is offline   Reply With Quote
Old 01-04-2019, 04:15 AM   #9
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 268
Karma: 426060
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook Touch HD
Quote:
Originally Posted by kovidgoyal View Post
sure easy to add.
jbacelar is offline   Reply With Quote
Old 01-04-2019, 05:03 AM   #10
thiago.eec
Connoisseur
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 83
Karma: 71600
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
sure easy to add.
Thanks, Kovid!

Will you add the option to save the templates too? That would be awesome.
thiago.eec is offline   Reply With Quote
Old 01-04-2019, 08:10 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,939
Karma: 10254170
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
there's no option to save but the field has a drop down with recently used templates
kovidgoyal is offline   Reply With Quote
Old 01-04-2019, 08:21 AM   #12
thiago.eec
Connoisseur
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 83
Karma: 71600
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
there's no option to save but the field has a drop down with recently used templates
I am using version 3.37 (x64) on a Windows 10 system. For me, there is no dropdown list.
thiago.eec is offline   Reply With Quote
Old 01-04-2019, 09:07 AM   #13
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 33,939
Karma: 10254170
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
yes because it will be in the next release.
kovidgoyal is offline   Reply With Quote
Old 01-04-2019, 09:42 AM   #14
thiago.eec
Connoisseur
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 83
Karma: 71600
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
yes because it will be in the next release.
Oh, right. I thought you are talking about the current state of this feature.

Thank you for this!
thiago.eec is offline   Reply With Quote
Old 01-04-2019, 10:49 AM   #15
phossler
Guru
phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.phossler can grok the meaning of the universe.
 
Posts: 777
Karma: 156340
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
sure easy to add.
Thanks

This will greatly help putting in 'both ways' hyperlinks

Text --> Note --> Text
phossler 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
Hyperlink to PDF Macsurfcat ePub 4 04-18-2013 05:20 PM
Hyperlink an image scheife ePub 2 03-07-2013 08:43 AM
Remove color behind hyperlink mufc Recipes 4 11-24-2010 08:56 AM
Hyperlink adachim Kobo Reader 0 11-02-2010 11:57 PM
Hyperlink? fcoulter Sigil 3 03-28-2010 11:31 AM


All times are GMT -4. The time now is 02:40 PM.


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