Skip to content

Commit 2312f69

Browse files
committed
push
1 parent b326fa2 commit 2312f69

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17.8.0

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xiangnanscu/lua2js",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"main": "src/lua2js.mjs",
55
"scripts": {
66
"dev": "vite",

src/App.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script setup>
22
// This starter template is using Vue 3 <script setup> SFCs
33
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
4-
import lua2js from './components/lua2js.vue'
4+
import MainPage from './components/MainPage.vue'
5+
import packages from '../package.json'
56
</script>
67

78
<template>
8-
<lua2js />
9+
<h1><a href="https://github.com/xiangnanscu/lua2js">{{ packages.name }}-{{packages.version}}</a> - transform lua to js
10+
literally</h1>
11+
<MainPage />
912
</template>
1013

1114
<style lang="scss">

src/components/lua2js.vue src/components/MainPage.vue

+16-20
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import { ref, computed } from 'vue'
33
import { lua2js, lua2ast } from '../lua2js.mjs'
44
import fs from "file-saver";
5-
import prettier from "prettier/standalone.js";
6-
import parserBabel from "prettier/parser-babel.js";
75
86
const jscodeRef = ref(null)
97
const showLuaAst = ref(false)
@@ -67,7 +65,7 @@ local TestClass = class {
6765
`)
6866
const jscode = computed(() => lua2js(luacode.value))
6967
const luaast = computed(() => lua2ast(luacode.value))
70-
const jscode_highlight_html = computed(() => hljs.highlight(jscode.value, {language: 'js'}).value)
68+
const jscode_highlight_html = computed(() => hljs.highlight(jscode.value, { language: 'js' }).value)
7169
function copyJs() {
7270
CopyToClipboard('jscode');
7371
}
@@ -103,33 +101,31 @@ function CopyToClipboard(containerid) {
103101
<div>
104102
<div class="row">
105103
<div class="col">
106-
<div style="text-align: center;">
107-
<h1><a href="https://github.com/xiangnanscu/lua2js">lua2js</a> - transform lua to js literally </h1>
108-
<div></div>
109-
<div class="form-check-inline">
110-
<label class="form-check-label">
111-
<input @input="showLuaAst=!showLuaAst" :value="showLuaAst" type="checkbox"
112-
class="form-check-input" />show lua ast</label>
113-
</div>
114-
<button @click="luacode=''">clear textarea</button>
115-
<button @click="copyJs">copy js</button>
116-
<button @click="saveJsAs">save as</button>
117-
</div>
118104
</div>
119105
</div>
120106
<div class="row">
121107
<div class="col">
108+
<button @click="luacode = ''">clear textarea</button>
122109
<textarea rows="10" style="height:800px" class="form-control" :value="luacode"
123110
@input="luacode = $event.target.value"></textarea>
124111
</div>
125-
<div v-if="showLuaAst" class="col">
126-
<pre>{{ luaast }}</pre>
127-
</div>
128-
<div v-else class="col">
129-
<highlightjs language='lua' :code="luacode" />
112+
<div class="col">
113+
<div class="form-check-inline">
114+
<label class="form-check-label">
115+
<input @input="showLuaAst = !showLuaAst" :value="showLuaAst" type="checkbox" class="form-check-input" />show
116+
lua ast</label>
117+
</div>
118+
<div v-if="showLuaAst">
119+
<pre>{{ luaast }}</pre>
120+
</div>
121+
<div v-else>
122+
<highlightjs language='lua' :code="luacode" />
123+
</div>
130124
</div>
131125
<div class="col">
132126
<!-- <pre id="jscode2"><code class="language-javascript" v-html="jscode_highlight_html"></code></pre> -->
127+
<button @click="copyJs">copy js</button>
128+
<button @click="saveJsAs">save as</button>
133129
<highlightjs id="jscode" language='javascript' :code="jscode" />
134130
</div>
135131
</div>

0 commit comments

Comments
 (0)