Skip to content

Commit 5a82c59

Browse files
authored
ENG-134 Query Builder - quotations in titles break {current} and {this page} (#858)
1 parent 02a4e04 commit 5a82c59

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

apps/roam/src/utils/conditionToDatalog.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const getTitleDatalog = ({
8282
{ type: "constant", value: ":node/title" },
8383
{
8484
type: "constant",
85-
value: `"${getPageTitleByPageUid(mainWindowUid)}"`,
85+
value: `"${normalizePageTitle(getPageTitleByPageUid(mainWindowUid))}"`,
8686
},
8787
],
8888
},
@@ -98,7 +98,7 @@ export const getTitleDatalog = ({
9898
{ type: "constant", value: ":node/title" },
9999
{
100100
type: "constant",
101-
value: `"${getPageTitleByBlockUid(uid)}"`,
101+
value: `"${normalizePageTitle(getPageTitleByBlockUid(uid))}"`,
102102
},
103103
],
104104
},
@@ -112,7 +112,10 @@ export const getTitleDatalog = ({
112112
arguments: [
113113
{ type: "variable", value: source },
114114
{ type: "constant", value: ":node/title" },
115-
{ type: "constant", value: `"${getCurrentUserDisplayName()}"` },
115+
{
116+
type: "constant",
117+
value: `"${normalizePageTitle(getCurrentUserDisplayName())}"`,
118+
},
116119
],
117120
},
118121
];
@@ -159,7 +162,10 @@ export const getTitleDatalog = ({
159162
arguments: [
160163
{ type: "variable", value: source },
161164
{ type: "constant", value: ":node/title" },
162-
{ type: "variable", value: target.replace(INPUT_REGEX, "") },
165+
{
166+
type: "variable",
167+
value: target.replace(INPUT_REGEX, ""),
168+
},
163169
],
164170
},
165171
];
@@ -308,7 +314,7 @@ const translator: Record<string, Translator> = {
308314
{ type: "variable", value: `${source}-Title` },
309315
{
310316
type: "constant",
311-
value: `"${getPageTitleByPageUid(uid)}"`,
317+
value: `"${normalizePageTitle(getPageTitleByPageUid(uid))}"`,
312318
},
313319
],
314320
},
@@ -337,7 +343,7 @@ const translator: Record<string, Translator> = {
337343
arguments: [
338344
{ type: "variable", value: `${target}-Attribute` },
339345
{ type: "constant", value: ":node/title" },
340-
{ type: "constant", value: `"${target}"` },
346+
{ type: "constant", value: `"${normalizePageTitle(target)}"` },
341347
],
342348
},
343349
{
@@ -448,7 +454,10 @@ const translator: Record<string, Translator> = {
448454
pred: "clojure.string/includes?",
449455
arguments: [
450456
{ type: "variable", value: `${source}-String` },
451-
{ type: "constant", value: `"${getCurrentUserDisplayName()}"` },
457+
{
458+
type: "constant",
459+
value: `"${normalizePageTitle(getCurrentUserDisplayName())}"`,
460+
},
452461
],
453462
},
454463
];

0 commit comments

Comments
 (0)