From 800ccae639f731e52b6023bc17fc546d82a9d263 Mon Sep 17 00:00:00 2001 From: librasteve Date: Tue, 20 Aug 2024 12:42:42 +0100 Subject: [PATCH] drop \n --- README.md | 22 ++++++++++++++++++++-- bin/synopsis-raoo | 14 +++++++------- lib/HTMX.rakumod | 9 ++++++--- t/01-basic.rakutest | 8 ++++---- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 710ed99..5c58fc1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,8 @@ TODOS - [x] Export them so that `h1("text")` makes `

text

` and so on - [x] Pass and format the HTMX attributes - [x] Bring in synopsis from design -- [ ] Make a parse script (& instructions how to watch a dir) +- [ ] Make a parse script to get routes (likely will want a grammar) + - ```

Click Me

``` - [x] Write some tests - [ ] Write some docs in POD6 - [ ] Release with App::Mi6 @@ -97,13 +98,30 @@ Typical deployment dir structure: ├── index.html └── js +https://cro.services/docs/reference/cro-http-router + +my $app = route { +get -> 'test' { +content 'text/html', q:to/HTML/; +

Did you know...

+

+Aside from fingerprints, everyone has a unique tongue print +too. Lick to login could really be a thing. +

+HTML +} +} + How to launch cro + HTMX: - Install modules `zef install --/test cro HTMX` - Use cro to make a stub service `cro stub http foo foo` - `cd foo` - Use HTMX / HTMOO to make your website and place it in `./static` - - + - add method chains to HTMOO + - add image tag to HTMOO + - add role Party (a Part is a div) + - add Container(s) - ie flexbox and grid - Use rahx to htmx `rahx stub foo` - reads .rahx.yml for config data - make static index.html, place in foo/static and with static route diff --git a/bin/synopsis-raoo b/bin/synopsis-raoo index ce593a8..a1f7103 100755 --- a/bin/synopsis-raoo +++ b/bin/synopsis-raoo @@ -22,16 +22,16 @@ $p.meta: {:charset}; $p.meta: {:name, :content}; $p.meta: {:name, :content}; +$p.link: {:rel, :href }; + $p.title: "Raku HTMX"; $p.script: :src; -$p.link: {:rel, :href }; - -$p.style: q:to/END/; - .jumbotron { - background-color: #e6ffe6; - text-align: center; - } +$p.style: q:to/END/; + .jumbotron { + background-color: #e6ffe6; + text-align: center; + } END $p.body: [ diff --git a/lib/HTMX.rakumod b/lib/HTMX.rakumod index 8e2f934..d9ca6a4 100644 --- a/lib/HTMX.rakumod +++ b/lib/HTMX.rakumod @@ -32,11 +32,14 @@ sub do-regular-tag( $tag, *@inners, *%h ) { my $closer = ''; given @inners { - when * <= 1 { - $opener ~ @inners.join ~ $closer + when * == 0 { + $opener ~ $closer; + } + when * == 1 { + $opener ~ @inners.first ~ $closer; } when * >= 2 { - $opener ~ "\n " ~ @inners.join("\n ") ~ "\n" ~ $closer + $opener ~ @inners.join ~ $closer; } } diff --git a/t/01-basic.rakutest b/t/01-basic.rakutest index 04d4fd3..67dd2a5 100644 --- a/t/01-basic.rakutest +++ b/t/01-basic.rakutest @@ -1,13 +1,13 @@ use Test; use HTMX; -is h1('text', :class), '

text

', 'h1'; +is h1('text', :class).chomp, '

text

', 'h1'; -is h1(:class), '

', 'empty'; +is h1(:class).chomp, '

', 'empty'; -is div(:class, 'xx'), '
xx
', 'regular'; +is div(:class, 'xx').chomp, '
xx
', 'regular'; -is hr, '
', 'singluar'; +is hr, '
', 'singluar'; done-testing;