make a separate file for the code generation
This commit is contained in:
@@ -271,15 +271,3 @@ var computeLayout = (function() {
|
||||
})();
|
||||
|
||||
|
||||
var c_code = computeLayout.layoutNode.toString()
|
||||
.replace(/\.children\.length/g, '.children_count')
|
||||
.replace(/layout\[dim/g, 'layout.dimensions[dim')
|
||||
.replace(/layout\[pos/g, 'layout.position[pos')
|
||||
.replace(/layout\[leading/g, 'layout.position[leading')
|
||||
.replace(/style\[dim/g, 'style.dimensions[dim')
|
||||
.replace(/node\./g, 'node->')
|
||||
.replace(/child\./g, 'child->')
|
||||
.replace(/var\/\*([^\/]+)\*\//g, '$1')
|
||||
.replace(/\n /g, '\n');
|
||||
|
||||
console.log(c_code);
|
||||
|
26
src/transpile.html
Normal file
26
src/transpile.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<script src="Layout.js"></script>
|
||||
|
||||
<style>
|
||||
textarea {
|
||||
height: 200px;
|
||||
width: 800px;
|
||||
border: 1px solid black;
|
||||
font-size: 12px;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>layoutCode</h1>
|
||||
<textarea id="layout_code" onclick="this.select()"></textarea>
|
||||
<script>
|
||||
document.getElementById('layout_code').value = computeLayout.layoutNode.toString()
|
||||
.replace(/\.children\.length/g, '.children_count')
|
||||
.replace(/layout\[dim/g, 'layout.dimensions[dim')
|
||||
.replace(/layout\[pos/g, 'layout.position[pos')
|
||||
.replace(/layout\[leading/g, 'layout.position[leading')
|
||||
.replace(/style\[dim/g, 'style.dimensions[dim')
|
||||
.replace(/node\./g, 'node->')
|
||||
.replace(/child\./g, 'child->')
|
||||
.replace(/var\/\*([^\/]+)\*\//g, '$1')
|
||||
.replace(/\n /g, '\n');
|
||||
</script>
|
Reference in New Issue
Block a user