Skip to content

Commit 1d95e00

Browse files
authored
Merge pull request #27 from takker99/refactor
Refactor: ファイルを分けたりもろもろ
2 parents 5542638 + f17bb4f commit 1d95e00

29 files changed

+689
-478
lines changed

base.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
/** scrapboxの行のメタデータ */
22
export interface BaseLine {
3-
/** 行のid */ id: LineId;
4-
/** 行のテキスト */ text: string;
5-
/** 一番最後に行を編集した人のid */ userId: UserId;
6-
/** 行の作成日時 */ created: UnixTime;
7-
/** 行の最終更新日時 */ updated: UnixTime;
3+
id: LineId;
4+
5+
/** 行のテキスト */
6+
text: string;
7+
8+
/** 一番最後に行を編集した人のid */
9+
userId: UserId;
10+
11+
/** 行の作成日時 */
12+
created: UnixTime;
13+
14+
/** 行の最終更新日時 */
15+
updated: UnixTime;
816
}
917

1018
/** basic information about a page */

blocks.ts

Lines changed: 23 additions & 8 deletions
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 =
@@ -7,8 +7,10 @@ export type Line =
77
section: {
88
/** section number */
99
number: number;
10+
1011
/** section開始行なら`true` */
1112
start: boolean;
13+
1214
/** section終了行なら`true` */
1315
end: boolean;
1416
};
@@ -38,33 +40,46 @@ export type Line =
3840

3941
/** the type which represents a line in a block */
4042
export interface Block {
41-
/** the number of indents */ indent: number;
42-
/** is the start line of this block */ start: boolean;
43-
/** is the end line of this block */ end: boolean;
43+
/** the number of indents */
44+
indent: number;
45+
46+
/** is the start line of this block */
47+
start: boolean;
48+
49+
/** is the end line of this block */
50+
end: boolean;
4451
}
4552

4653
/** the type which represents a line in a code block */
4754
export interface CodeBlock extends Block {
48-
/** the language of the code block */ lang: string;
49-
/** the file name of the code block */ filename?: string;
55+
/** the language of the code block */
56+
lang: string;
57+
58+
/** the file name of the code block */
59+
filename?: string;
5060
}
5161

5262
/** the type which represents a line in a table block */
5363
export interface TableBlock extends Block {
54-
/** the title of the table block */ title: string;
55-
/** cells included in the present line */ cells: string[];
64+
/** the title of the table block */
65+
title: string;
66+
67+
/** cells included in the present line */
68+
cells: string[];
5669
}
5770

5871
/** Helpfeel記法 */
5972
export interface Helpfeel {
6073
prefix: "?";
74+
6175
/** Helpfeel本文 */
6276
entry: string;
6377
}
6478

6579
/** Command Line記法 */
6680
export interface Cli {
6781
prefix: "$" | "%";
82+
6883
/** Command Line本文 */
6984
command: string;
7085
}

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+
}

0 commit comments

Comments
 (0)