![]() |
#1 |
Member
![]() Posts: 14
Karma: 10
Join Date: Sep 2015
Device: none
|
Bookmarks - dual language book
I have a book in spanish and english (a dual translation). In the spanish book i have many bookmarks links to an index that the book has. But the english book doesn't has those bookmarks links.
The files structures: cap1_es cap1_en cap2_es cap2_en and so on.... and the html code of the spanish bookmarks links are: <a data-index="18es"><sup class="bkm">18</sup></a> <a data-index="19es"><sup class="bkm">19</sup></a> Is there a way to copy ALL the bookmarks from the spanish books to the english books? From the cap1_es copy the bookmark to cap1_en. Thanks for your help!!! |
![]() |
![]() |
![]() |
#2 |
Member
![]() Posts: 14
Karma: 10
Join Date: Sep 2015
Device: none
|
I see that nobody can help me. Isn't there any way to copy a text from a book to another book? I think that it should be a Regex Function, no?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Besides, I don't see how REGEX is a simple solution. You need to identify the target. If you have multiple monitors, you could use the CLI to open 2 editor sessions (2 Monitors leaves both in front ) and copy and paste between |
|
![]() |
![]() |
![]() |
#4 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Sep 2015
Device: none
|
Quote:
My origen text: <a data-index="18es"><sup class="bkm">18</sup></a> My target file: cap1_en My target text: <sup class="bkm">18</sup> I want this origen text <a data-index="18es"> in the target text. I have found this in a web site: Capture the group you're interested in (ie, between quotes), extract the matches from each line, then write them one per line to the new file, eg: import re with open('input') as fin, open('output', 'w') as fout: for line in fin: matches = re.findall('"(.*?)"', line) fout.writelines(match + '\n' for match in matches) Is it a possible solution? |
|
![]() |
![]() |
![]() |
#5 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Yes, if you're willing to write a plugin to do it...
You're trying to lift information from one part of the book and use it as inspiration to modify another part of the book. Although you could fit it into a regex function, but that would be a very complex regex function I'd think. Theoretically you could rewrite many/most plugins as a regex function, if you really wanted to, but it wouldn't make anything easier. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
One solution, if I understand correctly:
Use a regex only for the selected files: cap1_en, etc. (Selected in the file browser). Code:
Search: <sup class="bkm">(\d+)</sup> Replace: <a data-index="\1es"><sup class="bkm">\1</sup></a> |
![]() |
![]() |
![]() |
#7 |
The Fumbler
![]() Posts: 66
Karma: 10
Join Date: Jun 2015
Device: android 4.2/fbreader
|
If the English version has no bookmarks, how could you use search to find the place to insert the bookmark? Search for "Caliente" in the Spanish book, capture the link, search for "Hot" in the English book, paste the revised link. If I understand your situation correctly, I don't see how it can be done.
Last edited by Thom*; 10-26-2015 at 10:06 AM. |
![]() |
![]() |
![]() |
#8 |
The Fumbler
![]() Posts: 66
Karma: 10
Join Date: Jun 2015
Device: android 4.2/fbreader
|
Looking at your situation a little differently. If your English version has the <sup..../sup> language in it and you just want to wrap the link around it, then you could:
Search for: <sup class="bkm">(.*?)</sup> Replace with: <a data-index="\1es"><sup class="bkm">\1</sup></a> I am not really sure what exactly you have. Oops, I think you wanted "en" not "es". So change the replace to: <a data-index="\1en"><sup class="bkm">\1</sup></a> Last edited by Thom*; 10-26-2015 at 12:13 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thoughts on how to format a dual-language book for learners? | MacEachaidh | ePub | 35 | 03-19-2014 03:37 AM |
Dual-band, dual-antenna Wi-Fi router? | 6charlong | Amazon Kindle | 13 | 12-04-2012 01:17 PM |
Dual-language eBooks | tomsem | General Discussions | 10 | 12-03-2011 07:02 PM |
Buy the dual book offline | jdoner28 | enTourage Archive | 1 | 05-19-2010 08:56 AM |
Formatting Dual Language Books | musemj6 | Amazon Kindle | 1 | 08-09-2008 12:10 AM |