Skip to content

Commit

Permalink
HTMOO spike
Browse files Browse the repository at this point in the history
  • Loading branch information
librasteve committed Aug 13, 2024
1 parent 9abcd1b commit ec2b14c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ NAME

This module provides a programmatic style for HTML and HTMX ([htmx.org]) web content.

For now it's missing the server side piece, likely will start with Hummingbird.
For now it's missing the server side piece, likely will start with Cro.

SYNOPSIS
========
Expand Down Expand Up @@ -93,6 +93,7 @@ TODOS
#### Rejected
- [ ] Do the ¶ term - NOPE this messes with editor code preview


AUTHOR
======

Expand Down
6 changes: 3 additions & 3 deletions bin/server.raku
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ my $application = route {
}
}

my Cro::Service $hello = Cro::HTTP::Server.new:
my Cro::Service $service = Cro::HTTP::Server.new:
:host<localhost>, :port<10000>, :$application;

$hello.start;
$service.start;

react whenever signal(SIGINT) { $hello.stop; exit; }
react whenever signal(SIGINT) { $service.stop; exit; }

#raku server.raku
#lynx localhost:10000/greet/librasteve
24 changes: 19 additions & 5 deletions lib/HTMOO.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class Meta {
}

class Title {
has $.title;
has $.text;

method render {
'<title>' ~ $!title ~ '</title>' ~ "\n"
'<title>' ~ $!text ~ '</title>' ~ "\n"
}
}

Expand Down Expand Up @@ -94,11 +94,25 @@ class Page {

# example ... refactor to .new iamerejh
my $page = Page.new:
Html => Html.new:
Head => Head.new:
Html => Html.new: (
Head => ( Head.new:
Meta => [
Meta.new: m1,
Meta.new: m2
],
Title => Title.new:
Title => Title.new: text => "a title",
Script => [
Script.new: s1,
Script.new: s2
],
Link => [
Link.new: l1,
],
Style => [
Style.new: s1,
]
),
Body => Body.new: text => $bt,
),
; #iamerejh

0 comments on commit ec2b14c

Please sign in to comment.