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

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-11-2019, 06:14 PM   #1
Edmundb
Junior Member
Edmundb began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2014
Device: Kindle e-ink
Sigil Index of first lines

I'm using Sigil for the first time to create a poetry book and there is a requirement for an index of first lines. I have marked the first lines of the poem as an index entry and then created the index.
I think I must be doing something wrong. In the index the first line appears but without a link. The link is provided by clicking on a number 1 that appears next to all the entries. The html looks like
Code:
 <div class="sgc-index-entry">
     first line of the poem
 <a href="link to the poem">1</a>
    </div>
and I can fix the problem by manually replacing the '1' with the first line of the poem
<
Code:
div class="sgc-index-entry">
 <a href="link to the poem"> first line of the poem</a>
    </div>
This works fine, but there are over 200 poems and I'd really appreciate finding a quicker way.
Can anybody help?
Edmundb is offline   Reply With Quote
Old 08-11-2019, 09:30 PM   #2
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,245
Karma: 6110931
Join Date: Jul 2012
Device: Kobo Forma, Nook
Step 1: Open up the Find/Replace (Ctrl+F) or press the menu Search > Find & Replace.

Step 2: Make sure you have the Mode box set as Regex.

If you want to be safe, only have the Index open in Sigil, and change the 2nd dropdown to "Current File". This will make sure it won't go replacing through your entire book (although it shouldn't).

Step 3: Put this in the fields:

Search: <div class="sgc-index-entry">\s+(.+?)\s+(<a href="[^"]+">)\d+</a>\s+</div>
Replace: <div class="sgc-index-entry">\2\1</a></div>

What that will do is take your example code, and convert it into:

Code:
<div class="sgc-index-entry"><a href="link to the poem">first line of the poem</a></div>
It takes the link from around #1 and wraps it around the entry instead.

Alternate #3: Personally, what I would do is use:

Replace: <p class="indexfirstline">\2\1</a></p>

and adjust the CSS. The code would be much more readable.

Last edited by Tex2002ans; 08-11-2019 at 09:36 PM.
Tex2002ans is online now   Reply With Quote
Old 08-16-2019, 07:44 AM   #3
Edmundb
Junior Member
Edmundb began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2014
Device: Kindle e-ink
Thank you very much. Both methods work for me and saved a considerable amount of time. - Edmundb
Edmundb 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
Index editor: where does sigil save the list? 1v4n0 Sigil 2 01-08-2015 01:42 PM
Sigil Plugin Index Thasaidon Plugins 0 10-04-2014 07:41 AM
Some lines center in Sigil but are LJ in readers philip_rhoades Sigil 6 06-04-2014 04:32 AM
Sigil Index and anchor formatting mncowboy Sigil 2 03-13-2013 07:22 PM
TOC and Index links in Sigil Bamber ePub 10 11-11-2010 02:12 PM


All times are GMT -4. The time now is 03:56 PM.


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