]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
added more shortif test cases for attributes.
authorWill Budic <redacted>
Wed, 9 Apr 2025 05:08:16 +0000 (15:08 +1000)
committerWill Budic <redacted>
Wed, 9 Apr 2025 05:08:16 +0000 (15:08 +1000)
system/modules/MarkdownPlugin.pm
system/modules/PluginBase.pm
tests/testCNFNodeShortiefs.pl

index f37c8e2a44500146990804443c6abd242cff2fd6..562c2a454d92f81b5638fc1d3b352b11b468650a 100644 (file)
@@ -105,6 +105,7 @@ sub toHTML_headings($self,$hdrs) {
     my @headings = @$hdrs;
     my $bf;
     my $level = 0;    
+    my $top = ' style="padding-top: 1rem"';
     for my $i(0..$#headings){
         my @spec = @{$headings[$i]};
         my $cnt  = $i+1;
@@ -112,9 +113,9 @@ sub toHTML_headings($self,$hdrs) {
         my $lnk  = "<a href=\"#$cnt\">".$spec[0]."</a>";
         if($lvl!=$level){
            if($lvl>$level){
-           $bf .= "<ul>";
+              if($top){$bf .= "<ul$top>"; undef $top}else{$bf .= "<ul>"};
            }else{
-            $bf .= "</ul>";
+              $bf .= "</ul>";
            }
            $level = $lvl;
         }
@@ -801,9 +802,9 @@ div .cnf {
        padding: 2px;
 }
 .Q {
-       color: #b217ea;
+       color:#B217EA;
        font-weight: bold;
-}
+} 
 .pa {
        color: rgb(52, 52, 130);
        font-weight: bold;
index 00f1836a8af36a0857c0a891c12d1de41285acfd..0a74e2a69f32b698f6d2bdcc25dfe6ac4ba24f84 100644 (file)
@@ -1,7 +1,7 @@
 package PluginBase;
 use v5.36;
 use strict;
-use warnings;
+use warnings; no warnings qw(experimental::signatures);
 use Syntax::Keyword::Try;
 use feature qw(signatures);
 use Scalar::Util qw(looks_like_number);
index 028231086247aedc63e31345d7d2b6f81a6b8909..a2cf49e4f8aff9a8207d3aac78a1570a6b6125d5 100644 (file)
@@ -43,20 +43,50 @@ Giving no advice.
 ),$a_sub->val());
 
 
-    my $parse_listed = CNFParser-> new() -> parse(undef,q(<<<TREE __IN_SHORTIFE__ 
+    my $parse_listed = CNFParser-> new(undef,{ANONS_ARE_PUBLIC=>0}) -> parse(undef,q(<<<TREE __IN_SHORTIFE__ 
                                                                 listed _____\
                                                                         @@ __\
                                                                                 1 2 3
                                                                         __/
-
                                                                         @@ __\
                                                                         2 
                                                                         __/
                                                                 __/
     >>>));
     $test->isDefined("CNF sequential anon format 'listed' is it defined?",$parse_listed->anon('listed'));
-    $parse_listed = $parse_listed->anon('listed');
-    $test->evaluate("CNF sequential anon format 'listed' has two itens?",2,scalar(@{$parse_listed->list()}));
+    my $prp_listed = $parse_listed->anon('listed');
+    $test->evaluate("CNF sequential anon format 'listed' has two itens?",2,scalar(@{$prp_listed->list()}));
+    $test->subcase("Check CNF sequential anon format 'listed' values.");
+    my @listed = @{$prp_listed->list()};
+    $test->evaluate("listed[0] == '123'", '1 2 3', $listed[0]->val());
+    $test->evaluate("listed[0] == '2'", '2', $listed[1]->val());
+
+    $test->subcase("Test with attributes CNF sequential anon format 'listed'");
+    my $parse_listed2 = CNFParser-> new(undef,{ANONS_ARE_PUBLIC=>0}) -> parse(undef,q(<<<TREE __IN_SHORTIFE__ 
+                                                                listed _____\
+                                                                        @@ __\
+                                                                            a = A
+                                                                            b = B 
+                                                                            __~
+                                                                        __/
+                                                                        @@ __\
+                                                                                1 2 3 
+                                                                        __/
+                                                                        @@ __\
+                                                                            c :C                                                                            
+                                                                            3__~
+                                                                        __/
+                                                                __/
+    >>>));
+    my $prp_listed2 = $parse_listed2->anon('listed');
+    @listed = @{$prp_listed2->list()};
+    $test->evaluate("listed[0]:a == 'A'", 'A', $listed[0]->{'a'});
+    $test->evaluate("listed[0]:b == 'B'", 'B', $listed[0]->{'b'});
+    $test->evaluate("listed[2]:c == 'C'", 'C', $listed[2]->{'c'});
+    $test->evaluate("listed[2] == '3'", '3', $listed[2]->val());
+
+
+
 
 
     $test -> case("Test process shortif directly with CNF sequential anon format.", '2');