• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónf58035e76f3314aa2cb2a807026251154465a68a (tree)
Tiempo2005-09-20 23:37:03
Autorhenoheno <henoheno>
Commiterhenoheno

Log Message

Very roughly converting EUC-JP => UTF-8 (without page filename, etc)

Cambiar Resumen

Diferencia incremental

--- a/release.sh
+++ b/release.sh
@@ -1,5 +1,5 @@
11 #!/bin/sh
2-# $Id: release.sh,v 1.22 2005/07/07 14:58:35 henoheno Exp $
2+# $Id: release.sh,v 1.23 2005/09/20 14:37:03 henoheno Exp $
33 # $CVSKNIT_Id: release.sh,v 1.11 2004/05/28 14:26:24 henoheno Exp $
44 # Release automation script for PukiWiki
55 # ==========================================================
@@ -18,6 +18,7 @@ usage(){
1818 warn " --nopkg Suppress creating archive (Extract and chmod only)"
1919 warn " --norm --nopkg, and remove nothing (.cvsignore etc)"
2020 warn " --co --norm, and use 'checkout' command instead of 'export'"
21+ warn " --utf8 Create UTF-8 converted archive (EXPERIMENTAL)"
2122 warn " -z|--zip Create *.zip archive"
2223 warn " --move-dist Move *.ini.php => *.ini-dist.php"
2324 warn " --copy-dist Move, and Copy *.ini.php <= *.ini-dist.php"
@@ -83,6 +84,7 @@ getopt(){ _arg=noarg
8384 --norm|--noremove ) echo _nopkg _noremove 1 ;;
8485 --co|--checkout ) echo _nopkg _noremove _checkout 1 ;;
8586 -z|--zip ) echo _zip 1 ;;
87+ --ut|--utf|--utf8|--utf-8 ) echo _utf8 1 ;;
8688 --copy-dist ) echo _copy_dist 1 ;;
8789 --move-dist ) echo _move_dist 1 ;;
8890 -d ) echo _CVSROOT 2 ; _arg="$2" ;;
@@ -122,7 +124,27 @@ done
122124 # No argument
123125 if [ $# -eq 0 ] ; then usage ; exit ; fi
124126
125-# Archiver check --------------------------------------------
127+# Utility check ---------------------------------------------
128+
129+if [ "$__utf8" ] ; then
130+ which nkf || err "nkf version 2.0 or later (UTF-8 enabled) not found"
131+ nkf_version="` nkf -v 2>&1 | sed -e '/^Network Kanji Filter/!d' -e 's/.* Version \([1-9]\).*/\1/' `"
132+ if [ "$nkf_version" = '1' ] ; then
133+ err "nkf found but seems 1.x"
134+ fi
135+ convert(){
136+ for list in "$@" ; do
137+ # NOTE: Specify '-E'(From EUC-JP) otherwise skin file will be collapse
138+ nkf -Ew "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list"
139+ done
140+ }
141+ convert_EUCJP2UTF8(){
142+ for list in "$@" ; do
143+ # Very rough conversion!
144+ sed 's/EUC-JP/UTF-8/g' "$list" > "$list.$$.tmp" && mv "$list.$$.tmp" "$list"
145+ done
146+ }
147+fi > /dev/null
126148
127149 if [ -z "$__zip" ]
128150 then
@@ -135,7 +157,7 @@ fi > /dev/null
135157 # Argument check --------------------------------------------
136158
137159 rel="$1"
138-tag="` check_versiontag "$rel" `"
160+tag="` check_versiontag "$rel" `" || exit 1
139161 pkg_dir="${mod}-${rel}"
140162
141163 # Export the module -----------------------------------------
@@ -158,6 +180,24 @@ test -z "$__noremove" && {
158180 find "$pkg_dir" -type f -name '.cvsignore' | xargs rm -f
159181 }
160182
183+# Conversion ------------------------------------------------
184+
185+if [ "$__utf8" ] ; then
186+ echo "Converting EUC-JP => UTF-8 ..."
187+ find "$pkg_dir" -type f \( -name "*.txt" -or -name "*.php" -or -name "*.lng" -or -name "*.dat" \) |
188+ while read line; do
189+ echo " $line"
190+ convert "$line"
191+ done
192+
193+ # Replace 'EUC-JP' => 'UTF-8'
194+ ( cd "$pkg_dir" &&
195+ convert_EUCJP2UTF8 lib/init.php skin/pukiwiki.skin*.php
196+ )
197+
198+ # Filename about wiki/*.txt or something are not coverted yet
199+fi
200+
161201 # chmod -----------------------------------------------------
162202
163203 chmod_pkg "$pkg_dir"