### ----------------------------------------------------
### -- Raku::Pod::Render
### -- Licenses: Artistic-2.0
### -- Authors: Richard Hainsworth
### -- File: lib/ProcessedPod.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 2
 True;
            note "Processing first pod declaration in file { $.pod-file.path }" if $.debug;
        }
        $.config( $node.config );
        my $template = $node.config<template> // 'pod';
        my $name-space = $node.config<name-space> // $template;
        my $data = $_ with %!plugin-data{ $name-space };

        $.completion($in-level, $template, %(
            :$name,
            "$name-space" => $data,
            :config( $.config ),
            :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }),
            :tail($.completion( 0, 'zero', %(), :$defn ))
            ), :$defn
        )
    }

    # special case HTML for Pod::To::HTML compatibility
    multi method handle(Pod::Block::Named $node where $node.name ~~ /:i 'html' / , Int $in-level,
                        Context $context = None, Bool :$defn = False, --> Str) {
        $.completion($in-level, 'zero', %(), :$defn )
            ~ $.completion($in-level, 'raw', %( :contents([~] gather for $node.contents { take self.handle($_,
                $in-level, HTML, :$defn) }), $node.config
            ), :$defn
        )
    }

    # TITLE, SUBTITLE, META blocks are not included in Body
    multi method handle(Pod::Block::Named $node where .name eq 'TITLE', Int $in-level,
                        Context $context, Bool :$defn = False, --> Str) {
        $.pod-file.title = recurse-until-str($node);
        $.pod-file.title-target = $.pod-file.top = $.register-toc(:1level, :text($.pod-file.title), :is-title);
        $.completion($in-level, 'zero', %($node.config), :$defn )
        # if a list before TITLE this will be needed
    }

    multi method handle(Pod::Block::Named $node where .name eq 'SUBTITLE', Int $in-level,
                        Context $context, Bool :$defn = False, --> Str) {
        $.pod-file.subtitle = [~] gather for $node.contents { take self.handle($_, 0, None, :$defn) };
        $.completion(0, 'zero', %($node.config), :$defn )
        # we can't guarantee SUBTITLE will be after TITLE
    }

    # Semantic blocks other than above treat as head1
    multi method handle(Pod::Block::Named $node where .name ~~ / ^ <upper>+ $ /,
                        Int $in-level, Context $context, Bool :$defn = False, --> Str) {
        my $retained-list = $.completion($in-level, 'zero', %(), :$defn);
        # process before contents
        my $level;
        my Bool $toc;
        with $node.config<headlevel> {
            $level = abs($_);
            $toc = $level != 0;
        }
        else {
            with $node.config<toc> {
                $toc = $_;
                $level = 0 unless $toc;
            }
            else {
                $toc = True;
                $level = 1;
            }
        }
        $toc = ! $_ with $node.config<hidden>;
        $toc = False if $node.name ~~ any(<VERSION DESCRIPTION AUTHOR SUMMARY>);
        my $caption = $node.config<caption> // $node.name;
        # possibilities: :template or :name-space given in metadata
        # or SEMANTIC (viz. node.name) template in template hash
        my $semantic = $node.name if $.tmpl{ $node.name }:exists; # if doesn't exist then Any
        my $template = $node.config<template> // $semantic;
        my $name-space = $node.config<name-space> // $template // $node.name;
        my $data = $_ with %!plugin-data{ $name-space };
        my $target = $.register-toc( :$level, :text($caption), :$toc, :unique );
        my $contents = trim( [~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) } );
        $contents ~= $.completion($in-level, 'zero', %(), :$defn );
        my $raw-contents = trim( [~] gather for $node.contents { take self.handle($_, $in-level, Context::Raw, :$defn) } );
        $raw-contents ~= $.completion($in-level, 'zero', %(), :$defn );
        my $rendered;
        with $template { # only defined if there is block name template, or template given
            $rendered = $.completion($in-level, $template, {
                :$level,
                :text($caption),
                :$target,
                :top($.pod-file.top),
                $name-space => $data,
                $node.config,
                :config(self.config),
                :$context,
                :$contents,
                :$raw-contents,
                }, :$defn
            )
        }
        else {
            $rendered = $.completion($in-level, 'heading', {
                :$level,
                :text($caption),
                :$target,
                :top($.pod-file.top),
                $name-space => $data,
                $node.config,
                :config(self.config),
                :$context,
                }, :$defn
            ) ~ $contents
        }
        $.register-meta(:name($node.name), :value($rendered), :$caption, :$level );
        if $node.config<hidden> or $node.name ~~ any(<VERSION DESCRIPTION AUTHOR SUMMARY>) {
            $rendered = ''
        }
        $retained-list ~ $rendered
    }

    multi method handle(Pod::Block::Named $node where .name.lc eq 'raw', Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        $.completion($in-level, 'zero', %(), :$defn )
            ~ $.completion($in-level, 'raw',
            %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }),$node.config)
            , :$defn
        )
    }

    multi method handle(Pod::Block::Named $node where .name ~~ any( ( @.custom , <para Para nested Nested> ).flat ),
                        Int $in-level,
                        Context $context = None,
                        Bool :$defn = False,  --> Str) {
        my $level;
        my Bool $toc;
        with $node.config<headlevel> {
            $level = abs($_);
            $toc = $level != 0;
        }
        else {
            with $node.config<toc> {
                $toc = $_;
                $level = 0 unless $toc;
            }
            else {
                $toc = $node.name ne any(<para Para nested Nested>);
                $level = 1;
            }
        }
        my $target = '';
        my $caption = $node.config<caption> // recurse-until-str($node).tclc;
        $target = $.register-toc(:$level, :text($caption), :$toc);
        my $template = $node.config<template> // $node.name.lc;
        my $name-space = $node.config<name-space> // $template // $node.name.lc;
        my $data = $_ with %!plugin-data{ $name-space };
        my $unrendered-list = $.completion($in-level, 'zero', %(), :$defn );
        my $contents = [~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }
        $contents ~= $.completion($in-level, 'zero', %(), :$defn );
        my $raw-contents = [~] gather for $node.contents { take self.handle($_, $in-level, Raw, :$defn ) }
        $raw-contents ~= $.completion($in-level, 'zero', %(), :$defn );
        $unrendered-list ~ $.completion($in-level, $template, %(
                :$contents,
                $node.config,
                :$target,
                :$raw-contents,
                $name-space => $data,
                :config(self.config),
            ), :$defn
        )
    }

    multi method handle(Pod::Block::Para $node, Int $in-level, Context $context where *== Preformatted, Bool :$defn = False, --> Str) {
        $.completion($in-level, 'zero', %(), :$defn )
            ~ $.completion($in-level, 'raw',
            %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }),
               $node.config, :config(self.config),)
                , :$defn)

    }

    multi method handle(Pod::Block::Para $node, Int $in-level, Context $context, Bool :$defn = False,  --> Str) {
        note "Defn flag is $defn and context is $context" if $.verbose;
        $.completion($in-level, 'zero', %(), :$defn )
            ~ $.completion($in-level, ($defn || $context !~~ None ) ?? 'raw' !! 'para' ,
            %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context) }),
               $node.config, :config(self.config), )
            , :$defn)
    }

    multi method handle(Pod::Block::Table $node, Int $in-level, Context $context, Bool :$defn = False, --> Str) {
        my $template = $node.config<template> // 'table';
        my @headers = gather for $node.headers { take self.handle($_, $in-level, $context) };
        $.completion($in-level, 'zero', %(), :$defn)
            ~ $.completion($in-level, $template, %(
                :caption($node.caption ?? $.handle($node.caption, $in-level, $context) !! ''),
                :headers(+@headers ?? %( :cells(@headers)) !! Nil),
                :rows([gather for $node.contents -> @r {
                    take %( :cells([gather for @r { take $.handle($_, $in-level, $context, :$defn) }]))
                }]),
                $node.config,
                :config(self.config),
                :$context,
            ),
            :$defn
        )
    }
    # RakuDoc makes row/column directives, but POD6 thinks they are blocks, so metadata are in contents
    sub grid-directive-config( $instruction --> Hash ) {
        my %opts;
        for <label header align> -> $k {
                %opts{ $k } = $_ with $instruction.config{ $k };
            }
        return %opts if $instruction.name eq 'cell';
        my $contents = recurse-until-str( $instruction );
        my $parsed = $contents ~~ /
            ^ \s*
            [ \: $<option> = ($<name> = ( 'label' | 'header' | 'align' )
                [
                \< ~ \>
                    [ $<args>= ( 'middle' | 'top' | 'left' | 'right' | 'center' | 'centre' | 'top' | 'bottom' )]+ % \s+
                ]? )
            \s* ] +
            $
        /;
        if $parsed {
            for $parsed<option>.list {
                if .<args> {
                    %opts{ .<name>.Str } = ( .<args>>>.Str.list )
                }
                else { %opts{ .<name>.Str } = True }
            }
        }
        %opts
    }
    #| handler for procedural table semantics, table is a 2D semi-infinite grid
    multi method handle(Pod::Block::Named $node where .name ~~ / ^ 'table' $/, Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        #| config for whole table, may include caption, toc, etc.
        my %table-config = $node.config;
        my $level;
        my Bool $toc;
        with %table-config<headlevel> {
            $level = abs($_);
            $toc = $level != 0;
        }
        else {
            with %table-config<toc> {
                $toc = $_;
                $level = 0 unless $toc;
            }
            else {
                $toc = True;
                $level = 1;
            }
        }
        my $target = '';
        my $caption = %table-config<caption> // 'Table';
        $target = $.register-toc(:$level, :text($caption), :$toc);
        my $template = %table-config<template> // 'table';
        my $name-space = %table-config<name-space> // $template;
        my $data = $_ with %!plugin-data{ $name-space };

        # grid traversing algorithm due to Damian Conway
        # Initially empty grid...
        my @grid;
        # How to locate the next empty cell...
        my \find_next_empty = {
            ACROSS => sub (:%at is copy) {
                # Search leftwards for first empty cell...
                repeat { %at<col>++ } until !defined @grid[%at<row>][%at<col>];
                return %at;
            },
            DOWN => sub (:%at is copy) {
                # Search downwards for first empty cell...
                repeat { %at<row>++ } until !defined @grid[%at<row>][%at<col>];
                return %at;
            },
            ROW => sub (:%at is copy) {
                # Search downwards for first row with an empty cell to the right...
                # (Note: starts by searching current row before moving down)
                for %at<row> ..* -> $row {
                    for 0 ..^ %at<col> -> $col {
                        return { :$row, :$col } if !defined @grid[$row][$col];
                    }
                }
            },
            COLUMN => sub (:%at is copy) {
                # Search rightwards for first column with an empty cell above...
                # (Note: starts by searching current column before moving left)
                for %at<col> ..* -> $col {
                    for 0 ..^ %at<row> -> $row {
                        return { :$row, :$col } if !defined @grid[$row][$col];
                    }
                }
            },
        }
        # parse row and column directive contents, should be in node.config
        my %POS = :row(0), :col(0);
        my $DIR = 'ACROSS';
        # Track previous action at each step...
        my $prev-was-cell = False; # because we are in grid
        my @cell-context = ( %(), ); # cell context can be set at grid, row, column, or cell level
        # span type only set at cell level
        for <label header align> -> $k {
            @cell-context[*-1]{ $k } = $_ with %table-config{ $k };
        }
        for $node.contents -> $grid-instruction {
            next if $grid-instruction ~~ Pod::Block::Comment;
            X::ProcessedPod::Table::BadCommand.new( :cmd( $grid-instruction.Str ) ).throw
                unless $grid-instruction.^can('name');
            given $grid-instruction.name {
                when 'cell' {
                    my %payload = %( |@cell-context[*-1], |grid-directive-config( $grid-instruction ) );
                    %payload<data> = trim([~] gather
                        for $grid-instruction.contents { take $.handle($_, $in-level, $context, :$defn) }
                    );
                    my $span;
                    $span = $_ with $grid-instruction.config<span>;
                    with $grid-instruction.config<column-span> {
                        $span[0] = $_;
                        $span[1] //= 1
                    }
                    with $grid-instruction.config<row-span> {
                        $span[0] //= 1;
                        $span[1] = $_
                    }
                    %payload<span> = $span if $span;
                    # Fill current cell with payload...
                    @grid[%POS<row>][%POS<col>] = %payload;
                    # Reserve the full span of cells specified...
                    if $span {
                        for 0 ..^ $span[0] -> $extra-col {
                            for 0 ..^ $span[1] -> $extra-row {
                                @grid[%POS<row> + $extra-row][%POS<col> + $extra-col]
                                        //= %( :no-cell, );
                            }
                        }
                    }
                    # Find next empty cell in the fill direction...
                    %POS = find_next_empty{$DIR}(at => %POS);
                }
                when 'row' {
                    @cell-context.pop if @cell-context.elems > 1;  # this is only false if the first row/column after =table
                    # Check the contents for metadata
                    @cell-context.push: %( |@cell-context[0], |grid-directive-config( $grid-instruction ) );
                    # Start filling across the new row...
                    $DIR = 'ACROSS';
                    # Find the new fill position...
                    if $prev-was-cell {
                        %POS = find_next_empty<ROW>(at => %POS);
                    }
                }
                when 'column' {
                    @cell-context.pop if @cell-context.elems > 1;  # this is only false if the first row/column after =table
                    # Check the contents for metadata
                    @cell-context.push: %( |@cell-context[0], |grid-directive-config( $grid-instruction ) );

                    # Start filling down the new column...
                    $DIR = 'DOWN';
                    # Find the new fill position...
                    if $prev-was-cell {
                        %POS = find_next_empty<COLUMN>(at => %POS);
                    }
                }
                default { # only =cell =row =column allowed after a =grid
                    X::ProcessedPod::Table::BadCommand.new( :cmd( $_ ) ).throw
                }
            }
            # Update previous action...
            $prev-was-cell = $grid-instruction.name eq 'cell';
        };
        $.completion($in-level, $template, %(
            $name-space => $data,
            :config(self.config),
            :@grid,
            :procedural,
            :$target,
            :$caption,
            ), :$defn
        )
    }

    multi method handle(Pod::Defn $node, Int $in-level, Context $context --> Str) {
        $.completion($in-level, 'zero', %(), :defn($!in-defn-list) )
            ~ $.completion($in-level, 'defn',
                %( :term($node.term),
                    %( :contents([~] gather for $node.contents {
                        take self.handle($_, $in-level, :defn, $context)
                    })),
                   $node.config,
                   :config(self.config),
                   :$context,
                ),
                :defn
            )
    }

    multi method handle(Pod::Heading $node, Int $in-level, Context $context, Bool :$defn = False, --> Str) {
        my $retained-list = $.completion($in-level, 'zero', %(), :$defn);
        # process before contents
        my $level = $node.level;
        my $template = $node.config<template> // 'heading';
        my $name-space = $node.config<name-space> // $template;
        my $data = $_ with %!plugin-data{ $name-space };
        my $target = $.register-toc(:$level, :text( recurse-until-str($node).join.trim ), :unique);
        # must register toc before processing content!!
        my $text = trim([~] gather for $node.contents { take $.handle($_, $in-level, Heading, :$defn) });
        $retained-list ~ $.completion($in-level, $template, {
            :$level,
            :$text,
            :$target,
            :top($.pod-file.top),
            $name-space => $data,
            $node.config,
            :config(self.config),
            :$context,
            }, :$defn
        )
    }

    multi method handle(Pod::Item $node, Int $in-level is copy, Context $context, Bool :$defn = False, --> Str) {
        my $level = $node.level - 1;
        while $level < $in-level {
            --$in-level;
            $.itemlist[$in-level] ~= $.rendition('list', %( :items($.itemlist.pop), :config(self.config),))
        }
        while $level >= $in-level {
            $.itemlist[$in-level] = [] unless $.itemlist[$in-level]:exists;
            ++$in-level
        }
        $.itemlist[$in-level - 1].push: $.rendition('item',
                %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context) }),
                   $node.config, :config(self.config), :$context, )
                );
        return ''
        # explicitly return an empty string because callers expecting a Str

    }

    multi method handle(Pod::Raw $node, Int $in-level, Context $context = None, Bool :$defn = False, --> Str) {
        $.completion($in-level, 'zero', %(), :$defn )
                ~ $.rendition('raw',
                %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, Context::Raw, :$defn) }),
                   $node.config, :config(self.config), :$context,
                ), :$defn
        )
    }

    multi method handle(Pod::Config $node, Int $in-level, Context $context = None, Bool :$defn = False, --> Str) {
        $.config( $node.type => $node.config, :block-scope );
        $.completion($in-level, 'zero', %(), :$defn )
    }
    multi method handle(Pod::FormattingCode $node where .type ~~ any( <B C I K T U> ), Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        my $contents = [~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) };
        my $meta = @($node.meta) // []; # by default an empty array
        $.completion($in-level, 'format-' ~ $node.type.lc ,
                %( :$contents, :$meta, :config(self.config), :$context, ), :$defn
            )
    }
    multi method handle(Pod::FormattingCode $node where .type ~~ none(<E Z X N L P V B C I K T U>), Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        my $contents;
        my $meta = @($node.meta) // []; # by default an empty array
        my $rv;
        # if contents is always a sequence. if it contains embedded PodBlocks,
        # then there will be more than one element.
        if +$node.contents > 1 {
            $rv = FC.parse( $node.contents[*-1]);
            if $rv<metas><meta> {
                $meta.append($rv<metas><meta>».Str);
                $contents = [~] gather for $node.contents[^ (*-1)] { take self.handle($_, $in-level, $context, :$defn) };
                $contents ~= self.handle(~$rv<head>, $in-level, $context, :$defn) if ~$rv<head>;
            }
            else {
                $contents = [~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }
            }
        }
        else {
            $contents = ''; # guarantee at least an empty string
            if $node.contents[0] {
                $rv = FC.parse( $node.contents[0] );
                $meta.append($rv<metas><meta>».Str) if $rv<metas><meta>;
                $contents = self.handle(~$rv<head>, $in-level, $context, :$defn);
            }
        }
        if %.tmpl{ 'format-' ~ $node.type.lc }:exists {
            $.completion($in-level, 'format-' ~ $node.type.lc ,
                %( :$contents, :$meta, :config(self.config), :$context,  ), :$defn
            )
        }
        else {
            $.completion($in-level, 'unknown-name',
                %( :$contents, :$meta, :format-code($node.type), :$context,
                ), :$defn
            )
        }
    }
    # footnotes depends on raw-contents being rendered after rendered contents
    multi method handle(Pod::FormattingCode $node where .type eq 'N', Int $in-level, Context $context = None, Bool :$defn = False, --> Str) {
        my $text = [~] gather for $node.contents { take $.handle($_, $in-level, $context, :$defn) };
        my %params;
        if $context ~~ Context::Raw {
            %params = $!pod-file.raw-footnotes[*-1]
        }
        else {
            %params = $.register-footnote(:$text, :$context )
        }
        $.completion($in-level, 'format-n', %params, :$defn)
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'E', Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        $.completion($in-level, 'raw', %( :contents([~] $node.meta.map({
            when Int { "&#$_;" };
            when Str { "&$_;" };
            $_
        })), :config(self.config), :$context ),  :$defn)
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'Z', Int $in-level, $context = None, Bool :$defn = False,  --> Str) {
        $.completion($in-level, 'zero',
                %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }),
                 :config(self.config), :$context,
                ), :$defn)
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'X', Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        my Bool $header = $context ~~ Heading;
        my $text = [~] gather for $node.contents { take $.handle($_, $in-level, $context, :$defn) };
        return ' ' unless $text or +$node.meta;
        # ignore if there is nothing that can be an entry
        my $target = $.register-glossary($text, $node.meta, $header);
        #s/recurse-until-str($node).join /$text/
        $.completion($in-level, 'format-x', %( :$text, :$target, :$header, :$context,  :meta($node.meta):config(self.config),), :$defn)
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'L', Int $in-level,
                        Context $context = None, Bool :$defn = False,  --> Str) {
        my $contents = [~] gather for $node.contents { take $.handle($_, $in-level, $context) };
        my ($target, $type, $place, $link-label) = $.register-link($node.meta eqv [] | [""] ?? $contents !! $node.meta[0], $contents);
        # link handling needed here to deal with local links in global-link context
        $.completion($in-level, 'format-l',
            %( :$target,
               :$link-label,
               :$type,
               :$place,
               :config(self.config),
               :meta( $node.meta ),
               :$context,
            ), :$defn
        )
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'V', Int $in-level,
                        Context $context = None, Bool :$defn = False, --> Str) {
        $.completion($in-level, 'escaped',
            %( :contents([~] gather for $node.contents { take self.handle($_, $in-level, $context, :$defn) }),
             :config(self.config), :$context,
            ), :$defn
        )
    }

    multi method handle(Pod::FormattingCode $node where .type eq 'P', Int $in-level,
                        Context $context = None, Bool :$defn = False, --> Str) {
        my Str $link-contents = recurse-until-str($node);
        my $link = ($node.meta eqv [] | [""] ?? $link-contents !! $node.meta).Str.trim;
        my $schema = '';
        my $uri = '';
        if $link ~~ / ^ $<sch> = (\w+) ':' \s* $<uri> = (.*) $ / {
            $schema = $<sch>.Str;
            $uri = $<uri>.Str
        }
        my Str $contents;
        my Bool $as-pre = True;
        my Bool $html = False;
        my $target;
        given $schema {
            when 'toc' {
                $contents = "See: $link-contents"
            }
            when 'index' {
                $contents = "See: $link-contents"
            }
            when 'semantic' {
                $as-pre = False;
                my $caption;
                my $level;
                $.pod-file.raw-metadata
                        .grep({ .<name> ~~ $uri })
                        .map({
                            $contents ~= .<value> ;
                            $caption = .<caption> without $caption;
                            $level = .<level> without $level;
                        });
                without $contents {
                    $contents = "See: $link-contents";
                    $as-pre = True;
                }
                $caption = $uri without $caption;
                $level = 1 without $level;
                $target = $.register-toc(:$level, :text($caption), :toc, :unique );
            }
            when 'http' | 'https' {
                my LibCurl::Easy $curl;
                $curl .= new(:URL($link), :followlocation, :failonerror );
                try {
                    $curl.perform;
                    $contents = $curl.perform.content;
                    CATCH {
                        when X::LibCurl {
                            $contents = "Link ｢$link｣ caused LibCurl Exception, response code ｢{ $curl.response-code }｣ with error ｢{ $curl.error }｣"
                            }
                        default {
                            $contents = "Link ｢$link｣ caused LibCurl Exception, response code ｢{ $curl.response-code }｣ with error ｢{ $curl.error }｣"
                        }
                    }
                }
            }
            when 'file' | '' {
                my URI $uri .= new($link);
                if $uri.path.Str.IO ~~ :e & :f {
                    $contents = $uri.path.Str.IO.slurp;
                }
                else {
                    $contents = "See: $link-contents";
                    note "No file found at ｢$link｣" if $.debug;
                }
            }
            default {
                $contents = "See: $link-contents"
            }
        }
        $html = so $contents ~~ / '<html' .+ '</html>'/;
        $contents = ~$/ if $html;
        # eliminate any chars outside the <html> container if there is one
        $.completion($in-level, 'format-p', %(
            :$contents,
            :$html,
            :config(self.config),
            :meta( $node.meta ),
            :$context,
            :$as-pre,
            :$target,
        ), :$defn)
    }
}


