I’m a little wary of gsed -i 's/^\(\s*##*\)\([A-Za-z0-9`-]\)/\1 \2/g' which will patch in code cells with whitespace preceding # because where we have something like:
#Uncomment the following line
#print(“hello”)
We want a student to just delete the comment # before the print and not have extraneous whitespace.
I guess a way round this is to just report this? Or we could do the changes and then an editor using a differ could just reject the changes that weren’t required (which is probably how I’d do it… I’d commit all the files, then run the above to generate changes, then inspect and accept (by default) or refuse (by positive action) the changes) (vice versa is also easy enough)
Run as eg
Check style of Activity header - lower case first word, en-dash eg ## 1.2.3 Activity – lower case Also account for Opetional activity.
gsed -i 's/^\(#.*ctivity \)[–—-] \([a-zA-Z]\)/\1– \U\2/g'
Actually we need to lower case start of all words after the en dash? This may be a bit aggressive?
gsed -e 's/^\(#.*ctivity \)[–—-] \([a-zA-Z]\)\(.*\)/\1– \U\2\L\3/g'
Ensure space character after
#
:I’m a little wary of
gsed -i 's/^\(\s*##*\)\([A-Za-z0-9`-]\)/\1 \2/g'
which will patch in code cells with whitespace preceding # because where we have something like:We want a student to just delete the comment # before the print and not have extraneous whitespace.
I guess a way round this is to just report this? Or we could do the changes and then an editor using a differ could just reject the changes that weren’t required (which is probably how I’d do it… I’d commit all the files, then run the above to generate changes, then inspect and accept (by default) or refuse (by positive action) the changes) (vice versa is also easy enough)