Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 12-07-2020, 07:23 PM   #1
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
How to put chapter title in two places in the index

I have a simple book that uses the normal <h1> tags for the chapter titles. I marked the chapter title text for the index and it shows up in the index fine.

Now I want to put the same chapter into the index using a different entry. Since the chapter title is already marked for the index once, I tried adding a search to the Index Editor where the "Text to include" is the text in the chapter title, and the "Index entry" is the new keyword I would like to add to the index.

The new entry does not appear in the index. Does the index code not search in the <h1> tags?

I marked some text in the first paragraph for the index and my new index entry keywoid, and that works, but when I click on the index entry, the reader (FBReader) puts that text at the top of the screen, leaving out the chapter title.

Is there an easy way for me to add a chapter title to the index in more than one place?

Thanks.
Banjo is offline   Reply With Quote
Old 12-08-2020, 01:07 PM   #2
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,725
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Banjo View Post
Now I want to put the same chapter into the index using a different entry.
Why do you want to add two different index entries that link to the same chapter title? (Usually chapter title links are added to TOCs not indexes.)
Doitsu is offline   Reply With Quote
Advert
Old 12-08-2020, 02:13 PM   #3
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
The TOC provides a sequential list of chapter titles. The index provides an alphabetical list of chapter titles. It seems to me that might be useful for a book that is not intended to be read sequentially end to end.

The reason for multiple entries is that I want to group some similar chapters with slightly different titles under the same index entry as well as having their own entries.

It isn't a big deal if it can't be done. I was curious whether I could do this or not and whether I am just not understanding the tool.
Banjo is offline   Reply With Quote
Old 12-08-2020, 02:20 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,736
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Banjo View Post
The TOC provides a sequential list of chapter titles. The index provides an alphabetical list of chapter titles. It seems to me that might be useful for a book that is not intended to be read sequentially end to end.

The reason for multiple entries is that I want to group some similar chapters with slightly different titles under the same index entry as well as having their own entries.

It isn't a big deal if it can't be done. I was curious whether I could do this or not and whether I am just not understanding the tool.
It can be done. It just seems silly. Put the chapters in the order they should be read. In the index you just need to put in a link to the file such as <a href="chapter1.html">Chapter 1</a>.
JSWolf is online now   Reply With Quote
Old 12-08-2020, 02:43 PM   #5
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
OK. I must be missing something. The links in the index are calculated by Sigil when I create the index. How do I put a link in the index myself?
Banjo is offline   Reply With Quote
Advert
Old 12-08-2020, 03:16 PM   #6
KevinH
Sigil Developer
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: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
Have you tried putting an id on the h1 tag but then wrapping just the contents of the h1 tag in a span and giving that span a different id.

Alternatively right beside the h1 tag you could create a second h1 tag with duplicate contents but set it to display:none and use it for the target of the second index link.

Just throwing out ideas here.
KevinH is offline   Reply With Quote
Old 12-08-2020, 03:34 PM   #7
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,725
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Banjo View Post
OK. I must be missing something. The links in the index are calculated by Sigil when I create the index. How do I put a link in the index myself?
If you want Sigil to create the links, you'll have to insert two anchors with class="sigil_index_marker" attributes and the same text. Obviously, you'll need to hide one of the entries. (In the following example, I used inline styles for demonstration purposes; you'll want to use classes instead.)

To see how it works, create a blank epub2 book, replace the <body> section of Section0001.xhtml with the following code and generate the index.


Spoiler:
Code:
<body>
  <h1><a class="sigil_index_marker" style="display: none;" title="Other name for chapter 1">Chapter 1</a><a class="sigil_index_marker" title="Chapter 1">Chapter 1</a></h1>

  <p>Lorem ipsum...</p>

  <h1><a class="sigil_index_marker" style="display: none;" title="Other name for chapter 2">Chapter 2</a><a class="sigil_index_marker" title="Chapter 2">Chapter 2</a></h1>
</body>


This should generate an index with 4 entries two of which are actually linking to the same targets.
Doitsu is offline   Reply With Quote
Old 12-08-2020, 04:23 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,736
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Banjo View Post
OK. I must be missing something. The links in the index are calculated by Sigil when I create the index. How do I put a link in the index myself?
Code:
<p class="index"><a href="chapter1.html">Chapter 1</a></p>
You just have to modify the code I posted to fit your chapter title and filename. And style the CSS for .index to what you want.
JSWolf is online now   Reply With Quote
Old 12-08-2020, 04:24 PM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,736
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by KevinH View Post
Have you tried putting an id on the h1 tag but then wrapping just the contents of the h1 tag in a span and giving that span a different id.

Alternatively right beside the h1 tag you could create a second h1 tag with duplicate contents but set it to display:none and use it for the target of the second index link.

Just throwing out ideas here.
That slows things down by using an ID when there is no reason to and going straight to the file is faster.
JSWolf is online now   Reply With Quote
Old 12-08-2020, 05:40 PM   #10
KevinH
Sigil Developer
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: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
But only if it is to top of file. I have seen many Chapter Headings that actually came after some artwork, a phrase, a quote, or some other chapter preface material.
KevinH is offline   Reply With Quote
Old 12-08-2020, 07:08 PM   #11
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
Quote:
If you want Sigil to create the links, you'll have to insert two anchors with class="sigil_index_marker" attributes and the same text. Obviously, you'll need to hide one of the entries. (In the following example, I used inline styles for demonstration purposes; you'll want to use classes instead.)
I tried your test and it worked. So I adapted it to fit in my book and it also works there.

I originally tried adding a paragraph with "visibility:hidden", but the text still showed up in one of the readers. Your suggestion seems to solve that.

I am still confused about this suggestion:

Quote:
It can be done. It just seems silly. Put the chapters in the order they should be read. In the index you just need to put in a link to the file such as <a href="chapter1.html">Chapter 1</a>.
If I edit Index.xhtml and add that code, it will be lost when the index generation tool overwrites the index file. I am missing something.
Banjo is offline   Reply With Quote
Old 12-08-2020, 08:01 PM   #12
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
I spoke too soon. The additional anchor text is invisible in the body of the book, but it shows up in the TOC.
Banjo is offline   Reply With Quote
Old 12-08-2020, 09:33 PM   #13
KevinH
Sigil Developer
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: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
Simply use the Edit TOC to remove the ones you do not want in the ToC
KevinH is offline   Reply With Quote
Old 12-08-2020, 09:53 PM   #14
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
I think I figured out a way to do this.

Right before the <h1> heading I added the following code:
Code:
<div style="display:none;" >Unique Text To Search For In Chapter 1</div>
Then I used the Index Editor to add an entry that searches for "Unique Text To Search For In Chapter 1", specifying the Index Entry that I want it to go into.

When I create the index, the code I put in changes to:
Code:
<div style="display:none;" id="sigil_index_id_1">Unique Text To Search For In Chapter 1</div>
and the link in the index entry that I specified takes me to "sigil_index_id_1".

I just need to make sure that the text I used is unique in the book so that it only finds one occurrence of it.

This appears to work fine for the index, and the unique text does not appear in the book or in the TOC on my readers (FBReader and Ebook Viewer from Cabilbre).

The key is using the style "display:none" to make the unique search text invisible. I have put the style into a class I call "DGInvisible". Then, I can simply add the code
Code:
<div class="DGInvisible" >Unique Text To Search For In Chapter 1</div>
and add a search entry to the index and it works.

Thanks to everyone for the suggestions.
Banjo is offline   Reply With Quote
Old 12-08-2020, 09:59 PM   #15
Banjo
Zealot
Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!Banjo , Klaatu Barada Niktu!
 
Banjo's Avatar
 
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
Quote:
Originally Posted by KevinH View Post
Simply use the Edit TOC to remove the ones you do not want in the ToC
They don't show up as independent entries in the TOC. It appends both strings into the same entry.

Code:
<div class="sgc-toc-title">Table of Contents</div>
<div class="sgc-toc-level-1">
  <a href="Section0001.xhtml">Chapter 1Chapter 1</a>
</div>
<div class="sgc-toc-level-1">
  <a href="Section0002.xhtml">Chapter 2 Chapter 2</a>
</div>
Banjo is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to put the Index in the TOC Banjo Sigil 3 09-17-2018 10:18 PM
Put Flightcrew PI in Index BetterRed Plugins 1 12-16-2016 04:47 PM
Plugboard "Metadata: Show series [series index] - title as title (Kindle)" Deep Cover Library Management 6 11-30-2012 05:17 PM
Feature request: Ability to put a book in a series without an index number lunixer Calibre 6 08-29-2011 11:37 AM
Can't extract article title in parse index hiperlink Recipes 19 01-18-2011 11:00 AM


All times are GMT -4. The time now is 12:33 PM.


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