From 5e6044738cbc0627209bc5f8a82ce2a5d6687b8e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 31 Mar 2024 10:41:10 +0200 Subject: tidy script hedgedoc2quarto --- bin/hedgedoc2quarto | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bin') 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"; } -- cgit v1.2.3