summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2024-03-31 10:57:07 +0200
committerJonas Smedegaard <dr@jones.dk>2024-03-31 11:20:20 +0200
commite9deca930024287572165b95cd280a8009c30b39 (patch)
treeb7e515421dec1c8f11d6d115e14fbfcea9aae9b7 /bin
parent5e6044738cbc0627209bc5f8a82ce2a5d6687b8e (diff)
avoid custom argument in shebang, ignored when executed by explicit interpreter
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hedgedoc2quarto5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/hedgedoc2quarto b/bin/hedgedoc2quarto
index 23832ea..d2aacda 100755
--- a/bin/hedgedoc2quarto
+++ b/bin/hedgedoc2quarto
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -g
+#!/usr/bin/perl
use v5.36;
use strict;
@@ -30,10 +30,11 @@ and they support different subsets of Mermaid diagram code.
=cut
+# slurp INFILE if passed as first argument, or else STDIN
my ( $infile, $outfile, $bogus ) = @ARGV;
die 'Too many arguments: expected INFILE and OUTFILE' if $bogus;
@ARGV = ($infile) if $infile;
-my $content = <>;
+my $content = do { local $/ = undef; <> };
$content
=~ s/^(?'fence'[``~]{3,})\s*\Kmermaid\n(?'type'gantt)\n(?'code'.*?\n)\k'fence'$/