summaryrefslogtreecommitdiff
path: root/lib/Katana/HTML/Generate.rakumod
blob: fb020b4d9fe4b1bbbf556ab9c11bcd6d7052ac62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use v6.d;

unit module Katana::HTML::Generate:api<1>;

multi sub generate-from-tags(Str $doctype, @tags) is export {
  say $doctype;
  generate-from-tags @tags;
}

multi sub generate-from-tags(@tags) is export {
  my @sgat; # tags spelled in reverse.
  for @tags -> $tag {
    say $tag.open;
    say $tag.text if $tag.has-text;
    unshift @sgat, $tag;
  }
  for @sgat -> $tag {
    say $tag.close;
    generate-from-tags $tag.succ if $tag.has-succ;
  }
}