Skip to content

Commit 7df89f7

Browse files
authored
Merge pull request #1608 from peternewman/e1.37-2
Simplify the sed command used to generate plugin header files, closes #1592 (hopefully)
2 parents 32e48b0 + 694cdf1 commit 7df89f7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugins/convert_README_to_header.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ fi
2727
plugin=`basename "$path"`;
2828
outfilename=`basename $outfile`;
2929

30-
# See http://stackoverflow.com/a/16576291
31-
# On Mac OS's sed, \n is not recognized as a newline character, but
32-
# \[actual newline] works
33-
desc=`sed -e ':a' -e 'N' -e '$!ba' -e 's/\"/\\\"/g' -e 's/\n/\\\\n"\\
34-
"/g' "$path/README.md"`;
30+
#s/"/\\"/g - replace " with \" throughout
31+
#1!s/^/"/g - Apart from the first line, add a " to the start of each line
32+
#$!s/$/\\\\n"/g - Apart from the last line, add a \\n (i.e. an escaped newline)
33+
#and a " to the end of each line
34+
desc=`sed -e 's/"/\\"/g' -e '1!s/^/"/' -e '$!s/$/\\\\n"/' "$path/README.md"`;
3535

3636
identifier=`echo "PLUGINS_${plugin}_${outfilename%.h}_H_" | tr '[:lower:]' '[:upper:]'`
3737

0 commit comments

Comments
 (0)