Skip to content

Commit

Permalink
Move .text's content from body parameter to first inline parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgio committed Oct 11, 2024
1 parent 25c8687 commit 1935504
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
15 changes: 5 additions & 10 deletions demo/demo.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Export your Quarkdown project as:

.function {poweredby}
credits:
.text size:{tiny} variant:{smallcaps}
powered by .credits
.text {powered by .credits} size:{tiny} variant:{smallcaps}

- .fragment
beautiful slides for your next presentation, just like this one.
Expand Down Expand Up @@ -103,8 +102,7 @@ from your Markdown code.
```

.fragment
.text size:{small}
**Hello, world** from Giorgio!
.text {**Hello, world** from Giorgio!} size:{small}

<!-- Like .animatedsourceresult, but with no animations. -->
.function {sourceresult}
Expand All @@ -122,8 +120,7 @@ from your Markdown code.
!(150x150)[Quarkdown](img/icon.png)

.column cross:{start}
.text size:{large} variant:{smallcaps}
**Quarkdown is on GitHub!**
.text {**Quarkdown is on GitHub!**} size:{large} variant:{smallcaps}

https://github.com/iamgio/quarkdown

Expand Down Expand Up @@ -161,8 +158,7 @@ from your Markdown code.

## Scripting {#scripting-basic}

.text size:{small}
Basic algorithm
.text {Basic algorithm} size:{small}

.sourceresult
.row alignment:{spacearound}
Expand All @@ -173,8 +169,7 @@ from your Markdown code.

## Scripting {#scripting-fibonacci}

.text size:{small}
Fibonacci sequence
.text {Fibonacci sequence} size:{small}

.sourceresult
.var {t1} {0}
Expand Down
6 changes: 3 additions & 3 deletions stdlib/src/main/kotlin/eu/iamgio/quarkdown/stdlib/Text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ val Text: Module =

/**
* Creates an inline text node with specified formatting and transformation.
* @param text inline content to transform
* @param size font size, or default if not specified
* @param weight font weight, or default if not specified
* @param style font style, or default if not specified
* @param decoration text decoration, or default if not specified
* @param case text case, or default if not specified
* @param variant font variant, or default if not specified
* @param color text color, or default if not specified
* @param content inline content to transform
*/
fun text(
text: InlineMarkdownContent,
size: TextTransformData.Size? = null,
weight: TextTransformData.Weight? = null,
style: TextTransformData.Style? = null,
decoration: TextTransformData.Decoration? = null,
case: TextTransformData.Case? = null,
variant: TextTransformData.Variant? = null,
color: Color? = null,
content: InlineMarkdownContent,
): NodeValue =
TextTransform(
TextTransformData(size, weight, style, decoration, case, variant, color),
content.children,
text.children,
).wrappedAsValue()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class FullPipelineTest {
)
}

execute("This is a .text content:{small text} size:{tiny} variant:{smallcaps}") {
execute("This is a .text {small text} size:{tiny} variant:{smallcaps}") {
assertEquals(
"<p>This is a <span class=\"size-tiny\" style=\"font-variant: small-caps;\">small text</span></p>",
it,
Expand Down Expand Up @@ -250,7 +250,7 @@ class FullPipelineTest {
assertEquals("<h4>5</h4>", it)
}

execute("###### .text size:{tiny} content:{Hello, **world**}") {
execute("###### .text {Hello, **world**} size:{tiny}") {
assertEquals("<h6><span class=\"size-tiny\">Hello, <strong>world</strong></span></h6>", it)
}

Expand Down Expand Up @@ -1002,8 +1002,7 @@ class FullPipelineTest {
"""
.function {poweredby}
credits:
.text size:{small} variant:{smallcaps}
powered by .credits
.text {powered by .credits} size:{small} variant:{smallcaps}
This **exciting feature**, .poweredby {[Quarkdown](https://github.com/iamgio/quarkdown)}, looks great!
""".trimIndent(),
Expand Down

0 comments on commit 1935504

Please sign in to comment.