--- /dev/null
+# About Life Log
+
+* Life Log is an full database implementation, web journal of categorised logs and events in time.
+* It is meant to be limitless, fully searchable and viewed as mostly desired.
+* Can be used and expanded, as it is also fully configurable.
--- /dev/null
+# L-Tags
+```HTML
+ <<B<{Text To Bold}>>
+
+<<I<{Text To Italic}>>
+
+<<TITLE<{Title Text}>>
+
+<<LIST<{List of items delimited by new line to terminate item or with '~' otherwise.}>
+
+<<IMG<{url to image}>>
+
+<<FRM<{file name}_frm.png}>>
+```HTML
+
+*_frm.png images file pairs are located in the ./images folder of the cgi-bin directory.
+These are manually resized by the user. Next to the original. Otherwise considered as stand alone icons. *_frm.png Image resized to -> width="210" height="120"
+Example:
+```
+
+ ../cgi-bin/images/
+ my_cat_simon_frm.png
+ my_cat_simon.jpg
+
+ For log entry, place:
+
+ <<FRM>my_cat_simon_frm.png> <<TITLE<Simon The Cat>>
+ This is my pet, can you hold him for a week while I am on holiday?
+```
+
+```HTML
+<<LNK<{url to image}>>
+```HTML
+Explicitly tag an URL in the log entry. Required if using in log IMG or FRM tags. Otherwise link appears as plain text.
\ No newline at end of file
use Text::Markdown 'markdown';
my $cgi = CGI->new;
+my $dir = $cgi->param('dir');
+ #$dir = './htdocs/cgi-bin/docs' if(!$dir);
+ $dir = './docs' if(!$dir);
my $file = $cgi->param('file');
- $file = qq(../../Current Development Check List.md) if(!$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);
+if($file && -f "$dir/$file"){
+ open my $fh, '<', "$dir/$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;
+}
+elsif(-d "$dir"){ #List and return markup files found in dir, comma separated.
+ opendir(DIR, $dir) or die $!;
+ my @lst = ();
+ while ($file = readdir(DIR)) {
+ next if ($file =~ m/^\./) || ($file =~ m/!\.md$/);
+ next if (-d "$dir/$file");
+ push @lst, $file;
+ }
+ closedir(DIR);
+ print $cgi->header, join (',', map { chomp; qq("$_") } sort @lst);
+}else{
+ die "Directory [$dir] not valid!"
+}
+
+
exit;
}
catch{