1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#!/bin/zsh
file=$1 [[ -f $file ]] || { print "PLEASE SPECIF FILE" exit 250 }
content=$(< $file) local -a _chunks _chunks=(${(@f)content})
content=($(< $file))
for ((i=1; i<=$#_chunks; ++i)); do _line=$_chunks[i] if [[ $_line =~ '^([=])+s(.*)' ]]; then head=${match[1]} head=${head:gs/=/#} print -- "$head $match[2]" elif [[ $_line =~ '^}}}.*' ]]; then print "```" elif [[ $_line =~ '^{{{.*' ]]; then print "```" else print -- $_line fi done
|
近期评论