|
@@ -20,6 +20,19 @@ sub link_line($) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+sub strike_line($) {
|
|
|
+
|
|
|
+ my $line = shift;
|
|
|
+ #if ( $line =~ m/~~(.*)~~/ ) {
|
|
|
+ if ( $line =~ m/^(.*)~~(.*)~~(.*)/ ) {
|
|
|
+ $line = "$1<s>$2</s>$3";
|
|
|
+ return $line;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $line;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
# README content is passed in as a var, sub returned an HTML version of the parsed markdown
|
|
|
sub render_readme($$) {
|
|
|
|
|
@@ -33,6 +46,10 @@ sub render_readme($$) {
|
|
|
# Main parsing logic, doing it line by line
|
|
|
# I have some ideas on how to make this more robust/efficient,
|
|
|
# but starting with below for POC
|
|
|
+ # TODO:
|
|
|
+ # Headers parsing can be one concise subroutine
|
|
|
+ # Started building a suite of simple subs to handle everything else,
|
|
|
+ # each line should be run through the 'sub suite' to handle all parsing
|
|
|
my @readme_lines = split("\n", $readme_content);
|
|
|
my $inside_code = 0;
|
|
|
foreach my $line ( @readme_lines ) {
|
|
@@ -78,7 +95,8 @@ sub render_readme($$) {
|
|
|
}
|
|
|
print $fh "$parsed_line";
|
|
|
} elsif ( $line =~ m/^\*(.*)/ && $inside_code == 0) {
|
|
|
- $line = link_line($1);
|
|
|
+ $line = strike_line($1);
|
|
|
+ $line = link_line($line);
|
|
|
my $parsed_line = "<ul><li>$line</li></ul>";
|
|
|
print $fh "$parsed_line";
|
|
|
} elsif ( $line =~ m/^```$/ ) {
|
|
@@ -94,7 +112,7 @@ sub render_readme($$) {
|
|
|
$line = link_line($line);
|
|
|
print $fh "$line<br>";
|
|
|
} elsif ( $line =~ m/^~~(.*)~~/ ) {
|
|
|
- $line = "<s>$1</s>";
|
|
|
+ $line = strike_line($line);
|
|
|
print $fh "$line<br>";
|
|
|
}
|
|
|
else {
|