mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 13:33:06 -04:00
41 lines
1.5 KiB
HTML
41 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';
|
|
document.getElementById("run").onclick = function(){
|
|
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/, ""));
|
|
}
|
|
});
|
|
};
|
|
]]>
|
|
</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>
|