Skip to content

Commit dc5ce80

Browse files
authored
Merge pull request #121 from yktsr/dev_221
Release 2.2.1
2 parents 1a6d0df + a72e874 commit dc5ce80

17 files changed

+17566
-210
lines changed

.github/workflows/nodejs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ jobs:
1919
- name: Test with eslint
2020
run: |
2121
npm run lint
22-
- name: Test
22+
- name: Test Text2Frame
2323
run: |
24-
npm test
24+
npm run test_text2frame
25+
- name: Test Frame2Text
26+
run: |
27+
npm run test_frame2text
2528

Frame2Text.js

Lines changed: 2596 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ Simple compiler to convert text to event.
149149

150150
詳細は[wikiの該当ページ](https://github.com/yktsr/Text2Frame-MV/wiki/%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3)を参照してください。
151151

152+
## 逆変換プラグイン Frame2Text
153+
RPGツクールMV/MZのイベントコマンドを、Text2Frameの記法に則ったテキストにエクスポートするプラグインである、Frame2Textも公開しています。
154+
155+
Frame2Textのダウンロードは[ここ](https://raw.githubusercontent.com/yktsr/Text2Frame-MV/master/Frame2Text.js)からお願いします。
156+
157+
また、詳細な使い方は[Frame2Textの紹介ページ](https://github.com/yktsr/Text2Frame-MV/wiki/%E9%80%86%E5%A4%89%E6%8F%9B%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3Frame2Text)かプラグイン本体のヘルプドキュメントを参照してください。
152158

153159
## Author/連絡先
154160
* [@kryptos_nv](https://twitter.com/kryptos_nv)
@@ -168,19 +174,29 @@ $ npm run build --if-present
168174

169175
### Show help
170176
```
171-
$ npm run debug
172-
===== Manual =====
177+
Usage: Text2Frame [options]
178+
179+
Options:
180+
-V, --version output the version number
181+
-m, --mode <map|common|compile|test> output mode
182+
-t, --text_path <name> text file path
183+
-o, --output_path <name> output file path
184+
-e, --event_id <name> event file id
185+
-p, --page_id <name> page id
186+
-c, --common_event_id <name> common event id
187+
-w, --overwrite <true/false> overwrite mode (default: "false")
188+
-v, --verbose debug mode (default: false)
189+
-h, --help display help for command
173190
191+
===== Manual =====
174192
NAME
175193
Text2Frame - Simple compiler to convert text to event command.
176194
SYNOPSIS
177-
node Text2Frame.js
178195
node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false>
179196
node Text2Frame.js --verbose --mode common --text_path <text file path> --common_event_id <common event id> --overwrite <true|false>
197+
node Text2Frame.js --mode compile
180198
node Text2Frame.js --verbose --mode test
181199
DESCRIPTION
182-
node Text2Frame.js
183-
テストモードです。test/basic.txtを読み込み、data/Map001.jsonに出力します。
184200
node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false>
185201
マップへのイベント出力モードです。
186202
読み込むファイル、出力マップ、上書きの有無を引数で指定します。
@@ -196,6 +212,17 @@ $ npm run debug
196212
197213
例1:$ node Text2Frame.js --mode common --text_path test/basic.txt --output_path data/CommonEvents.json --common_event_id 1 --overwrite true
198214
例2:$ node Text2Frame.js -m common -t test/basic.txt -o data/CommonEvents.json -c 1 -w true
215+
216+
node Text2Frame.js --mode compile
217+
コンパイルモードです。
218+
変換したいテキストファイルをパイプで与えると、対応したイベントに変換されたJSONを、標準出力に出力します。
219+
このモードでは、Map.json / CommonEvent.jsonの形式へフォーマットされず、イベントに変換したJSONのみが出力されるため、
220+
Map.json/CommonEvent.json への組み込みは各自で行う必要があります。
221+
222+
例1: $ cat test/basic.txt | node Text2Frame.js --mode compile
223+
224+
node Text2Frame.js --mode test
225+
テストモードです。test/basic.txtを読み込み、data/Map001.jsonに出力します。
199226
```
200227

201228
### Run Text2frame.js with command line
@@ -209,6 +236,44 @@ Please restart RPG Maker MV(Editor) WITHOUT save.
209236
**セーブせずに**プロジェクトファイルを開き直してください
210237
```
211238

239+
### How to use the Text2Frame module as an ES Module and as a CommonJS module:
240+
### npm install
241+
```
242+
$ npm install 'yktsr/Text2Frame-MV'
243+
```
244+
245+
### Using as an ES Module
246+
```
247+
$ cat examples/commonjs.js
248+
const TF = require("Text2Frame-MV/Text2Frame.cjs.js")
249+
250+
const date = new Date().toLocaleString()
251+
const text = `<comment>
252+
for common js module:
253+
出力日時: ${date}
254+
</comment>`
255+
256+
console.log(TF.compile(text))
257+
258+
$ node examples/commonjs.js
259+
```
260+
261+
### Using as an ES Module
262+
```
263+
$ cat examples/esmodules.mjs
264+
import TF from "Text2Frame-MV/Text2Frame.es.mjs"
265+
266+
const date = new Date().toLocaleString()
267+
const text = `<comment>
268+
for ES Module:
269+
出力日時: ${date}
270+
</comment>`
271+
272+
console.log(TF.compile(text))
273+
274+
$ node examples/esmodules.mjs
275+
```
276+
212277
### Lint check
213278
```
214279
$ npm run lint

0 commit comments

Comments
 (0)