calibre/resources/viewer/hyphenation.js
Kovid Goyal 46988f0f9a E-book viewer: Allow searching for whole words to work with hyphenation
E-book viewer: Allow searching to work with hyphenation enabled,
provided you are searching for whole words. Searching for partial words
may still not work. For robust searching, turn off hyphenation in the
viewer preferences.
2013-11-20 22:20:49 +05:30

29 lines
697 B
JavaScript

/*
* Hyphenation
* Copyright 2008 Kovid Goyal
* License: GNU GPL v3
*/
function do_hyphenation(lang) {
Hyphenator.config(
{
'minwordlength' : 6,
// 'hyphenchar' : '|',
'displaytogglebox' : false,
'remoteloading' : false,
'doframes' : true,
'defaultlanguage' : 'en',
'storagetype' : 'session',
'onerrorhandler' : function (e) {
window.py_bridge.debug(e);
}
});
// console.log(lang);
Hyphenator.hyphenate(document.body, lang);
}
function hyphenate_text(text, lang) {
return Hyphenator.hyphenate(text, lang);
}