diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-22 13:49:41 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-22 15:09:26 (GMT) |
commit | 7115aa6c2249ec368fe0dfbd257a22eb0e04042d (patch) | |
tree | c781a13ef0c461c5b4ad1ed9b97fdb2ec3599194 | |
parent | 649479d0532d389aed1ac86aabf24884276dba3a (diff) | |
download | CMake-7115aa6c2249ec368fe0dfbd257a22eb0e04042d.zip CMake-7115aa6c2249ec368fe0dfbd257a22eb0e04042d.tar.gz CMake-7115aa6c2249ec368fe0dfbd257a22eb0e04042d.tar.bz2 |
Utilities/Scripts: Add temporary block-style comment conversion script
-rwxr-xr-x | Utilities/Scripts/rst-block-comments.bash | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Utilities/Scripts/rst-block-comments.bash b/Utilities/Scripts/rst-block-comments.bash new file mode 100755 index 0000000..864f21f --- /dev/null +++ b/Utilities/Scripts/rst-block-comments.bash @@ -0,0 +1,33 @@ +#!/bin/bash + +files="$(git ls-files Modules | grep -v ' ' | xargs grep -l '^#.rst:$')" + +perl -i -e ' + use strict; + use warnings; + + my $rst = 0; + while (<>) { + if ($rst) { + if (/^# (.*)$/) { + print "$1\n"; + } elsif (/^#$/) { + print "\n"; + } else { + $rst = 0; + print "#]=======================================================================]\n"; + print $_; + } + } elsif (/^#\.rst:$/) { + $rst = 1; + print "#[=======================================================================[.rst:\n"; + } else { + print $_; + } + + if ($rst && eof) { + $rst = 0; + print "#]=======================================================================]\n"; + } + } +' $files |