diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-03-31 10:41:10 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-03-31 10:48:07 +0200 |
commit | 5e6044738cbc0627209bc5f8a82ce2a5d6687b8e (patch) | |
tree | 2c0fa1f2fb8205980ca64eabf64add5eca6c18f9 /bin | |
parent | a36907e4a46b6dedda2e3df708ae79a6b9f348e7 (diff) |
tidy script hedgedoc2quarto
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hedgedoc2quarto | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/hedgedoc2quarto b/bin/hedgedoc2quarto index 1aac608..23832ea 100755 --- a/bin/hedgedoc2quarto +++ b/bin/hedgedoc2quarto @@ -35,20 +35,23 @@ 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'$/ +$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 $!; + open( FH, '>', $outfile ) or die $!; print FH $content; -} else { +} +else { print $content; } -sub mmd2mmd( $type, $code ) { +sub mmd2mmd ( $type, $code ) +{ if ( $type eq 'gantt' ) { $code = "tickInterval 1month\n$code"; } |