![]() |
#1 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Replace reoccurring string with increasing number
I got an epub of poetry where each verse is in its own specifically classed paragraph. Is there a quick way to add verse numbers before each paragraph? So to pass from
Code:
<p class="verse>Tu non altro che il canto avrai del figlio,</p> <p class="verse>o materna mia terra. A noi prescrisse</p> <p class="verse>il fato illacrimata sepoltura</p> Code:
<p class="verse-number">1</p><p class="verse>Tu non altro che il canto avrai del figlio, </p> <p class="verse-number">2</p><p class="verse>o materna mia terra. A noi prescrisse</p> <p class="verse-number">3</p><p class="verse>il fato illacrimata sepoltura</p> |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
You could use the Function mode in Calibre Editor or my simple Incremental IDs Sigil plugin.
(With my plugin you'd first have to add incremental ids and then use a regex to change the ids to tag values.) BTW, if using epub3 books is an option for you, you could also use CSS with pseudo selectors to add line numbers. For details see this thread. Last edited by Doitsu; 12-16-2017 at 01:26 AM. |
![]() |
![]() |
![]() |
#3 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Ops, turns out I had already asked the same question three years ago
![]() |
![]() |
![]() |
![]() |
#4 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 557
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
You can also use a XQuery script
|
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fin/ replace a generic string | keele | Editor | 4 | 09-19-2014 03:46 PM |
Replace field with match or empty string? | charlweed | Library Management | 2 | 03-29-2012 12:44 AM |
Regex - replace only part of a string - how? | flameproof | Sigil | 11 | 02-23-2012 04:43 AM |
search and replace with incremental number | pimpoum | General Discussions | 4 | 07-08-2011 02:41 PM |
Find and replace string with wildcard | jhempel24 | Sigil | 15 | 11-12-2010 01:50 PM |