latin: support repeat glyph substitution in sample
[sheet.git] / latinsample.js
index cff51e38b9e295869fca2bde87eb49b0037509df..b576f955514949eb24c59f3c4d93619824a6fe88 100644 (file)
@@ -29,8 +29,12 @@ function appendsample() {
                for (var i = 0; i < input.length; i++) {
                        var col = input.charCodeAt(i) - 64;
                        if (col < 1) col = 27; // space
+                       else if (cols[28] && i && col == input.charCodeAt(i - 1) - 64) {
+                               col = 28; // repetition char
+                       }
+
                        if (col < cols.length) {
-                               output += '<span>' + cols[col].innerHTML.trimRight() + '</span>';
+                               output += '<span>' + (cols[col].innerHTML.trimRight() || ' ') + '</span>';
                        }
                        else {
                                output += ' ';