Directive fix

pull/138/head
Zef Hemel 2022-11-25 13:47:10 +01:00
parent 69ac54b414
commit 94127c41f0
4 changed files with 6 additions and 6 deletions

View File

@ -41,13 +41,13 @@ export async function updateDirectivesOnPageCommand(arg: any) {
async (fullMatch, startInst, _type, _arg, _body, endInst, index) => { async (fullMatch, startInst, _type, _arg, _body, endInst, index) => {
const replacement: { fullMatch: string; text?: string } = { fullMatch }; const replacement: { fullMatch: string; text?: string } = { fullMatch };
// Pushing to the replacement array // Pushing to the replacement array
replacements.push(replacement);
const currentNode = nodeAtPos(tree, index + 1); const currentNode = nodeAtPos(tree, index + 1);
if (currentNode?.type !== "CommentBlock") { if (currentNode?.type !== "CommentBlock") {
// If not a comment block, it's likely a code block, ignore // If not a comment block, it's likely a code block, ignore
// console.log("Not comment block, ingoring", fullMatch); // console.log("Not comment block, ingoring", fullMatch);
return fullMatch; return fullMatch;
} }
replacements.push(replacement);
try { try {
const replacementText = await system.invokeFunction( const replacementText = await system.invokeFunction(
"server", "server",

View File

@ -4,4 +4,4 @@ $disableDirectives: true
<!-- #query task where tags = "{{.}}" and done = false render [[template/task]] --> <!-- #query task where tags = "{{.}}" and done = false render [[template/task]] -->
<!-- /query --> <!-- /query -->

View File

@ -1 +1 @@
* [{{#if done}}x{{else}} {{/if}}] [[{{page}}@{{pos}}]] {{name}} {{#if deadline}}📅 {{deadline}}{{/if}} {{#each tags}}{{.}} {{/each}} * [{{#if done}}x{{else}} {{/if}}] [[{{page}}@{{pos}}]] {{name}} {{#if deadline}}📅 {{deadline}}{{/if}} {{#each tags}}#{{.}} {{/each}}

View File

@ -39,13 +39,13 @@ Note that a string is also a valid JSON value:
* [ ] #test This is a test task * [ ] #test This is a test task
<!-- #use [[template/tagged-tasks]] "#test" --> <!-- #use [[template/tagged-tasks]] "test" -->
* [ ] [[🔌 Directive@1340]] This is a test task #test * [ ] [[🔌 Directive@1340]] This is a test task #test
<!-- /use --> <!-- /use -->
which renders as: which renders as:
<!-- #use [[template/tagged-tasks]] "#test" --> <!-- #use [[template/tagged-tasks]] "test" -->
* [ ] [[🔌 Directive@1537]] This is a test task #test * [ ] [[🔌 Directive@1537]] This is a test task #test
<!-- /use --> <!-- /use -->
@ -73,4 +73,4 @@ Optionally, you can use a `render` clause to render the result as a template, si
id: title-unfurl id: title-unfurl
name: Extract title name: Extract title
--- ---
<!-- /eval --> <!-- /eval -->