123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Test 027</title>
- <script>
- var Hyphenopoly = {
- require: {
- "fur": "probabilmentri"
- },
- setup: {
- selectors: {
- ".hyphenate": {
- hyphen: "|",
- minWordLength: 4
- }
- }
- },
- handleEvent: {
- engineReady: function (e) {
- /*async function hyphenate_de(text) {
- document.getElementById("test2").innerText = (await Hyphenopoly.hyphenators.fur)(text);
- assert();
- }*/
- function hyphenate_fur(text) {
- Hyphenopoly.hyphenators.fur.then(function (furhyph) {
- document.getElementById("test1").innerText = furhyph(text);
- assertAll();
- });
- }
- hyphenate_fur("Il furlan e je une lenghe romanze de famee des lenghis retichis, che e je fevelade soredut intal Friûl, ma ancje vie pal mont. Cualchi volte al ven clamât Ladin orientâl, parcè che al à diviers ponts in comun cul ladin, ma si è svilupât in un altri mût cul passâ dal timp, sot de influence des lenghis ator dal Friûl");
- },
- error: function (e) {
- assertError(e);
- }
- }
- };
- function assertError(e) {
- var result = false;
- if (e.msg.indexOf("Promises not supported in this engine") !== -1) {
- result = true;
- }
- if (parent != window) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 27,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- }
- function assertAll() {
- var tests = 1;
- var i = 1;
- var test = "";
- var ref = "";
- var result = false;
- while (i <= tests) {
- test = document.getElementById("test" + i).innerHTML;
- ref = document.getElementById("ref" + i).innerHTML;
- if (test === ref) {
- document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
- result = result || true;
- } else {
- document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
- result = result || false;
- }
- i += 1;
- }
- if (parent != window) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 27,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- }
- </script>
- <script src="../Hyphenopoly_Loader.js"></script>
- <style type="text/css">
- body {
- width:50%;
- margin-left:25%;
- margin-right:25%;
- }
- .test {
- background-color: #D8E2F9;
- hyphens: auto;
- }
- .ref {
- background-color: #FEEFC0;
- }
- </style>
- </head>
- <body>
- <div id="navigate"><a href="index.html">↞ Index</a> | <a href="test26.html">← Prev</a> | <a href="test28.html">Next →</a></div>
- <h1>Test 027</h1>
- <p id="desc">Hyphenate manually (uses promises): check</p>
- <div id="result"></div>
- <hr>
- <h2>fur</h2>
- <p id="test1" lang="fur" class="test hyphenate"></p>
- <p id="ref1" lang="fur" class="ref">Il fur|lan e je une len|ghe ro|man|ze de fa|mee des len|ghis re|ti|chis, che e je fe|ve|la|de so|re|dut in|tal Friûl, ma an|cje vie pal mont. Cual|chi vol|te al ven clamât La|din orientâl, parcè che al à di|viers ponts in co|mun cul la|din, ma si è svi|lupât in un al|tri mût cul pa|ssâ dal timp, sot de in|fluen|ce des len|ghis ator dal Friûl</p>
- <hr>
- <div><span class="test">Test</span> <span class="ref">Ref</span></div>
- </body>
- </html>
|