From 3ad434577b49024edd18a27519fe70f2415e5037 Mon Sep 17 00:00:00 2001 From: librasteve Date: Mon, 22 Jul 2024 08:41:06 +0100 Subject: [PATCH 1/5] spike to synopsis --- bin/index.html | 20 ++++++++++++++++++++ bin/synopsis-rahx | 24 +++++++++++++++++++++++- lib/HTMX.rakumod | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 bin/index.html diff --git a/bin/index.html b/bin/index.html new file mode 100644 index 0000000..00848af --- /dev/null +++ b/bin/index.html @@ -0,0 +1,20 @@ +

text

+ + + + + + + Raku HTMX + + + + + + + + +
class jumbotron
+ + + diff --git a/bin/synopsis-rahx b/bin/synopsis-rahx index 4b56d50..fcd05f2 100755 --- a/bin/synopsis-rahx +++ b/bin/synopsis-rahx @@ -4,4 +4,26 @@ use v6.d; use HTMX; -say h1('text', :class); \ No newline at end of file +say h1('text', :class); + +say div (:class, ); + +#my $page = HTMX.new; +# +#$page.body = + +# div (:class,); +# [ +# h1 "Welcome to Dunder Mifflin!", +# +# p "Dunder Mifflin Inc. (stock symbol {strong 'DMI'}" ~ +# q:to/END/; +# is a micro-cap regional paper and office +# supply distributor with an emphasis on servicing +# small-business clients. +# END +# ] +# ); +# +# +#say $page.render; \ No newline at end of file diff --git a/lib/HTMX.rakumod b/lib/HTMX.rakumod index f6b0548..45e2a11 100644 --- a/lib/HTMX.rakumod +++ b/lib/HTMX.rakumod @@ -2,6 +2,42 @@ unit class HTMX; constant term:<¶> = $?NL; +has $.head; +has $.body is rw; +has $.foot; + +method TWEAK { + + $!head //= q:to/ENDHEAD/; + + + + + + + Raku HTMX + + + + + + + + + ENDHEAD + + $!foot //= q:to/ENDFOOT/; + + + + ENDFOOT + +} + +method render { + $!head ~ $!body ~ $!foot +} + ##### HTMX Tag Export ##### From ce830567abd7c56f48c8fba6a694d8c080ee783e Mon Sep 17 00:00:00 2001 From: librasteve Date: Mon, 22 Jul 2024 21:25:16 +0100 Subject: [PATCH 2/5] rm Build --- Build.rakumod | 18 ----- META6.json | 5 +- README.md | 1 + bin/html5-tags-extract.raku | 18 ----- bin/index.html | 20 ----- bin/synopsis-rahx | 15 ++-- index.html | 28 +++++++ lib/HTMX.rakumod | 50 ++++-------- resources/html5-tags-list.csv | 113 -------------------------- resources/html5-tags-w3schools.csv | 123 ----------------------------- 10 files changed, 55 insertions(+), 336 deletions(-) delete mode 100644 Build.rakumod delete mode 100755 bin/html5-tags-extract.raku delete mode 100644 bin/index.html create mode 100644 index.html delete mode 100644 resources/html5-tags-list.csv delete mode 100644 resources/html5-tags-w3schools.csv diff --git a/Build.rakumod b/Build.rakumod deleted file mode 100644 index 97b0194..0000000 --- a/Build.rakumod +++ /dev/null @@ -1,18 +0,0 @@ -use v6.d; - -class Build { - method build($dist-path) { - - #| also specified in en_SI.rakumod - my $rahx = '.rahx-config'; - my $file = 'html5-tags-list.csv'; - - #| mkdir will use existing if present - mkdir "$*HOME/$rahx"; - - copy "resources/$file", "$*HOME/$rahx/$file"; - - exit 0 - } -} - diff --git a/META6.json b/META6.json index 280a359..a9ec032 100644 --- a/META6.json +++ b/META6.json @@ -13,10 +13,7 @@ "provides": { "HTMX": "lib/HTMX.rakumod" }, - "resources": [ - "html5-tags-w3schools.csv", - "html5-tags-list.csv" - ], + "resources": [], "license": "Artistic-2.0", "tags": [], "source-url": "" diff --git a/README.md b/README.md index 9ada881..46c3e77 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ TODOS #### Follow On +- [ ] consider adding back end template to this module (like this https://github.com/Konfuzian/htmx-examples-with-flask/tree/main) - [ ] CSS - try some alternatives, read some stuff, make a plan - [ ] Cro - how to integrate HTMX Static pages with Cro backend - [ ] Hummingbird - ditto for HB diff --git a/bin/html5-tags-extract.raku b/bin/html5-tags-extract.raku deleted file mode 100755 index 54f4283..0000000 --- a/bin/html5-tags-extract.raku +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env/raku - -# This script extracts HTML5 tag names from the table at -# https://www.w3schools.com/tags/default.asp - -my @lines = "../resources/html5-tags-w3schools.csv".IO.lines; - -@lines.shift; # remove header row -@lines.shift; # remove !-- -- -@lines.shift; # remove !DOCTYPE -@lines .= grep: {! /'Not supported in HTML5'/}; # remove deprecated -@lines .= map: *.split(",")[0]; # take column 1 -@lines .= map: *.subst('<', ''); # \ rm angle brackets -@lines .= map: *.subst('>', ''); # / -@lines .= grep: {! /'h1'/}; # remove '

to

' row -for ^6 { @lines.append: 'h' ~ ++$ }; # put in h1..h6 rows - -spurt "../resources/html5-tags-list.csv", @lines.sort.join: "\n"; diff --git a/bin/index.html b/bin/index.html deleted file mode 100644 index 00848af..0000000 --- a/bin/index.html +++ /dev/null @@ -1,20 +0,0 @@ -

text

- - - - - - - Raku HTMX - - - - - - - - -
class jumbotron
- - - diff --git a/bin/synopsis-rahx b/bin/synopsis-rahx index fcd05f2..ceccd87 100755 --- a/bin/synopsis-rahx +++ b/bin/synopsis-rahx @@ -3,15 +3,22 @@ use v6.d; use HTMX; +put +list-tags; +put +list-singulars; +put +list-regulars; + say h1('text', :class); say div (:class, ); -#my $page = HTMX.new; -# -#$page.body = + + + + +#my $page = +# # div (:class,); # [ # h1 "Welcome to Dunder Mifflin!", @@ -25,5 +32,3 @@ say div (:class, ); # ] # ); # -# -#say $page.render; \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..f2da0c3 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +
+

Welcome to Dunder Mifflin!

+

+ Dunder Mifflin Inc. (stock symbol DMI) is + a micro-cap regional paper and office supply distributor with + an emphasis on servicing small-business clients. +

+
+ + \ No newline at end of file diff --git a/lib/HTMX.rakumod b/lib/HTMX.rakumod index 45e2a11..90f078e 100644 --- a/lib/HTMX.rakumod +++ b/lib/HTMX.rakumod @@ -2,46 +2,26 @@ unit class HTMX; constant term:<¶> = $?NL; -has $.head; -has $.body is rw; -has $.foot; - -method TWEAK { - - $!head //= q:to/ENDHEAD/; - - - - - - - Raku HTMX - - - - - - - - - ENDHEAD - - $!foot //= q:to/ENDFOOT/; - - - - ENDFOOT +##### HTMX Tag Export ##### -} +#viz. https://www.w3schools.com/tags/default.asp -method render { - $!head ~ $!body ~ $!foot -} +constant @tags = ; +#of which "empty" / "singular" tags from https://www.tutsinsider.com/html/html-empty-elements/ +constant @singular-tags = ; -##### HTMX Tag Export ##### +my @regular-tags = ( @tags.Set (-) @singular-tags.Set ).List; -my Str @tags = "$*HOME/.rahx-config/html5-tags-list.csv".IO.lines; +sub list-tags is export { @tags.sort } +sub list-singulars is export { @singular-tags.sort } +sub list-regulars is export { @regular-tags.sort } # Export them so that `h1("text")` makes `

text

` and so on # eg sub h1(Str $inner) {do-tag 'h1', $inner} diff --git a/resources/html5-tags-list.csv b/resources/html5-tags-list.csv deleted file mode 100644 index 2902ced..0000000 --- a/resources/html5-tags-list.csv +++ /dev/null @@ -1,113 +0,0 @@ -a -abbr -address -area -article -aside -audio -b -base -bdi -bdo -blockquote -body -br -button -canvas -caption -cite -code -col -colgroup -data -datalist -dd -del -details -dfn -dialog -div -dl -dt -em -embed -fieldset -figcaption -figure -footer -form -h1 -h2 -h3 -h4 -h5 -h6 -head -header -hgroup -hr -html -i -iframe -img -input -ins -kbd -label -legend -li -link -main -map -mark -menu -meta -meter -nav -noscript -object -ol -optgroup -option -output -p -param -picture -pre -progress -q -rp -rt -ruby -s -samp -script -search -section -select -small -source -span -strong -style -sub -summary -sup -svg -table -tbody -td -template -textarea -tfoot -th -thead -time -title -tr -track -u -ul -var -video -wbr \ No newline at end of file diff --git a/resources/html5-tags-w3schools.csv b/resources/html5-tags-w3schools.csv deleted file mode 100644 index 73b6bbf..0000000 --- a/resources/html5-tags-w3schools.csv +++ /dev/null @@ -1,123 +0,0 @@ -Tag,Description -,Defines a comment -,Defines the document type -
,Defines a hyperlink -,Defines an abbreviation or an acronym -,Not supported in HTML5. Use instead. Defines an acronym -
,Defines contact information for the author/owner of a document -,Not supported in HTML5. Use or instead. Defines an embedded applet -,Defines an area inside an image map -
,Defines an article -