bedstead/webstead.xhtml

42 lines
1.5 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB">
<head>
<!-- SPDX-License-Identifier: CC0-1.0 -->
<link rel="stylesheet" href="bedstead.css" type="text/css" />
<title>Bedstead editor test</title>
<script type="module"><![CDATA[
import Bedstead from './bedstead.js';
function update_glyph() {
Bedstead({
arguments: document.getElementById("input").value.split(" "),
print: function(charstring) {
document.getElementById("output").textContent = charstring;
document.getElementById("rendered")
.setAttribute("d", charstring
.replaceAll(/<!--(?:[^-]|-[^-])*-->/g, "")
.replace(/^.* [hv]stem /, "")
.replace(/^/, "m ")
.replaceAll(/ rmoveto/g, "")
.replaceAll(/ rlineto/g, "m")
.replace(/ endchar/, ""));
}
});
}
document.getElementById("run").onclick = update_glyph;
]]>
</script>
</head>
<body>
<form>
<label for="input">Input</label>
<input type="text" id="input"/>
<input type="button" id="run" value="Run!"/>
</form>
<p><code id="output"></code></p>
<div>
<svg width="600" height="1000" xmlns="http://www.w3.org/2000/svg">
<path id="rendered" fill="currentColor"/>
</svg>
</div>
</body>
</html>