miwafu/bin/switch-markdown-headers-to-atx
2017-05-09 19:14:51 -05:00

24 lines
317 B
Perl
Executable file

#!/usr/bin/perl
#
# Setup
#
# Directives
use strict;
use warnings;
#
# Process
#
# Load the entire file.
$/ = undef;
my $buffer = <>;
# Modify the buffer.
$buffer =~ s@\n(\w+?)\n====+@\n# $1@sg;
$buffer =~ s@\n([A-Za-zaeiouáéíóúàèìòùāēīōū]+?)\n----+@\n## $1@sg;
# Output the file.
print $buffer;