Skip to content

Commit 2ce2e70

Browse files
authored
Lightning Live-Reload and doc cleaning (#674)
1 parent 9fe1c01 commit 2ce2e70

File tree

13 files changed

+232
-150
lines changed

13 files changed

+232
-150
lines changed

blog/content/docs/basics.adoc

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ NOTE: if you don't already have layouts and partials in your project, <<install-
7575

7676
If you’re using a theme, you can take advantage of its layouts, but you’re also free to add your own. Layouts are built on a powerful inheritance system, allowing flexibility and customization.
7777

78+
// https://excalidraw.com/#json=NMbfajh74vODDIkfujKt8,0M5Vbhdd3oN02Nn-dgcbiw
79+
image::roq-layouts.png[Roq - Layouts]
80+
7881
TIP: When using a theme, you can create new layouts that extend the existing theme layouts or partially override them to better suit your needs. Learn more here: xref:advanced.adoc#overriding-theme[Overriding Theme].
7982

83+
8084
In this sample we will create a simple 3 steps inheritance layout. All below files should be located in the `templates/layouts/` directory.
8185

8286
To do so, you will first need a `default.html` file as followed:
@@ -255,7 +259,7 @@ TIP: There are different ways to link your pages as explained in the link:{site
255259

256260
You can use Qute to access site and pages data. For this use the `site` and `page` variables:
257261

258-
* The `site` (link:{roqjavadocmodelurl}Site.html[javadoc,window=_blank]) variable allow to access site global info from any page, document, layout or partial.
262+
* The `site` (link:{roqjavadocmodelurl}model/Site.html[javadoc,window=_blank]) variable allow to access site global info from any page, document, layout or partial.
259263
+
260264
.Show attributes
261265
[%collapsible]
@@ -322,7 +326,7 @@ You can use Qute to access site and pages data. For this use the `site` and `pag
322326
|===
323327
====
324328

325-
* The `page` (link:{roqjavadocmodelurl}Page.html[javadoc,window=_blank]) variable is available in pages, documents, layouts, and partials. It contains the info for the page it is used from.
329+
* The `page` (link:{roqjavadocmodelurl}model/Page.html[javadoc,window=_blank]) variable is available in pages, documents, layouts, and partials. It contains the info for the page it is used from.
326330
+
327331
.Show attributes
328332
[%collapsible]
@@ -454,20 +458,68 @@ Can be access with `{cdi:foo.bar}` in any template.
454458

455459
== Template Extensions
456460

457-
The Qute templating language supports a concept called https://quarkus.io/guides/qute#template-extension-methods[template extension methods]. These methods allow us to add functional to types and expose it in our templates. Moving logic from the template to Java code gives us the ability to use a more robust language for more complex logic and makes the functionality more easily reusable,as well as keeping our templates clean. Roq has several built-in template extensions:
461+
The Qute templating language supports a concept called https://quarkus.io/guides/qute#template-extension-methods[template extension methods]. These methods allow us to add functional to types and expose it in our templates. Moving logic from the template to Java code gives us the ability to use a more robust language for more complex logic and makes the functionality more easily reusable,as well as keeping our templates clean. Roq has several built-in template extensions (link:{roqjavadocmodelurl}RoqTemplateExtension.html[javadoc,window=_blank]):
458462

459-
[%header]
463+
[cols="1,2", options="header"]
460464
|===
461-
| Method Name | Parent Type | Return Type | Parameters | Description
462-
| `asStrings` | `String` or `JsonArray` | `List<String` | | Returns a list of `String`s created by splitting the provided `String`, or converting the `JsonArray` to a `List`. An empty `List` is returned for objects of other types.
463-
| `collection` | `RoqCollections` | `RoqCollection`| `String key`| Returns the `RoqCollection` for `key`
464-
| `contentAbstract` | `Page` or `String` | `String` | `int limit` | Returns an abstract for the given `Page` or HTML content. A `Page` is rendered to HTML first, then all HTML is stripped away (see `stripHtml`) and the first `limit` words (default: 75) are returned.
465-
| `mimeType` | `String` | `String` | | Returns the mimetype for the specified file. A `null` is returned for unrecognized or invalid file names/types.
466-
| `numberOfWords` | `String` | `long` | | Returns the number of words in the given String
467-
| `readTime` | `Page` | `long` | | Returns the estimated number of minutes to read the given page
468-
| `slugify` | `String` | `String` | | Applies Roq's slug formatting to the given string
469-
| `stripHtml` | `String` | `String` | | Strips all HTML tags from the given string, returning plain text
470-
| `wordLimit` | `String` | `String` | `int limit` | Returns the first `limit` words in the given text.
465+
| Usage in a Qute template | Description
466+
467+
| ``text.numberOfWords``
468+
| Returns the number of words in the string
469+
470+
| ``text.wordLimit(limit)``
471+
| Returns the text limited to `limit` words, adds "..." if truncated
472+
473+
| ``text.slugify``
474+
| Returns a slugified version of the text
475+
476+
| ``htmlContent.contentAbstract(limit)``
477+
| Returns the HTML content limited to `limit` words
478+
479+
| ``htmlContent.stripHtml``
480+
| Returns the text with all HTML tags removed
481+
482+
| ``page.readTime``
483+
| Returns the estimated reading time in minutes for the page content
484+
485+
| ``page.contentAbstract``
486+
| Returns the first 75 words of the page content
487+
488+
| ``page.contentAbstract(limit)``
489+
| Returns the page content limited to `limit` words
490+
491+
| ``list.limit(n)``
492+
| Returns only the first `n` items of the list
493+
494+
| ``list.randomise``
495+
| Returns the list in random order
496+
497+
| ``list.reverse``
498+
| Returns the list in reverse order
499+
500+
| ``collections.collection(key)``
501+
| Returns the collection for the given key
502+
503+
| ``posts.filter(key, value)``
504+
| Returns only documents matching the front-matter key/value
505+
506+
| ``posts.future``
507+
| Returns only documents dated in the future
508+
509+
| ``posts.past``
510+
| Returns only documents dated in the past
511+
512+
| ``posts.sortBy(key, reverse)``
513+
| Sorts documents by a front-matter key (string), optionally reversed
514+
515+
| ``posts.sortByDate(reverse)``
516+
| Sorts documents by date, optionally reversed
517+
518+
| ``field.asStrings``
519+
| Normalizes a front-matter field into a list of strings
520+
521+
| ``fileName.mimeType``
522+
| Returns the MIME type based on the file name extension
471523
|===
472524

473525
You can provide your own template extensions by adding a class to your projects `src/main/java` directory and annotating either class or the `public static` method with `@TemplateExtension`:

blog/content/docs/plugins.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ paginate: true
5656
5757
----
5858

59+
This plugin also adds Qute Template Extension:
60+
61+
[cols="1,2", options="header"]
62+
|===
63+
| Usage | Description
64+
65+
| ``collection.allTags``
66+
| Returns a list of all tags from the collection, each tag slugified
67+
68+
| ``collection.tagsCount``
69+
| Returns a list of all tags slugified (name) with their count (count) in the collection
70+
|===
71+
5972
[#plugin-aliases]
6073
== Roq Plugin Aliases (Redirections)
6174

blog/content/posts/drafts/2025-11-18-roq-in-java-advent-calendar/index.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

blog/includes/attributes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
:idseparator: -
77
:page-layout: doc
88
:imagesdir: {site-path}images/docs
9-
:roqjavadocmodelurl: https://javadoc.io/doc/io.quarkiverse.roq/quarkus-roq-frontmatter/latest/io/quarkiverse/roq/frontmatter/runtime/model/
9+
:roqjavadocurl: https://javadoc.io/doc/io.quarkiverse.roq/quarkus-roq-frontmatter/latest/io/quarkiverse/roq/frontmatter/runtime/
212 KB
Loading

blog/templates/layouts/roq-default/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<footer>
1616
{#include partials/roq-default/sidebar-contact /}
1717
<section class="support">
18-
<p><b>To support me, give me some stars:</b></p>
18+
<p><b>You like Roq, give it a star:</b></p>
1919
<!-- Place this tag where you want the button to render. -->
2020
<a class="github-button" href="https://github.com/quarkiverse/quarkus-roq" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star quarkiverse/quarkus-roq on GitHub">Star</a>
2121
</section>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<quarkus-qute-web.version>3.4.4</quarkus-qute-web.version>
4242
<asciidoctorj.version>3.0.1</asciidoctorj.version>
4343
<asciidoctorj-diagram.version>3.0.1</asciidoctorj-diagram.version>
44-
<quarkus-web-bundler.version>2.0.0.CR6</quarkus-web-bundler.version>
44+
<quarkus-web-bundler.version>2.0.0.CR7</quarkus-web-bundler.version>
4545
<asciidoc-java.version>1.2.12</asciidoc-java.version>
4646
<jandex.version>3.5.2</jandex.version>
4747
<jsoup.version>1.21.2</jsoup.version>

0 commit comments

Comments
 (0)