]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Started work on markdown implementation.
authorWill Budicm <redacted>
Sun, 13 Sep 2020 09:51:50 +0000 (19:51 +1000)
committerWill Budicm <redacted>
Sun, 13 Sep 2020 09:51:50 +0000 (19:51 +1000)
Current Development Check List.md
Installation.txt
htdocs/cgi-bin/main.cgi
htdocs/cgi-bin/markdown.cgi [new file with mode: 0755]
htdocs/cgi-bin/stats.cgi

index 764a7f64c9ac89527fba777ceacec41f50c31128..032f09e9588426d5a6bdc4522b6ce6e2f6b46bd5 100644 (file)
@@ -10,6 +10,8 @@
 * Earth stage requires same SQL related code to work on at least one more DBMS type other than SQLight.
   * PostgreSQL is most likelly candidate as MySQL is not easy to install for the average user.
   * Developing and adopting to MySQL or any other system is not prerogative, as it works well as it is with inbuild simplicity.
+* Provide markdown text functionality to html pages. For quick vanila plain documentation.
+* &#10004; Implement title bolding on logs using markdown, so tags can be avoided, for multiline logs.
 
 ### v.2.0 SUN RC2 Encountered
 
index 21c3972d0fb160cec1bbeafe4bf7368fc938a280..530dbf1835cf71096ccced151b541b9ca37095aa 100644 (file)
@@ -132,6 +132,7 @@ sudo cpan JSON;
 sudo cpan Switch;
 sudo cpan IPC::Run
 sudo cpan Syntax::Keyword::Try;
+sudo cpan Text::Markdown
 
 #Install DBI module
 sudo cpan DBI;
index 182590b25c2b3039050e876e2830c477b17ef5f2..66825bec9ee19a81e001c9f56693faf455ec3bce 100755 (executable)
@@ -605,10 +605,13 @@ sub buildLog {
             $log =~ s/<<LIST<(\w*|\s*)*.*(>+?)/$sub/o;
             $tagged = 1;
         }
-
+        #bold on start markup
+        $log =~ s/(^\*)(.*)(\*)(\\n)/<b>\2<\/b><br>/oi;
         #Decode escaped \\n
         $log =~ s/\r\n/<br>/gs;
         $log =~ s/\\n/<br>/gs;
+        
+        
 
         if ( $CID_EVENT == $row[1] ) {
             $log = "<font color='#eb4848' style='font-weight:bold'>$log</font>";
diff --git a/htdocs/cgi-bin/markdown.cgi b/htdocs/cgi-bin/markdown.cgi
new file mode 100755 (executable)
index 0000000..88f542f
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+# Programed by: Will Budic
+# Open Source License -> https://choosealicense.com/licenses/isc/
+#
+use strict;
+use warnings;
+
+use Syntax::Keyword::Try;
+use DateTime;
+use CGI;
+use Text::Markdown 'markdown';
+
+my $cgi = CGI->new;
+my $file = $cgi->param('file');
+   $file = qq(../../Current Development Check List.md) if(!$file);
+
+try{
+
+open my $fh, '<', $file or die "Can't open file $!";
+read $fh, my $file_content, -s $fh;
+my $html = markdown($file_content);
+    print $cgi->header, "<DIV style='padding:10px'>\n$html\n</DIV>", $cgi->end_html;
+exit;
+}
+catch{
+    my $err = $@;
+    print $cgi->header,
+            "<font color=red><b>SERVER ERROR</b></font> on ".DateTime->now."<pre> $err\n$file</pre>";
+    print $cgi->end_html;
+}
\ No newline at end of file
index 8c041b59e5c1d0a391fa909abb4a4443e5d9f7d5..094a6593efd06bd20c37663965db2ef94a4a75f8 100755 (executable)
@@ -7,7 +7,7 @@ use warnings;
 #no warnings 'uninitialized';
 use Switch;
 
-use CGI::Pretty ":standard";
+#use CGI::Pretty ":standard";
 use CGI::Session '-ip_match';
 use DBI;
 use DateTime;