summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/hedgedoc2quarto16
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/hedgedoc2quarto b/bin/hedgedoc2quarto
index 21f8158..1aac608 100755
--- a/bin/hedgedoc2quarto
+++ b/bin/hedgedoc2quarto
@@ -35,9 +35,11 @@ die 'Too many arguments: expected INFILE and OUTFILE' if $bogus;
@ARGV = ($infile) if $infile;
my $content = <>;
-$content =~ s/^(?'fence'[``~]{3,})\s*\Kmermaid\n(?'type'gantt)\n(?'code'.*?\n)\k'fence'$/{mermaid}\n%%| fig-width: 100%\n$+{type}\n$+{code}$+{fence}/gsm;
-
-$content =~ s/^gantt\K$/\ntickInterval 1month/gm;
+$content =~ s/^(?'fence'[``~]{3,})\s*\Kmermaid\n(?'type'gantt)\n(?'code'.*?\n)\k'fence'$/
+ "{mermaid}\n\%\%| fig-width: 100\%\n"
+ . &mmd2mmd( $+{type}, $+{code} )
+ . $+{fence}
+ /gsme;
if ($outfile) {
open(FH, '>', $outfile) or die $!;
@@ -46,6 +48,14 @@ if ($outfile) {
print $content;
}
+sub mmd2mmd( $type, $code ) {
+ if ( $type eq 'gantt' ) {
+ $code = "tickInterval 1month\n$code";
+ }
+
+ return "$type\n$code";
+}
+
=encoding UTF-8
=head1 AUTHOR