]> lifelog.hopto.org Git - LifeLog.git/commitdiff
dev.
authorWill Budic <redacted>
Sat, 29 Jul 2023 12:08:53 +0000 (22:08 +1000)
committerWill Budic <redacted>
Sat, 29 Jul 2023 12:08:53 +0000 (22:08 +1000)
htdocs/cgi-bin/docs/PerlCNF/Specifications_For_CNF_ReadMe.md
htdocs/cgi-bin/index.cgi
htdocs/cgi-bin/system/modules/MarkdownPlugin.pm

index 2d63d09072ad8fe2d8074619192eec1e2e9f044a..5360754317e148f915b4f62052ad945928bdd118 100644 (file)
@@ -421,7 +421,7 @@ CNF supports basic SQL Database structure statement generation. This is done via
                     So deeply nesting a large property body is not recommended and also not suitable for encapsulating in there data.
                 3. An opening tag is opened being surrounded with the same signifier into the direction of the property body.
                 4. The closing tag is in the opposite direction same signifiers.
-                    - **[sesame[** I am an open and closed value now, nothing you can do about it (X|H)TML! **]sesame]** 
+                    - **[sesame[** I am an open and closed value now, nothing you can do about it (X|H)TML! **]sesame]**
         3. The node characteristic is that each sub property is linked to its parent property
            1. This is contained in the ' **@** ' attribute.
            2. Node characteristic is also the tree can be searched via path.
@@ -437,9 +437,9 @@ CNF supports basic SQL Database structure statement generation. This is done via
         1. The value of a property is delimited with an [ **#** ] tag as start, end [ **/#** ] as the ending.
             1. Each property's start and end tag must stand and be on its own line, withing the body, except for the value or array attributes.
             2. A value tagged property section is its text and can't contain further nested tree notes.
-                 Invalid: ```[#[<*<link/to/something>*>]#] ```
+                 Invalid: ```[#[<*<link/to/something>*>]#]```
    3. Tree can contain links to other various properties, anons, that means also to other trees then the current one.
-        1. A link (pointer) to an outside anon or property is specified in form of ⇾ ``` [*[ {path/name} ]*] ```.
+        1. A link (pointer) to an outside anon or property is specified in form of ⇾ ```cnf [*[ {path/name} ]*]```.
            1. The link can read only point to:
               - A repository anon or constant value.
               - A tree path value.
@@ -451,25 +451,24 @@ CNF supports basic SQL Database structure statement generation. This is done via
             2. This is currently a TREE instruction only inbuilt option in Perl CNF, for the CNF Nodes individuals scripts order of processing.
         4. Links in the root parent node of the tree are assigned as attributes or unique values. In subroperties they are set as own nodes.
    4. Tree Format Example:
-
-        ```CNF
-        <<APP<My Nice Application by ACME Wolf PTY>>
-
-        <<doc<TREE>
-        <*<APP>*>
-        thread: 28
-        title = My Application
-            <client<
-                address: 192.168.1.64
-                [paths[
-                    [#[
-                        ./dev
-                        ./sources
-                    ]#]
-                ]paths]
-            >client>
-        >>
-        ```
+    ```cnf
+    <<APP<My Nice Application by ACME Wolf PTY>>
+
+    <<doc<TREE>
+    <*<APP>*>
+    thread: 28
+    title = My Application
+        <client<
+            address: 192.168.1.64
+            [paths[
+                [#[
+                    ./dev
+                    ./sources
+                ]#]
+            ]paths]
+        >client>
+    >>
+    ```
 
 ## Sample Perl Language Usage
 
index de3a8dcae833a49df942253c53ba6327cc491d48..d8c475d2bc007358efe510cfb419b0b4e3f2edef 100755 (executable)
@@ -28,8 +28,6 @@ BEGIN {
   set_message(\&handle_errors);
 }
 
-
-
 use lib "system/modules";
 require CNFParser;
 require CNFNode;
@@ -45,9 +43,9 @@ sub HTMLPageBuilderFromCNF {
                             $script_path."index.cnf",{
                              DO_ENABLED => 1, HAS_EXTENSIONS=>1,
                              ANONS_ARE_PUBLIC => 1,
-                                PAGE_HEAD    => "<h1 id=\"index_head\">Index Page of Docs Directory</h1>", 
-                                PAGE_CONTENT => $html, 
-                                PAGE_FOOT    => "<!--Not Defined-->"
+                                PAGE_HEAD     => "<h1 id=\"index_head\">Index Page of Docs Directory</h1>", 
+                                PAGE_CONTENT  => $html, 
+                                PAGE_FOOT     => "<!--Not Defined-->"
                             }
                 );
     my $ptr = $cnf->data();
index 7166cc01558f6509af75f1bd9993f4ca96ad8a5e..b025d9f93fc1bc7547c4f4626a08082d91dd001a 100644 (file)
@@ -175,11 +175,17 @@ try{
             my $pret = ""; $pret = $1 if $1;
             my $post = ""; $post = $4 if $4;
             $tag = 'code'; $tag =$2 if $2;
-            my $inline = $3;  $inline = inlineCNF($inline,"");
+            my $inline = $3; 
+            $inline = inlineCNF($inline,"");
             my @code_tag = @{ setCodeTag($tag, "") };
             $ln = qq($pret<$code_tag[1] class='$code_tag[0]'>$inline</$code_tag[1]>$post\n);
+            undef $tag;
             if(!$pret && !$post){
                 $buff .= $ln; next;
+            }elsif($list_item){
+                my $new = HTMLListItem->new('dt', $ln, $list_item->{spc});
+                $list_item ->add($new);
+                next;
             }
         }
         elsif($ln =~ /^\s*```(\w*)(.*)/){
@@ -189,7 +195,7 @@ try{
                 $class = $code_tag[0];
                 $tag = $code_tag[1] if !$tag;
             }
-            if($code){
+            if($code>0){
                if($para){
                   $bfCode .= "$para\n"
                }
@@ -477,7 +483,13 @@ sub inlineCNF($v,$spc){
  if(!$body){
     $oo=$cc="";  $body=$v;$v=~/^(<+)/;$oo=$1 if$1;
     if($v=~m/\[\#\[/){
-        return "$spc<span ".C_PV.">[#[</span>"
+        my $r = "<span ".C_PV.">[#[</span>";
+           $v =~ s/\[\#\[/$r/g;
+        if($v =~ m/\]\#\]/){
+           $r = "<span ".C_PV.">]#]</span>"; 
+           $v =~ s/\]\#\]/$r/g;
+        }
+        return "$spc$v"
     }
     elsif($v=~m/\]\#\]/){
         return "$spc<span ".C_PV.">]#]</span>"
@@ -502,9 +514,10 @@ sub inlineCNF($v,$spc){
     elsif($v eq '>>'){
         return  "$spc<span ".C_B.">&#62;&#62;</span>\n"  }
     else{
-        $v=~/(>+\s*)$/;if($1){
-        $v = $1; $v =~ s/>/&#62;/g;
-        return "$spc<span ".C_B.">$v</span>"
+        $v=~/(.*)(>+\s*)$/;
+        if(!$1 && $2){
+            $v = $2; $v =~ s/>/&#62;/g;
+            return "$spc<span ".C_B.">$v</span>"           
         }else{
             $oo =~ s/</&#60;/g;
             if($v=~m/>>>/){
@@ -512,15 +525,19 @@ sub inlineCNF($v,$spc){
             }elsif($v=~m/<<<(.*)/){
               return "$spc<span ".C_B.">$oo</span><span ".C_PI.">$1</span>"
             }elsif($v=~m/^(<{2,3})(.*?)([><])(.*)/){
-                if($4){
-                    if($PARSER -> isReservedWord($4)){
-                        $v = "<span ".C_PI.">$4</span>"
+                my $t = "$1$2$3";
+                my $var = $2;
+                my $im = $3;
+                my $r = $4;
+                my $end =$4;
+                if($end){
+                    my $changed = ($end =~ s/(>|<)$//g);
+                    if($PARSER -> isReservedWord($end)){
+                        $v  = "<span ".C_PI.">$end</span>";  $v .= "<span ".C_B.">".($1 eq '<'?"&#60":"&#62")."</span>" if $changed
                     }else{
-                        if (!$2){$v = "<span ".C_PA.">$4</span>"}else{$v=""}
+                        if (!$var){$v = "<span ".C_PA.">$r</span>"}else{$v=""}
                     }
-                    my $t = "$1$2$3";
-                    my $r = $4;
-                    if($2 =~ /[@%]/){
+                    if($var =~ /[@%]/){
                         if($r =~ /(.*)([><])(.*)/){
                             $v  = "$spc<span ".C_B.">$t</span><span ".C_PA.">$1</span>";
                             $v .= "<span ".C_B.">$2</span>";
@@ -528,7 +545,7 @@ sub inlineCNF($v,$spc){
                             return $v;
                         }
                     }else{
-                        $v = "$spc<span ".C_B.">$oo</span><span ".C_PN.">$2</span><span ".C_B.">$3</span>$v";
+                        $v = "$spc<span ".C_B.">$oo</span><span ".C_PN.">$var</span><span ".C_B.">$im</span>$v";
                         if($r =~ /(\w*)\s(.*)/){
                            return "$v<span ".C_PI.">$1</span> <span ".C_PV.">$2</span>$cc"
                         }else{
@@ -545,7 +562,8 @@ sub inlineCNF($v,$spc){
         }
     }
 }
-elsif(!$oo && !$cc){
+
+if(!$oo && !$cc){
 
     $body =~ m/ ^([\[<\#\*\[<]+)  (.*?) ([\]>\#\*\]>]+)$  /gmx;
     if($1&&$2&&$3){
@@ -565,7 +583,7 @@ elsif(!$oo && !$cc){
     $oo =~ s/</&#60;/g;
     $cc =~ s/>/&#62;/g;
 }
-    $body =~ m/ ([@%<])  ([\$@%]?\w+)? ([<>]) (.*) |
+    $body =~ m/ ([@%<]+)  ([\$@%]?\w+)? ([<>]) (.*) |
                 ([^<>]+) ([><])? (.*)
             /gmx;
 
@@ -634,24 +652,25 @@ elsif(!$oo && !$cc){
         $oo =~ s/</&#60;/g;
         $body =~ /(.*)([><])(.*)/;
         if($1 && $2 && $3){
-            $v = "<span ".C_B.">$oo</span><span ".C_PI.">$1</span><span ".C_B.">$2</span><span ".C_PV.">$3</span><span ".C_B.">$cc</span>"
+           $v = "<span ".C_B.">$oo</span><span ".C_PI.">$1</span><span ".C_B.">$2</span><span ".C_PV.">$3</span><span ".C_B.">$cc</span>"
         }else{
-            $v = "<span ".C_B.">$oo</span><span ".C_PI.">$body</span><span ".C_B.">$cc</span>"
+           $v = "<span ".C_B.">$oo</span><span ".C_PI.">$body</span><span ".C_B.">$cc</span>"
         }
-    }
+    }elsif($2){$v = "<span ".C_B.">$v</span>"}
     return $spc.$v.$restIfAny
 }
 
 
 sub propValCNF($v){
-    my @match = ($v =~ m/(.*)([=:])(.*)/gs);
+    my @match = ($v =~ m/([^:]+)([=:]+)(.*)/gs);
     if(@match){
+      return "&nbsp;<span ".C_PI.">$1</span><span ".C_B.">$2</span><span ".C_PI.">$3</span>" if $2 eq '::';
       return "&nbsp;<span ".C_PN.">$1</span><span class='O'>$2</span><span ".C_PV.">$3</span>"
     }
     elsif($v =~ /[><]/){
        return  "<span ".C_B.">$v</span>"
     }else{
-       return "<span ".C_PV.">$v</span>"
+       return "<code ".C_PV.">$v</code>"
     }
     return $v;
 }
@@ -659,9 +678,9 @@ sub propValCNF($v){
 sub style ($script){
     MarkdownPluginException->throw(error=>"Invalid argument passed as script!",show_trace=>1) if !$script;
     #Links <https://duckduckgo.com>
-    $script =~ s/<(http[:\/\w.]*)>/<a href=\"$1\">$1<\/a>/g;
-    $script =~ s/(\*\*([^\*]*)\*\*)/\<em\>$2<\/em\>/gs;
-    if($script =~m/[<\[]\*[<\[](.*)[\]>]\*[\]>]/){#It is a CNF link not part of standard Markup.
+    $script =~    s/<(http[:\/\w.]*)>/<a href=\"$1\">$1<\/a>/g;
+    $script =~    s/(\*\*([^\*]*)\*\*)/\<em\>$2<\/em\>/gs;
+    if($script =~ m/[<\[]\*[<\[](.*)[\]>]\*[\]>]/){#It is a CNF link not part of standard Markup.
        my $link = $1;
        my $find = $PARSER->obtainLink($link);
        $find = $link  if(!$find);