Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 61b4550

Browse files
committed
Merge branch 'master' into 227-migrate-actual-dispatcher-to-zustand
2 parents 1640b75 + be1de09 commit 61b4550

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/helpers/QueryHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { DatabaseCore } from "helpers/Constants";
44
export function generateDataviewTableQuery(columns: Record<string, DatabaseColumn>, fromQuery: string): string {
55
return `TABLE ${Object.keys(columns)
66
.filter((key) => !key.startsWith("__") && !key.endsWith("__"))
7-
.join(",")},${DatabaseCore.DATAVIEW_FILE},${DatabaseCore.FRONTMATTER_KEY} ${fromQuery.replace(/['"]+/g, '')}`
7+
.join(",")},${DatabaseCore.DATAVIEW_FILE},${DatabaseCore.FRONTMATTER_KEY} ${fromQuery}`
88
}

src/parsers/EscapeHelper.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function escapeSpecialCharacters(stringToEscape: string): string {
2+
return stringToEscape
3+
.replaceAll("\"", "\\\"")
4+
.replaceAll("\n", "\\n")
5+
}
6+
7+
export function unEscapeSpecialCharacters(stringToUnescape: string): string {
8+
return stringToUnescape
9+
.replaceAll("\\\"", "\"")
10+
.replaceAll("\\n", "\n")
11+
}

src/parsers/handlers/marshall/MarshallConfigHandler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { YamlHandlerResponse } from 'cdm/MashallModel';
22
import { LocalSettings } from 'cdm/SettingsModel';
33
import { SourceDataTypes, CellSizeOptions, DEFAULT_SETTINGS } from 'helpers/Constants';
44
import { Literal } from 'obsidian-dataview';
5+
import { unEscapeSpecialCharacters } from 'parsers/EscapeHelper';
56
import { AbstractYamlHandler } from 'parsers/handlers/marshall/AbstractYamlPropertyHandler';
67

78
export class MarshallConfigHandler extends AbstractYamlHandler {
@@ -31,7 +32,11 @@ export class MarshallConfigHandler extends AbstractYamlHandler {
3132
}
3233

3334
loadDefaultConfig<K extends keyof LocalSettings>(key: K, value: Literal, localSettings: LocalSettings): LocalSettings {
34-
localSettings[key] = value as any;
35+
var unEscapedValue = value
36+
if (typeof value === "string") {
37+
unEscapedValue = unEscapeSpecialCharacters(value)
38+
}
39+
localSettings[key] = unEscapedValue as any;
3540
return localSettings;
3641
}
3742

src/parsers/handlers/unmarshall/UnmarshallConfigHandler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { DiskHandlerResponse } from "cdm/MashallModel";
22
import { LocalSettings } from "cdm/SettingsModel";
33
import { InputType, YAML_INDENT } from "helpers/Constants";
4+
import { escapeSpecialCharacters } from "parsers/EscapeHelper";
45
import { AbstractDiskHandler } from "parsers/handlers/unmarshall/AbstractDiskPropertyHandler";
56
import { DataviewService } from "services/DataviewService";
67

@@ -18,6 +19,8 @@ export class UnmarshallConfigHandler extends AbstractDiskHandler {
1819
// Lvl3: config properties
1920
this.localDisk.push(`${YAML_INDENT.repeat(2)}${key}: "${parseValue(valueInternal as string, config)}"`);
2021
});
22+
} else if (typeof valueConfig == "string") {
23+
this.localDisk.push(`${YAML_INDENT.repeat(1)}${key}: "${parseValue(escapeSpecialCharacters(valueConfig), config)}"`);
2124
} else {
2225
// Lvl2: config properties
2326
this.localDisk.push(`${YAML_INDENT.repeat(1)}${key}: "${parseValue(valueConfig, config)}"`);

0 commit comments

Comments
 (0)