File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,18 @@ sedi() {
2525 fi
2626}
2727
28+ repeat_char () {
29+ printf %" ${NEW_NAME_LENGTH} " s | tr " " " $1 "
30+ }
31+
2832args () {
2933 if [ $# -ne 1 ]; then
3034 usage
3135 exit 1
3236 fi
3337 NEW_NAME=$1
3438 NEW_NAME_PYSAFE=$( echo " $NEW_NAME " | sed ' s/-/__/g' )
39+ NEW_NAME_LENGTH=${# NEW_NAME}
3540 if echo " $NEW_NAME " | grep -E --quiet --invert-match ' ^[a-z0-9_-]+$' ; then
3641 usage
3742 exit 1
@@ -78,6 +83,16 @@ convert_formula() {
7883 sedi " /^\( \)TEMPLATE\(:\)$/s//\1${NEW_NAME_PYSAFE} \2/" " $filename "
7984 done
8085
86+ # Where a section heading contains TEMPLATE, ensure the length of underlining
87+ # on the following line matches the length of the new formula name
88+ sedi " /TEMPLATE/{
89+ n
90+ s/========/$( repeat_char =) /
91+ s/--------/$( repeat_char -) /
92+ s/\^^^^^^^^/$( repeat_char ^) /" '
93+ s/""""""""/' " $( repeat_char \" ) /
94+ }" docs/README.rst docs/map.jinja.rst
95+
8196 # Replace all other instances of TEMPLATE with the regular new formula name
8297 grep --recursive --files-with-matches --exclude-dir=.git TEMPLATE . \
8398 | while read -r filename; do
You can’t perform that action at this time.
0 commit comments