From 9fdc185bdfb45340338a0cf6867b56207e20f317 Mon Sep 17 00:00:00 2001 From: Ben Lynn Date: Tue, 13 Apr 2021 13:08:03 -0700 Subject: [PATCH] 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. --- Makefile | 4 +--- ko/basic.txt | 4 ++-- makeover | 32 +++++++++++++------------------- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 2d4387c..0bcd168 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,10 @@ # The availaible translation languages. # When starting a new translation, add a language code here. -# TRANSLATIONS = de es fr ko pt_br ru uk vi zh_cn zh_tw it pl LANGS = en $(TRANSLATIONS) -SHELL := /bin/bash -.PHONY: all clean sync public distclean $(LANGS) +.PHONY: all clean $(LANGS) all: $(LANGS) diff --git a/ko/basic.txt b/ko/basic.txt index 41b3645..47025f6 100644 --- a/ko/basic.txt +++ b/ko/basic.txt @@ -73,7 +73,7 @@ Hash 앞의 알파벳 몇 개만으로도 commit을 세분화 설정하실 수 이 명령어는 82f5 이후의 commit들을 보존함과 동시에 과거의 시간으로 잠시 돌아가게 해줍니다. 그러나, SF영화에서 처럼, 과거에 돌아간 상태에서 편집을하고 commit을 한다면 또 다른 시간대의 현실을 만들어가게 되는 것이죠. 왜냐하면 당신의 편집이 과거의 편집과는 다르게 입력이 되었기 때문입니다. -이렇게 새롭게 만들어진 대체현실을 'branch (나뭇가지)'라고 부릅니다 <>. 지금 알고계셔야 할 것은 +이렇게 새롭게 만들어진 대체현실을 'branch (나뭇가지)'라고 부릅니다 <>. 지금 알고계셔야 할 것은 $ git checkout master @@ -84,7 +84,7 @@ master branch로 돌아오기전 commit을 하거나 reset을 한번 실행하 - *`git reset --hard`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 세이브들을 모두 삭제합니다. -- *`git checkout`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 게임들은 처음 세이브와 다른 길을 가게 됩니다. 추후의 모든 세이브들은 다른 branch로써 새로운 현실세계를 만들게 됩니다 <>. +- *`git checkout`*: 예전에 세이브 해뒀던 게임으로 돌아가며, 돌아간 시점 이후의 게임들은 처음 세이브와 다른 길을 가게 됩니다. 추후의 모든 세이브들은 다른 branch로써 새로운 현실세계를 만들게 됩니다 <>. 예전의 파일/하위 디렉토리들을 되돌리고 싶을 때 다음 명령어를 이용함으로써 필요한 파일/하위 디렉토리만을 되돌릴 수 있습니다: diff --git a/makeover b/makeover index f945986..fa6a57f 100755 --- a/makeover +++ b/makeover @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Extract table of contents from index.html and delete preface link. BOOKDIR=book-$1 @@ -9,22 +9,14 @@ case $1 in ;; esac -gawk ' -/
/ { - print $0 - getline - print $0 - print "
  • '"$TITLE"'
  • " - getline - while (!match($0, "
    ")) { - gsub("pr01.html", "index.html") - print $0 - getline - } - print $0 - exit -} -' < $BOOKDIR/index.html > toc.tmp +# Older AsciiDoc versions put newlines in their output. +# To get them to work with the following, first minify the HTML output. +cat $BOOKDIR/index.html \ + | grep -o '
    .*' \ + | sed 's!
    .*!!' \ + | sed 's!!index.html!g' \ + | sed 's!
  • !
  • '"$TITLE"'
  • &!' \ + > toc.tmp # For every file except the index... for FILE in $BOOKDIR/*.html @@ -35,11 +27,13 @@ do # Prepend "Git Magic - " to titles of all pages. sed '// s/<title>/&'"$TITLE"' - /' -i $FILE sed 's/pr01\.html/index.html/g' -i $FILE + # Insert newline after `body` tag. + sed 's/<body[^>]*>/&\n/' -i $FILE # Paste ToC into beginning and add div section with class content for CSS. - sed '/<body/{n; r toc.tmp + sed '/<body/{r toc.tmp a <div class="content"> }' -i $FILE - sed '/^<\/body/i </div>' -i $FILE + sed 's!</body>!</div>&!' -i $FILE fi done -- 2.11.4.GIT