mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
Utilities/Scripts: Add temporary block-style comment conversion script
This commit is contained in:
33
Utilities/Scripts/rst-block-comments.bash
Executable file
33
Utilities/Scripts/rst-block-comments.bash
Executable file
@@ -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
|
Reference in New Issue
Block a user