From b6f305e5baa754cbcb57215a743014256eb66f4a Mon Sep 17 00:00:00 2001 From: filux Date: Fri, 20 Mar 2015 18:33:47 +0100 Subject: [PATCH] checked and updated tool, added new useful script --- .gitignore | 3 - data/glest_game | 2 +- .../tools/convert_faction_xml2html/.gitignore | 1 + .../convert_faction_xml2html/compare.html | 19 -- .../compare_help.html | 16 - .../convert_faction_xml2html/favicon.ico | Bin 318 -> 0 bytes .../make_html_for_git_docs.sh | 95 ++++++ .../convert_faction_xml2html/media/.gitignore | 1 + .../media/compare.html | 4 +- .../media/compare_help.html | 2 +- .../convert_faction_xml2html/media/style.css | 3 +- .../convert_faction_xml2html/megapack.ini | 4 +- .../convert_faction_xml2html/setupDeps.sh | 34 +- .../tools/convert_faction_xml2html/style.css | 300 ------------------ 14 files changed, 117 insertions(+), 367 deletions(-) create mode 100644 source/tools/convert_faction_xml2html/.gitignore delete mode 100644 source/tools/convert_faction_xml2html/compare.html delete mode 100644 source/tools/convert_faction_xml2html/compare_help.html delete mode 100644 source/tools/convert_faction_xml2html/favicon.ico create mode 100755 source/tools/convert_faction_xml2html/make_html_for_git_docs.sh create mode 100644 source/tools/convert_faction_xml2html/media/.gitignore delete mode 100644 source/tools/convert_faction_xml2html/style.css diff --git a/.gitignore b/.gitignore index 8eed2d506..6c9b3eab3 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,3 @@ $RECYCLE.BIN/ # breakpad symlink / directory /google-breakpad /google-breakpad/ - -# convert_faction_xml2html -/html/ diff --git a/data/glest_game b/data/glest_game index 1500d779c..d5ac96e7a 160000 --- a/data/glest_game +++ b/data/glest_game @@ -1 +1 @@ -Subproject commit 1500d779ccaa5e1d525863b1fd7911f0303a38e8 +Subproject commit d5ac96e7a7e29e3c2ac7142eace8291e4c5ddb03 diff --git a/source/tools/convert_faction_xml2html/.gitignore b/source/tools/convert_faction_xml2html/.gitignore new file mode 100644 index 000000000..ac7af2e80 --- /dev/null +++ b/source/tools/convert_faction_xml2html/.gitignore @@ -0,0 +1 @@ +/html/ diff --git a/source/tools/convert_faction_xml2html/compare.html b/source/tools/convert_faction_xml2html/compare.html deleted file mode 100644 index 36dabb59a..000000000 --- a/source/tools/convert_faction_xml2html/compare.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -Compare Glest Units - - - - - - - - - - - - - diff --git a/source/tools/convert_faction_xml2html/compare_help.html b/source/tools/convert_faction_xml2html/compare_help.html deleted file mode 100644 index b76a95c93..000000000 --- a/source/tools/convert_faction_xml2html/compare_help.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -Compare Glest Units - - - - - - - -

Choose units in the left and right frames to compare.

-
Home
- - diff --git a/source/tools/convert_faction_xml2html/favicon.ico b/source/tools/convert_faction_xml2html/favicon.ico deleted file mode 100644 index af3a758f2510fc26714f49722e523fc5ab84d649..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmbtPF$%*l43uyo9UTmvJ9dl_)Pa1ep@Rb%Vxysj4EahSV;BFbqbnzCx1Mx&LNZta zKnbli6kHJCR9sj(XCcBt6d-N-O9Fr-gs_{al#o&qFN3@# +# Copyright (c) 2015 under GNU GPL v3.0+ +LANG=C + +if [ "$1" = "" ]; then + techtree="megapack" +else + techtree="$1" +fi +if [ "$2" = "" ]; then + rel_path_docs_icons="../../techs" +else + rel_path_docs_icons="$2" +fi +if [ "$3" = "" ]; then + rel_path_tech_test="../../../../data/glest_game/techs" +else + rel_path_tech_test="$3" +fi +SCRIPTDIR="$(dirname "$(readlink -f "$0")")" +cd "$SCRIPTDIR" +rm -rf html +sed "s|^generate_g3d_images = .*|generate_g3d_images = 0|" "$techtree.ini" > "$techtree-temp.ini" +./convert_faction_xml2html.pl "$techtree-temp.ini" + +cd html +icons_list1="$(grep -o "images/[^/ ]*/[^/ ]*/[^. ]*.bmp" *.html)" +icons_list2="$(grep -o "images/[^/ ]*/[^/ ]*/[^. ]*.jpg" *.html)" +icons_list3="$(grep -o "images/[^/ ]*/[^/ ]*/[^. ]*.png" *.html)" +icons_list="$(echo -e "$icons_list1 $icons_list2 $icons_list3" | xargs)" +echo ">>> replacing icon for (unit='|', upgrade='\', resource='/') ..." +for icon_file in $icons_list; do + filename="$(echo "$icon_file" | awk -F ':' '{print $1}')" + icon="$(echo "$icon_file" | awk -F ':' '{print $2}')" + + faction="$(echo "$icon" | awk -F '/' '{print $2}')" + uu_name="$(echo "$icon" | awk -F '/' '{print $3}')" + bmp_file="$(echo "$icon" | awk -F '/' '{print $4}')" + find_file="$(find $rel_path_tech_test/$techtree/factions/$faction -type f -name "$bmp_file")" + + echo "$find_file" | grep -q "factions/$faction/upgrades" + if [ "$?" -eq "0" ]; then : + sed -i "s|images/$faction/$uu_name/$bmp_file|$rel_path_docs_icons/$techtree/factions/$faction/upgrades/$uu_name/images/$bmp_file|" "$filename" + echo -n "\\" + else + echo "$find_file" | grep -q "factions/$faction/units" + if [ "$?" -eq "0" ]; then : + sed -i "s|images/$faction/$uu_name/$bmp_file|$rel_path_docs_icons/$techtree/factions/$faction/units/$uu_name/images/$bmp_file|" "$filename" + echo -n "|" + fi + fi + sleep 0.01s +done +icons_list1="$(grep -o "images/resources/[^. ]*.bmp" *.html)" +icons_list2="$(grep -o "images/resources/[^. ]*.jpg" *.html)" +icons_list3="$(grep -o "images/resources/[^. ]*.png" *.html)" +icons_list="$(echo -e "$icons_list1 $icons_list2 $icons_list3" | xargs)" +for icon_file in $icons_list; do + filename="$(echo "$icon_file" | awk -F ':' '{print $1}')" + icon="$(echo "$icon_file" | awk -F ':' '{print $2}')" + + bmp_file="$(echo "$icon" | awk -F '/' '{print $3}')" + res_name="$(echo "$bmp_file" | awk -F '.' '{print $1}')" + sed -i "s|images/resources/$bmp_file|$rel_path_docs_icons/$techtree/resources/$res_name/images/$bmp_file|" "$filename" + echo -n "/" + sleep 0.01s +done +echo + +echo ">>> removing not required files ..." +rm -rf css js +find ./images/*/* -type d | xargs rm -rf +rm -rf images/datatables images/resources +find ./images/* -type f -name "*.canon" | xargs rm -f +find ./images/* -type f -name "*.cmapx" | xargs rm -f +find ./images/* -type f -name "*.text" | xargs rm -f + +rm -f all.html +all_html_list="$(grep '"all.html"' *.html | awk -F ':' '{print $1}' | xargs)" +for filename in $all_html_list; do + sed -i '/All Units of all Factions/d' "$filename" +done + +if [ "$(which optipng)" != "" ]; then + echo ">>> optimizing .png files ..." + find ./images -type f -name '*.png' -exec optipng '{}' \; +else + echo "Warning: 'optipng' not found" +fi +cd "$SCRIPTDIR" +rm -f "$techtree-temp.ini" diff --git a/source/tools/convert_faction_xml2html/media/.gitignore b/source/tools/convert_faction_xml2html/media/.gitignore new file mode 100644 index 000000000..25357256b --- /dev/null +++ b/source/tools/convert_faction_xml2html/media/.gitignore @@ -0,0 +1 @@ +/jquery*.min.js diff --git a/source/tools/convert_faction_xml2html/media/compare.html b/source/tools/convert_faction_xml2html/media/compare.html index 03344468c..36dabb59a 100644 --- a/source/tools/convert_faction_xml2html/media/compare.html +++ b/source/tools/convert_faction_xml2html/media/compare.html @@ -11,8 +11,8 @@ - - + + diff --git a/source/tools/convert_faction_xml2html/media/compare_help.html b/source/tools/convert_faction_xml2html/media/compare_help.html index b76a95c93..125a0de19 100644 --- a/source/tools/convert_faction_xml2html/media/compare_help.html +++ b/source/tools/convert_faction_xml2html/media/compare_help.html @@ -11,6 +11,6 @@

Choose units in the left and right frames to compare.

-
Home
+
Home
diff --git a/source/tools/convert_faction_xml2html/media/style.css b/source/tools/convert_faction_xml2html/media/style.css index 79a69b286..8d2a0844f 100644 --- a/source/tools/convert_faction_xml2html/media/style.css +++ b/source/tools/convert_faction_xml2html/media/style.css @@ -15,7 +15,7 @@ body { /* Header */ #header { width: 1016px; - height: 313px; + height: 175px; margin: 0 auto; background: url("header/header.jpg") no-repeat; } @@ -121,6 +121,7 @@ img.left { #header #logo { width: 365px; margin: 0 auto; + margin-top: 1em; } /* Download image */ diff --git a/source/tools/convert_faction_xml2html/megapack.ini b/source/tools/convert_faction_xml2html/megapack.ini index 3e049fcde..c997532fe 100644 --- a/source/tools/convert_faction_xml2html/megapack.ini +++ b/source/tools/convert_faction_xml2html/megapack.ini @@ -38,7 +38,7 @@ resources_path=../../../data/glest_game/techs/megapack/resources pack_file=../../../data/glest_game/techs/megapack/megapack.xml -out_path=../../../html +out_path=html glestkeys=../../../data/glest_game/glestkeys.ini @@ -152,7 +152,7 @@ header=< - +