Skip to content

Commit f17bb4f

Browse files
committed
♻️ Nodeの定義をファイルごとにばらした
1 parent 4bf7cf1 commit f17bb4f

27 files changed

+568
-402
lines changed

blocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Node, NodeWithoutIndent } from "./nodes.ts";
1+
import type { Node, NodeWithoutIndent } from "./node/node.ts";
22
import type { BaseLine } from "./base.ts";
33

44
export type Line =

node/audio.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** 音声埋め込み */
5+
export interface Audio {
6+
type: "audio";
7+
8+
/** 構文解析結果 */
9+
unit: Unit;
10+
11+
/** scrapboxにuploadされたfileのID
12+
*
13+
* このpropertyはscrapboxにuploadされた音声ファイルのときのみ生える
14+
*/
15+
fileId?: string;
16+
17+
/** the same as `unit.content` */
18+
children: PlainText;
19+
}

node/audioLink.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** タイトル付き音声 */
5+
export interface AudioLink {
6+
type: "audioLink";
7+
8+
/** 構文解析結果 */
9+
unit: AudioLinkUnit;
10+
11+
/** scrapboxにuploadされたfileのID
12+
*
13+
* このpropertyはscrapboxにuploadされた音声ファイルのときのみ生える
14+
*/
15+
fileId?: string;
16+
17+
/** the same as `unit.content` */
18+
children: PlainText;
19+
}
20+
21+
export interface AudioLinkUnit extends Unit {
22+
/** 音声のURL */
23+
link: string;
24+
25+
/** 音声のタイトル */
26+
title: string;
27+
}

node/blank.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** 空白記法 */
5+
export interface Blank {
6+
type: "blank";
7+
8+
/** 構文解析結果 */
9+
unit: Unit;
10+
11+
/** the same as `unit.content` */
12+
children: PlainText;
13+
}

node/code.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** コード記法 */
5+
export interface Code {
6+
type: "code";
7+
8+
/** 構文解析結果 */
9+
unit: Unit;
10+
11+
/** the same as `unit.content` */
12+
children: PlainText;
13+
}

node/decoration.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Unit } from "./unit.ts";
2+
import { NodeWithoutIndent } from "./node.ts";
3+
4+
/** 文字装飾記法 */
5+
export interface Decoration {
6+
type: "deco";
7+
8+
/** 構文解析結果 */
9+
unit: DecorationUnit;
10+
11+
/** 中に含まれるNode */
12+
children: NodeWithoutIndent;
13+
}
14+
15+
export interface DecorationUnit extends Unit {
16+
/** 文字装飾記号 */
17+
deco: string;
18+
19+
/** 強調のレベル
20+
*
21+
* `*`が一つ増えるごとに1増える
22+
*
23+
* 一つもないときは`0`になる
24+
*/
25+
strong: number;
26+
27+
/** 斜体記号`/`を含むとき`true` */
28+
italic: boolean;
29+
30+
/** 打ち消し記号`-`を含むとき`true` */
31+
strike: boolean;
32+
33+
/** 下線記号`_`を含むとき`true` */
34+
underline: boolean;
35+
}

node/formula.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** 数式記法 */
5+
export interface Formula {
6+
type: "deco-formula";
7+
8+
/** 構文解析結果 */
9+
unit: FormulaUnit;
10+
11+
/** the same as `unit.content` */
12+
children: PlainText;
13+
}
14+
15+
export interface FormulaUnit extends Unit {
16+
/** KaTeX text
17+
*
18+
* `content` から`$ `を外したもの
19+
*/
20+
formula: string;
21+
}

node/googleMap.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** Location記法 */
5+
export interface GoogleMap {
6+
type: "location";
7+
8+
/** 構文解析結果 */
9+
unit: GoogleMapUnit;
10+
11+
/** the same as `unit.content` */
12+
children: PlainText;
13+
}
14+
15+
export interface GoogleMapUnit extends Unit {
16+
/** 緯度 */
17+
latitude: number;
18+
19+
/** 経度 */
20+
longitude: number;
21+
22+
/** 拡大レベル */
23+
zoom: number;
24+
25+
/** 地点の名前 */
26+
title?: string;
27+
}

node/gyazo.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** Gyazoから引っ張ってきた画像の画像記法 */
5+
export interface Gyazo extends GyazoBase {
6+
type: "gyazo";
7+
}
8+
9+
/** Gyazoから引っ張ってきた画像の強調画像記法 */
10+
export interface StrongGyazo extends GyazoBase {
11+
type: "strongGyazo";
12+
}
13+
14+
export interface GyazoBase {
15+
/** 構文解析結果 */
16+
unit: Unit;
17+
18+
/** the same as `unit.content` */
19+
children: PlainText;
20+
}

node/gyazoLink.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Unit } from "./unit.ts";
2+
import { PlainText } from "./plainText.ts";
3+
4+
/** Gyazoから引っ張ってきた画像のリンク付き画像記法 */
5+
export interface GyazoLink {
6+
type: "gyazoLink";
7+
8+
/** 構文解析結果 */
9+
unit: GyazoLinkUnit;
10+
11+
/** the same as `unit.content` */
12+
children: PlainText;
13+
}
14+
/** Gyazoから引っ張ってきた画像のリンク付き強調画像記法 */
15+
export interface StrongGyazoLink {
16+
type: "strongGyazoLink";
17+
18+
/** 構文解析結果 */
19+
unit: GyazoLinkUnit;
20+
21+
/** the same as `unit.content` */
22+
children: PlainText;
23+
}
24+
25+
export interface GyazoLinkUnit extends Unit {
26+
/** 画像のURL */
27+
gyazo: string;
28+
29+
/** 埋め込まれたリンクのURL */
30+
link: string;
31+
}

0 commit comments

Comments
 (0)