Skip to content

Commit 9fdc185

Browse files
committed
Adjust makeover to handle newer AsciiDoc output.
Newer AsciiDoc versions no longer output newlines, which `makeover` had relied on. Fix an issue with the Korean translation cross-references.
1 parent eb69781 commit 9fdc185

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# The availaible translation languages.
22
# When starting a new translation, add a language code here.
3-
#
43

54
TRANSLATIONS = de es fr ko pt_br ru uk vi zh_cn zh_tw it pl
65
LANGS = en $(TRANSLATIONS)
7-
SHELL := /bin/bash
86

9-
.PHONY: all clean sync public distclean $(LANGS)
7+
.PHONY: all clean $(LANGS)
108

119
all: $(LANGS)
1210

ko/basic.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Hash 앞의 알파벳 몇 개만으로도 commit을 세분화 설정하실 수
7373

7474
이 명령어는 82f5 이후의 commit들을 보존함과 동시에 과거의 시간으로 잠시 돌아가게 해줍니다. 그러나, SF영화에서 처럼, 과거에 돌아간 상태에서 편집을하고 commit을 한다면 또 다른 시간대의 현실을 만들어가게 되는 것이죠. 왜냐하면 당신의 편집이 과거의 편집과는 다르게 입력이 되었기 때문입니다.
7575

76-
이렇게 새롭게 만들어진 대체현실을 'branch (나뭇가지)'라고 부릅니다 <<branch 에 관해선 추후에 자세히 설명합니다>>. 지금 알고계셔야 할 것은
76+
이렇게 새롭게 만들어진 대체현실을 'branch (나뭇가지)'라고 부릅니다 <<branch,에 관해선 추후에 자세히 설명합니다>>. 지금 알고계셔야 할 것은
7777

7878
$ git checkout master
7979

@@ -84,7 +84,7 @@ master branch로 돌아오기전 commit을 하거나 reset을 한번 실행하
8484

8585
- *`git reset --hard`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 세이브들을 모두 삭제합니다.
8686

87-
- *`git checkout`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 게임들은 처음 세이브와 다른 길을 가게 됩니다. 추후의 모든 세이브들은 다른 branch로써 새로운 현실세계를 만들게 됩니다 <<branch에 관해선 추후에 자세히 설명합니다>>.
87+
- *`git checkout`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 게임들은 처음 세이브와 다른 길을 가게 됩니다. 추후의 모든 세이브들은 다른 branch로써 새로운 현실세계를 만들게 됩니다 <<branch,에 관해선 추후에 자세히 설명합니다>>.
8888

8989
예전의 파일/하위 디렉토리들을 되돌리고 싶을 때 다음 명령어를 이용함으로써 필요한 파일/하위 디렉토리만을 되돌릴 수 있습니다:
9090

makeover

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Extract table of contents from index.html and delete preface link.
44
BOOKDIR=book-$1
@@ -9,22 +9,14 @@ case $1 in
99
;;
1010
esac
1111

12-
gawk '
13-
/<div class="toc">/ {
14-
print $0
15-
getline
16-
print $0
17-
print "<li><b>'"$TITLE"'</b></li>"
18-
getline
19-
while (!match($0, "</div>")) {
20-
gsub("pr01.html", "index.html")
21-
print $0
22-
getline
23-
}
24-
print $0
25-
exit
26-
}
27-
' < $BOOKDIR/index.html > toc.tmp
12+
# Older AsciiDoc versions put newlines in their output.
13+
# To get them to work with the following, first minify the HTML output.
14+
cat $BOOKDIR/index.html \
15+
| grep -o '<div class="toc">.*' \
16+
| sed 's!</div>.*!</div>!' \
17+
| sed 's!<pr01.html\>!index.html!g' \
18+
| sed 's!<li>!<li><b>'"$TITLE"'</b></li>&!' \
19+
> toc.tmp
2820

2921
# For every file except the index...
3022
for FILE in $BOOKDIR/*.html
@@ -35,11 +27,13 @@ do
3527
# Prepend "Git Magic - " to titles of all pages.
3628
sed '/<title>/ s/<title>/&'"$TITLE"' - /' -i $FILE
3729
sed 's/pr01\.html/index.html/g' -i $FILE
30+
# Insert newline after `body` tag.
31+
sed 's/<body[^>]*>/&\n/' -i $FILE
3832
# Paste ToC into beginning and add div section with class content for CSS.
39-
sed '/<body/{n; r toc.tmp
33+
sed '/<body/{r toc.tmp
4034
a <div class="content">
4135
}' -i $FILE
42-
sed '/^<\/body/i </div>' -i $FILE
36+
sed 's!</body>!</div>&!' -i $FILE
4337
fi
4438
done
4539

0 commit comments

Comments
 (0)