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