Skip to content

Commit b8b947d

Browse files
committed
Check that titles are correctly formatted
In Markdown, the sharps at the end of the title line can be elided but they may not be followed by spaces. Otherwise, the sharps are rendered in the title.
1 parent 5e404b9 commit b8b947d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Rakefile

+11
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ namespace :ci do
184184
mk_file = File.open(mk_filename, 'r') do |mk|
185185
mark+= mk.read.encode("UTF-8")
186186
end
187+
src_file = File.open(mk_filename, 'r')
188+
until src_file.eof?
189+
line = src_file.readline
190+
matches = line.match /^#/
191+
if matches
192+
if line.match /^(#+).*#[[:blank:]]+$/
193+
print "\nBadly formatted title in #{mk_filename}: #{line}\n"
194+
error_code = true
195+
end
196+
end
197+
end
187198
end
188199
begin
189200
code = Maruku.new(mark, :on_error => :raise)

ko/07-customizing-git/01-chapter7.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ Git도 다른 버전 관리 시스템처럼 어떤 이벤트가 생겼을 때
557557

558558
클라이언트 훅은 매우 다양하다. 이 절에서는 클라이언트 훅을 커밋 Workflow 훅, E-mail Workflow 훅, 그리고 나머지로 분류해서 설명한다.
559559

560-
#### 커밋 Workflow 훅 ####
560+
#### 커밋 Workflow 훅 ####
561561

562562
먼저 커밋과 관련된 훅을 살펴보자. 커밋과 관련된 훅은 모두 네 가지다. `pre-commit` 훅은 커밋할 때 가장 먼저 호출되는 훅으로 커밋 메시지를 작성하기 전에 호출된다. 이 훅에서 커밋하는 Snapshot을 점검한다. 빠트린 것은 없는지, 테스트는 확실히 했는지 등을 검사한다. 커밋할 때 꼭 확인해야 할 게 있으면 이 훅으로 확인한다. 그리고 이 훅의 Exit 코드가 0이 아니면 커밋은 취소된다. 물론 `git commit --no-verify`라고 실행하면 이 훅을 일시적으로 생략할 수 있다. lint 같은 프로그램으로 코드 스타일을 검사하거나, 줄 끝의 공백 문자를 검사하거나(예제로 들어 있는 `pre-commit` 훅이 하는 게 이 일이다), 코드에 주석을 달았는지 검사하는 일은 이 훅으로 하는 것이 좋다.
563563

0 commit comments

Comments
 (0)