Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Pro Git 2nd Edition翻訳時の初版(Markdown)流用方法

csplit 01-chapter8.markdown '/^## /' {*}

で元々のMarkdownを節ごとに分解したら、ファイル名を2nd Editionに合わせて変更し、その上で以下のように役物を変換する。

grep -l '’' ./* | xargs sed -i.bak -e 's/’/'\''/g'
grep -l ' "' ./* | xargs sed -i.bak -e 's/ "/ ``/g'
grep -l '" ' ./* | xargs sed -i.bak -e 's/" /'\'''\'' /g'
grep -l '—' ./* | xargs sed -i.bak -e 's/—/–/g'

あとは初版を 1-en.org/ フォルダに、と第2版を 2-en.new/ フォルダに置いたら、 3-diff/ フォルダを作成した上で、次のようにwdiffで単語単位の変更点を調べて、変更部分だけ訳しなおせばよい。

for i in `ls 1-en.org/`; do wdiff 1-en.org/$i 2-en.new/$i > 3-diff/$i; done