mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
* build-aux/git-hooks/commit-msg: Replace Markdown-style quotation.
This commit is contained in:
parent
dd42133315
commit
4f13f52a3a
1 changed files with 9 additions and 7 deletions
|
|
@ -75,6 +75,7 @@ exec $awk \
|
|||
}
|
||||
c_lower = "abcdefghijklmnopqrstuvwxyz"
|
||||
unsafe_gnu_url = "(http|ftp)://([" c_lower ".]*\\.)?(gnu|fsf)\\.org"
|
||||
markdown_quotation = "(^|[^\\\\])`[^'\''`]+`"
|
||||
}
|
||||
|
||||
{ input[NR] = $0 }
|
||||
|
|
@ -92,11 +93,6 @@ exec $awk \
|
|||
status = 1
|
||||
}
|
||||
|
||||
/(^|[^\\])`[^'\''`]+`/ {
|
||||
print "Markdown-style quotes in commit message"
|
||||
status = 1
|
||||
}
|
||||
|
||||
nlines == 0 && $0 !~ non_space { next }
|
||||
|
||||
{ nlines++ }
|
||||
|
|
@ -141,7 +137,7 @@ exec $awk \
|
|||
status = 1
|
||||
}
|
||||
|
||||
$0 ~ unsafe_gnu_url {
|
||||
$0 ~ unsafe_gnu_url || $0 ~ markdown_quotation {
|
||||
needs_rewriting = 1
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +163,13 @@ exec $awk \
|
|||
suffix = substr(line, RSTART)
|
||||
line = prefix "https:" substr(suffix, 5 + (suffix ~ /^http:/))
|
||||
}
|
||||
print line >file
|
||||
while (match(line, markdown_quotation)) {
|
||||
prefix = substr(line, 1, RSTART)
|
||||
within = substr(line, RSTART + 2, RLENGTH - 3)
|
||||
suffix = substr(line, RSTART + RLENGTH)
|
||||
line = prefix "'\''" within "'\''" suffix
|
||||
}
|
||||
print line >file
|
||||
}
|
||||
if (close(file) != 0) {
|
||||
print "Cannot rewrite: " file
|
||||
|
|
|
|||
Loading…
Reference in a new issue