Skip to content

Commit 830284c

Browse files
committed
Leave empty string for text prefix
Make things easier
1 parent b0085aa commit 830284c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ast.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type RDTIcon = RDTNode & {
4242
export type RDTText = RDTNode & {
4343
kind: 'text';
4444
text: string;
45-
prefix?: string;
45+
prefix: string;
4646
params?: Record<string, string>;
4747
};
4848

@@ -116,14 +116,14 @@ export function parseCells(src: string, offset: number): RDTCell[] {
116116
}
117117

118118
export function parseCell(src: string, offset: number): RDTCell {
119-
const [, name = '', link, params] = src.match(/^(.*?)(?:!@(.+?))?(?:!_(.+?))?$/) ?? [];
119+
const [, icons = '', link, params] = src.match(/^(.*?)(?:!@(.+?))?(?:!_(.+?))?$/) ?? [];
120120

121121
return {
122122
kind: 'cell',
123123
src,
124124
offset,
125125
length: src.length,
126-
icons: parseIcons(name, offset),
126+
icons: parseIcons(icons, offset),
127127
link,
128128
params: parseParams(params),
129129
};
@@ -151,7 +151,7 @@ export function parseIcon(src: string, offset: number): RDTIcon {
151151
}
152152

153153
export function parseText(src: string, offset: number): RDTText {
154-
const [, prefix, text = '', params] = src.match(/^(.*?)\*(.*?)(?:__(.+))?$/) ?? [];
154+
const [, prefix = '', text = '', params] = src.match(/^(.*?)\*(.*?)(?:__(.+))?$/) ?? [];
155155

156156
return {
157157
kind: 'text',

src/components/BSMap/BSIcon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const style = computed(() => ({
4343
'--bs-map-icon-ratio': (ratio.value == 1 ? undefined : ratio.value),
4444
}) as CSSProperties);
4545
46-
function selectTextWidth(flag: string | undefined): number | undefined {
46+
function selectTextWidth(flag: string): number | undefined {
4747
switch (flag) {
4848
case 'o':
4949
return 0.125;

0 commit comments

Comments
 (0)