From 4dab47bb563060cc14692faad76371e36fbcafd8 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Fri, 23 Aug 2024 03:34:05 +0900 Subject: [PATCH 1/3] chore: update BaseMarkdownInlineTokenRegexPatterns.kt preceeded -> preceded --- .../lexer/patterns/BaseMarkdownInlineTokenRegexPatterns.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/lexer/patterns/BaseMarkdownInlineTokenRegexPatterns.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/lexer/patterns/BaseMarkdownInlineTokenRegexPatterns.kt index 5c9688f1..6b26a22e 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/lexer/patterns/BaseMarkdownInlineTokenRegexPatterns.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/lexer/patterns/BaseMarkdownInlineTokenRegexPatterns.kt @@ -156,7 +156,7 @@ open class BaseMarkdownInlineTokenRegexPatterns { ) /** - * An image, same as a link preceeded by a `!`. + * An image, same as a link preceded by a `!`. * As an extension, Quarkdown introduces an optional `(WxH)` to be added at the end which specifies * the image size, where W and H can be integers or `_` (auto). * @see ImageToken @@ -176,7 +176,7 @@ open class BaseMarkdownInlineTokenRegexPatterns { ) /** - * An image that references a link definition, same as a reference link preceeded by a `!`. + * An image that references a link definition, same as a reference link preceded by a `!`. * @see ReferenceImageToken * @see referenceLink */ From b64defe78fdebd242d18fc21cd7a2b04e516d392 Mon Sep 17 00:00:00 2001 From: Giorgio Garofalo Date: Sat, 24 Aug 2024 00:30:57 +0200 Subject: [PATCH 2/3] Rename AstIterator#run to #traverse --- .../kotlin/eu/iamgio/quarkdown/ast/iterator/AstIterator.kt | 5 +++-- .../iamgio/quarkdown/ast/iterator/ObservableAstIterator.kt | 2 +- .../src/main/kotlin/eu/iamgio/quarkdown/pipeline/Pipeline.kt | 2 +- core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/AstIterator.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/AstIterator.kt index 5dc98f73..a348b5b7 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/AstIterator.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/AstIterator.kt @@ -7,7 +7,8 @@ import eu.iamgio.quarkdown.ast.NestableNode */ interface AstIterator { /** - * Runs the iterator from the given root node + * Runs the iterator from the given root node, + * traversing the node tree and visiting each node. */ - fun run(root: NestableNode) + fun traverse(root: NestableNode) } diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/ObservableAstIterator.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/ObservableAstIterator.kt index 1ed82728..edb131cf 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/ObservableAstIterator.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/ast/iterator/ObservableAstIterator.kt @@ -50,7 +50,7 @@ class ObservableAstIterator : AstIterator { hook.attach(this) } - override fun run(root: NestableNode) { + override fun traverse(root: NestableNode) { root.flattenedChildren().forEach { node -> hooks.forEach { hook -> hook(node) } } diff --git a/core/src/main/kotlin/eu/iamgio/quarkdown/pipeline/Pipeline.kt b/core/src/main/kotlin/eu/iamgio/quarkdown/pipeline/Pipeline.kt index 7a8c1dfd..924e74dd 100644 --- a/core/src/main/kotlin/eu/iamgio/quarkdown/pipeline/Pipeline.kt +++ b/core/src/main/kotlin/eu/iamgio/quarkdown/pipeline/Pipeline.kt @@ -90,7 +90,7 @@ class Pipeline( private fun visitTree(document: Document) { context.flavor.treeIteratorFactory .default(context) - .run(document) + .traverse(document) hooks?.afterTreeVisiting?.invoke(this) } diff --git a/core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt b/core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt index 2d85c1c2..d643fa22 100644 --- a/core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt +++ b/core/src/test/kotlin/eu/iamgio/quarkdown/MiscTest.kt @@ -90,7 +90,7 @@ class MiscTest { assertEquals("java", it.language) } .onFinished { finished = true } - .run(node) + .traverse(node) assertTrue(finished) } From a4bf8b1d04b00ec42e66d2e5a4ff108a6f07dc09 Mon Sep 17 00:00:00 2001 From: Giorgio Garofalo Date: Sat, 24 Aug 2024 00:34:39 +0200 Subject: [PATCH 3/3] Demo: add variable to `Math` code example --- demo/demo.qmd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demo/demo.qmd b/demo/demo.qmd index 9ef81412..4d0b5f93 100644 --- a/demo/demo.qmd +++ b/demo/demo.qmd @@ -151,8 +151,10 @@ from your Markdown code. ## Math .sourceresult - If we try to calculate the **surface** of a circle of **radius 8**, - we'll find out it's **.multiply {.pow {8} to:{2}} by:{.pi}** + .var {radius} {8} + + If we try to calculate the **surface** of a circle of **radius .radius**, + we'll find out it's **.multiply {.pow {.radius} to:{2}} by:{.pi}** ## Scripting {#scripting-basic}