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/synopsis-rahx b/bin/synopsis-rahx index 4b56d50..f09552b 100755 --- a/bin/synopsis-rahx +++ b/bin/synopsis-rahx @@ -4,4 +4,32 @@ use v6.d; use HTMX; -say h1('text', :class); \ No newline at end of file +say list-regulars; + +say h1('text', :class); +say h1 :class; + +say div :class, 'xx'; + +say br; + + + + + + +#my $page = +# +# 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 +# ] +# ); +# 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 f6b0548..e745f41 100644 --- a/lib/HTMX.rakumod +++ b/lib/HTMX.rakumod @@ -2,27 +2,54 @@ unit class HTMX; constant term:<¶> = $?NL; - ##### HTMX Tag Export ##### -my Str @tags = "$*HOME/.rahx-config/html5-tags-list.csv".IO.lines; +#viz. https://www.w3schools.com/tags/default.asp + +constant @all-tags = ; + +#of which "empty" / "singular" tags from https://www.tutsinsider.com/html/html-empty-elements/ +constant @singular-tags = ; + +my @regular-tags = (@all-tags.Set (-) @singular-tags.Set).keys; + +sub list-tags is export {@all-tags.sort } +sub list-singulars is export { @singular-tags.sort } +sub list-regulars is export { @regular-tags } # Export them so that `h1("text")` makes `

text

` and so on # eg sub h1(Str $inner) {do-tag 'h1', $inner} -sub do-tag( $tag, $inner, *%h ) { +sub do-regular-tag( $tag, $inner?, *%h ) { - my Str $attrs = (+%h ?? ' ' !! '') ~ %h.map({ .key ~ '="' ~ .value ~ '"' }).join(' '); + my $attrs = +%h ?? (' ' ~ %h.map({.key ~ '="' ~ .value ~ '"'}).join(' ') ) !! ''; - '<' ~ $tag ~ $attrs ~ '>' ~ $inner ~ '' + '<' ~ $tag ~ $attrs ~ '>' ~ ($inner // '') ~ '' +} + +sub do-singular-tag( $tag, *%h ) { + + my $attrs = +%h ?? (' ' ~ %h.map({.key ~ '="' ~ .value ~ '"'}).join(' ') ) !! ''; + + '<' ~ $tag ~ $attrs ~ ' />' } # put in all the tags programmatically # viz. https://docs.raku.org/language/modules#Exporting_and_selective_importing my package EXPORT::DEFAULT { - for @tags -> $tag { - OUR::{'&' ~ $tag} := sub ($inner, *%h) { do-tag( "$tag", $inner, |%h ) } + for @regular-tags -> $tag { + OUR::{'&' ~ $tag} := sub ($inner?, *%h) { do-regular-tag( "$tag", $inner, |%h ) } + } + + for @singular-tags -> $tag { + OUR::{'&' ~ $tag} := sub (*%h) { do-singular-tag( "$tag", |%h ) } } } 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 -