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) => {
const replacement: { fullMatch: string; text?: string } = { fullMatch };
// Pushing to the replacement array
replacements.push(replacement);
const currentNode = nodeAtPos(tree, index + 1);
if (currentNode?.type !== "CommentBlock") {
// If not a comment block, it's likely a code block, ignore
// console.log("Not comment block, ingoring", fullMatch);
return fullMatch;
}
replacements.push(replacement);
try {
const replacementText = await system.invokeFunction(
"server",

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
<!-- #use [[template/tagged-tasks]] "#test" -->
<!-- #use [[template/tagged-tasks]] "test" -->
* [ ] [[🔌 Directive@1340]] This is a test task #test
<!-- /use -->
which renders as:
<!-- #use [[template/tagged-tasks]] "#test" -->
<!-- #use [[template/tagged-tasks]] "test" -->
* [ ] [[🔌 Directive@1537]] This is a test task #test
<!-- /use -->