03-18-2021, 10:52 AM | #1 |
Guru
Posts: 771
Karma: 625816
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Dictionary postformating - help needed
Using KoReader on a Pocketbook, I tried to force it to show some formatting.
Allready done: set sametypesequence=h in wiki.ifo file with: Code:
/mnt/ext1/applications/koreader # ./sdcv -02 data/dict Zwickel Code:
g_mkdir failed: No such file or directory Found 1 item, similar to Zwickel. -->De-De (Wiktionary) -->Zwickel <i>Substantiv, m</i><i>, Zwi·ckel, Pl. Zwi·ckel</i><br><b>Bedeutungen:</b><br>1. Architektur: eine dreiseitig begrenzte, ebene oder sphärische Fläche<br>2. Schneiderei: ein keilförmiger Einsatz an Kleidungsstücken<br>3. regional: ein sonderbarer oder seltsamer Mensch<br>4. regional: spezieller Zapfhahn zur Verprobung des Jungbieres<br><b>Synonyme:</b><br>2. Gehre<br>3. Sonderling<br> https://github.com/koreader/koreader/pull/3573 I could force KoReader to change some of the Dictrionary html code on the fly by putting a wiki.lua file in the same folder where the dictionary is located and the wiki.ifo file can be found with the following code: Code:
return function(html) html = html:gsub('<b>', '<span style="font-weight: bold; font-size: 1.1em">') html = html:gsub('</b>', '</span>') html = html:gsub('<i>', '<span style="font-style: italic; font-size: 0.9em ">') html = html:gsub('</i>', '</span>') html = html:gsub('<br/>', ' <div></div>') return html end What went wrong, where is my error? Please help. |
03-18-2021, 05:23 PM | #2 |
Wizard
Posts: 1,675
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
I don't see <br> in there, so you should try html = html:gsub("<br>", "<br/>") (and look at the error log).
|
03-18-2021, 06:08 PM | #3 |
Guru
Posts: 771
Karma: 625816
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Thanks for the help. So strange: now its working!
Before I had only plaintext dictionary entries showing, but changes I made in the Dic name of the ifo file didn't show up. In the meantime the device switched off and now every dictionary I created with html entries does show them instead of the plaintext it showed before, even without the lua files. So my guess now is, my changes in the ifo files "sametypesequence=h" needed a reboot, even then I thought, that switching to mass storage mode and restart KoReader would force it to use the new ifo file. I'm a very happy user now. |
06-07-2022, 09:28 PM | #4 |
(gtfo/freak)
Posts: 115
Karma: 2288752
Join Date: Nov 2019
Device: Likebook Alita
|
Quick question about this: do these ad-hoc .lua files have any impact on performance/battery life of using the dictionary? Theoretically I mean.
|
06-08-2022, 09:36 AM | #5 | |
cosiñeiro
Posts: 1,325
Karma: 2200073
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
So practically: nope. |
|
06-22-2022, 03:14 AM | #6 |
(gtfo/freak)
Posts: 115
Karma: 2288752
Join Date: Nov 2019
Device: Likebook Alita
|
Interesting... But isn't the Lua code run every time you do a lookup?
|
06-22-2022, 06:48 AM | #7 |
Wizard
Posts: 1,675
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Even if you ran the code in the OP a hundred times on each lookup for no apparent reason you probably still wouldn't notice it.
The lookup itself is orders of magnitude more demanding than a handful of simple string substitutions. |
Tags |
dictionary, koreader, pocketbook, stardict |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting an AZW dictionary to MOBI = no longer treated as a dictionary by Kindle | beic | Conversion | 3 | 08-02-2016 11:10 AM |
[HELP NEEDED] Custom Dictionary. | antkiller23 | PocketBook | 12 | 10-23-2013 05:48 PM |
Dictionary question: changing word delimiters for french dictionary | oecherprinte | Amazon Kindle | 1 | 05-09-2011 05:45 AM |
Oxford built-in dictionary disappears after changing default dictionary | YYZscientist | Amazon Kindle | 4 | 01-24-2010 09:42 PM |