diff options
author | Steven Schubiger <stsc@refcnt.org> | 2020-06-22 22:52:02 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2020-06-22 22:52:02 +0200 |
commit | 2c16a073d55ad7f910a8ddaec441fa9bf0b50415 (patch) | |
tree | 3866ef099930fb7d18b3c9a9ac48bc7114efec27 /readme.pl | |
parent | 048936d2b0358ba184b5380751744b8516fd74d1 (diff) | |
download | colorize-2c16a073d55ad7f910a8ddaec441fa9bf0b50415.tar.gz colorize-2c16a073d55ad7f910a8ddaec441fa9bf0b50415.tar.bz2 |
Generate README.cgit from README
Diffstat (limited to 'readme.pl')
-rwxr-xr-x | readme.pl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/readme.pl b/readme.pl new file mode 100755 index 0000000..877364b --- /dev/null +++ b/readme.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $readme = 'README'; +my $readme_cgit = 'README.cgit'; + +die "$0: $readme does not exist\n" unless -e $readme; + +open(my $fh, '<', $readme) or die "Cannot open $readme for reading: $!\n"; +my $text = do { local $/; <$fh> }; +close($fh); + +$text = do { + local $_ = $text; + s/</</g; + s/>/>/g; + $_ +}; + +print "Writing $readme_cgit\n"; + +open($fh, '>', $readme_cgit) or die "Cannot open $readme_cgit for writing: $!\n"; +print {$fh} <<"CGIT"; +<pre> +$text +</pre> +CGIT +close($fh); |