Renamed #inject to #use
This commit is contained in:
@@ -195,21 +195,21 @@ functions:
|
||||
insertInjectTemplate:
|
||||
path: "./template.ts:insertTemplateText"
|
||||
slashCommand:
|
||||
name: inject
|
||||
description: Inject template
|
||||
name: use
|
||||
description: Use a template
|
||||
value: |
|
||||
<!-- #inject [[|^|]] {} -->
|
||||
<!-- #use [[|^|]] {} -->
|
||||
|
||||
<!-- /inject -->
|
||||
<!-- /use -->
|
||||
insertInjectCleanTemplate:
|
||||
path: "./template.ts:insertTemplateText"
|
||||
slashCommand:
|
||||
name: inject-clean
|
||||
description: Inject template clean
|
||||
name: use-verbose
|
||||
description: Use a template (verbose mode)
|
||||
value: |
|
||||
<!-- #inject-clean [[|^|]] {} -->
|
||||
<!-- #use-verbose [[|^|]] {} -->
|
||||
|
||||
<!-- /inject-clean -->
|
||||
<!-- /use-verbose -->
|
||||
insertHRTemplate:
|
||||
path: "./template.ts:insertTemplateText"
|
||||
slashCommand:
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function updateMaterializedQueriesCommand() {
|
||||
}
|
||||
|
||||
export const templateInstRegex =
|
||||
/(<!--\s*#(inject|inject-clean|include)\s+\[\[([^\]]+)\]\](.*?)-->)(.+?)(<!--\s*\/\2\s*-->)/gs;
|
||||
/(<!--\s*#(use|use-verbose|include)\s+\[\[([^\]]+)\]\](.*?)-->)(.+?)(<!--\s*\/\2\s*-->)/gs;
|
||||
|
||||
async function updateTemplateInstantiations(
|
||||
text: string,
|
||||
@@ -68,7 +68,7 @@ async function updateTemplateInstantiations(
|
||||
}
|
||||
let newBody = templateText;
|
||||
// if it's a template injection (not a literal "include")
|
||||
if (type == "inject" || type === "inject-clean") {
|
||||
if (type === "use" || type === "use-verbose") {
|
||||
let tree = await parseMarkdown(templateText);
|
||||
extractMeta(tree, ["$disableDirectives"]);
|
||||
templateText = renderToText(tree);
|
||||
@@ -88,7 +88,7 @@ async function cleanTemplateInstantiations(text: string): Promise<string> {
|
||||
text,
|
||||
templateInstRegex,
|
||||
async (fullMatch, startInst, type, template, args, body, endInst) => {
|
||||
if (type === "inject-clean") {
|
||||
if (type === "use") {
|
||||
body = body.replaceAll(
|
||||
queryRegex,
|
||||
(
|
||||
@@ -142,7 +142,7 @@ export async function updateMaterializedQueriesOnPage(
|
||||
|
||||
let parsedQuery = parseQuery(replaceTemplateVars(query, pageName));
|
||||
|
||||
console.log("Parsed query", parsedQuery);
|
||||
// console.log("Parsed query", parsedQuery);
|
||||
// Let's dispatch an event and see what happens
|
||||
let results = await dispatch(
|
||||
`query:${parsedQuery.table}`,
|
||||
|
||||
Reference in New Issue
Block a user