diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-03-31 10:57:07 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-03-31 11:20:20 +0200 |
commit | e9deca930024287572165b95cd280a8009c30b39 (patch) | |
tree | b7e515421dec1c8f11d6d115e14fbfcea9aae9b7 /bin | |
parent | 5e6044738cbc0627209bc5f8a82ce2a5d6687b8e (diff) |
avoid custom argument in shebang, ignored when executed by explicit interpreter
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hedgedoc2quarto | 5 |
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'$/ |