Skip to content

Commit

Permalink
drop \n
Browse files Browse the repository at this point in the history
  • Loading branch information
librasteve committed Aug 20, 2024
1 parent e42004a commit 800ccae
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ TODOS
- [x] Export them so that `h1("text")` makes `<h1>text</h1>` 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)
- ```<p hx-get="https://v2.jokeapi.dev/joke/Any?format=txt&safe-mode">Click Me</p>```
- [x] Write some tests
- [ ] Write some docs in POD6
- [ ] Release with App::Mi6
Expand All @@ -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/;
<h1>Did you know...</h1>
<p>
Aside from fingerprints, everyone has a unique tongue print
too. Lick to login could really be a thing.
</p>
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
Expand Down
14 changes: 7 additions & 7 deletions bin/synopsis-raoo
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ $p.meta: {:charset<utf-8>};
$p.meta: {:name<viewport>, :content<width=device-width, initial-scale=1>};
$p.meta: {:name<description>, :content<raku does htmx>};

$p.link: {:rel<stylesheet>, :href<https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css> };

$p.title: "Raku HTMX";
$p.script: :src<https://unpkg.com/htmx.org@1.7.0>;

$p.link: {:rel<stylesheet>, :href<https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css> };

$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: [
Expand Down
9 changes: 6 additions & 3 deletions lib/HTMX.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ sub do-regular-tag( $tag, *@inners, *%h ) {
my $closer = '</' ~ $tag ~ '>';

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;
}
}

Expand Down
8 changes: 4 additions & 4 deletions t/01-basic.rakutest
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use Test;
use HTMX;

is h1('text', :class<jumbotron>), '<h1 class="jumbotron">text</h1>', 'h1';
is h1('text', :class<jumbotron>).chomp, '<h1 class="jumbotron">text</h1>', 'h1';

is h1(:class<doobie>), '<h1 class="doobie"></h1>', 'empty';
is h1(:class<doobie>).chomp, '<h1 class="doobie"></h1>', 'empty';

is div(:class<jumbotron>, 'xx'), '<div class="jumbotron">xx</div>', 'regular';
is div(:class<jumbotron>, 'xx').chomp, '<div class="jumbotron">xx</div>', 'regular';

is hr, '<hr />', 'singluar';
is hr, '<hr />', 'singluar';


done-testing;

0 comments on commit 800ccae

Please sign in to comment.