Hi Kevin;
Thank you very much for your efforts. You must define the path to .wasm files in the config script. I have that config in Hyphenopoly_Loader.js so I don't have to write it in each .xhtml file; that way just by including the next declaration in the header is enough:
Code:
<script type="text/javascript" src="../Misc/Hyphenopoly_Loader.js" ></script>
But as you are using the following declaration:
Code:
<script type="text/javascript">
Hyphenopoly.config({
require: {
"es": "FORCEHYPHENOPOLY",
"de": "Silbentrennungsalgorithmus"
}
});
console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
you need to include there the following:
Code:
paths: {
patterndir: "../../META-INF/"
},
Of that way you should have as final code the following:
Code:
<script type="text/javascript">
Hyphenopoly.config({
require: {
"es": "FORCEHYPHENOPOLY",
"de": "Silbentrennungsalgorithmus"
}, // DON'T OMIT THE COMMA HERE
paths: {
patterndir: "../../META-INF/"
} // AND HERE NO COMMA
});
console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
Take into account that you must include in META-INF the files es.wasm and de.wasm. You can include the .wasm ones in "Misc" but Sigil will warn you and epubcheck will give an error. And yes, with "FORCEHYPHENOPOLY", you force the loader to load Hyphenopoly.js. One more thing; if you are going to employ others .wasm, write in the paragraphs, divs or whatever element to want hyphenation
lang="xx", where "xx" is the language you are going to use.
Quote:
Originally Posted by KevinH
Okay I figured out how to force load Hyphenopoly using the following and disabling hyphenation in the css:
Code:
<script type="text/javascript">
Hyphenopoly.config({
require: {
"es": "FORCEHYPHENOPOLY",
"de": "Silbentrennungsalgorithmus"
}
});
console.log(Hyphenopoly.hyphenators); //{en-us: Promise, HTML: Promise}
</script>
Then changed the sigil scheme to allow it to use the fetch api and rebuilt Sigil.
That gets me to here: (Debug info from Sigil's URLInterceptor.cpp and URLSchemeHandler.cpp)
Code:
Debug: URLInterceptor
Debug: method: "GET"
Debug: 1st party url: QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Text/Section0001.xhtml")
Debug: request url: QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug: navtype: 0
Debug: restype: 13
Debug: ActiveWindow: MainWindow(0x7f8828226c00, name="MainWindow")
Debug: In URLSchemeHandler with url: QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug: In URLSchemeHandler with method: "GET"
Debug: In URLSchemeHandler with initiator: QUrl("sigil:")
Debug: URLSchemeHandler will fail request because no local file found: QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
Debug: URLSchemeHandler failed request for: QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
which shows it fails because it is not trying to load the .wasm files from the correct location inside the META-INF folder:
QUrl("sigil:///Users/kbhend/Library/Application Support/sigil-ebook/sigil/workspace/Sigil-PAbpkt/OEBPS/Misc/patterns/es.wasm")
instead it is looking right beside the other js files.
Where in you javascript loader do you tell it where to find the .wasm files?
Someplace there should be a "../../../META-INF/" appended before the file name to actually load the wasm files:
|