[Po4a-commits] "po4a html-build-upload.sh, 1.12, 1.13 changelog, 1.17, 1.18"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sat Jun 3 13:12:17 UTC 2006


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv7546

Modified Files:
	html-build-upload.sh changelog 
Log Message:
New script to build the html pages, using man2html.


Index: html-build-upload.sh
===================================================================
RCS file: /cvsroot/po4a/po4a/html-build-upload.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- html-build-upload.sh	13 Feb 2005 23:06:44 -0000	1.12
+++ html-build-upload.sh	3 Jun 2006 13:12:15 -0000	1.13
@@ -25,50 +25,140 @@
 	echo $((($YES*100)/$TOTAL))
 }
 
-function get_name {
-	cat po/pod/$1.po | sed -n -e /\"NAME\"/,+1p | sed -n -e "s/msgstr \"\(.*\)\"/\1/p"
+#function get_name {
+#	cat po/pod/$1.po | sed -n -e /\"NAME\"/,+1p | sed -n -e "s/msgstr \"\(.*\)\"/\1/p"
+#}
+
+function get_charset {
+	case $1 in
+		pl)
+			echo "ISO-8859-2"
+			;;
+		*)
+			echo "ISO-8859-1"
+			;;
+	esac
 }
 
 POFILES=`cd po/pod; ls *.po`
 LANGS=${POFILES//.po/}
 
-FILES="doc/po4a.7.pod po4a po4a-gettextize po4a-normalize po4a-updatepo po4a-translate"
+PO4A_OPTS="-k 0 -v -f pod -M utf-8"
 
-PO4A_OPTS="-k 0 -v -f pod -M utf-8 -L iso8859-1"
+#./Build man
 
 rm -rf html/
+cp -a blib/man html
 mkdir -p html/en/
+mv html/man* html/en/
+mkdir html/en/man3pm
 
-mpod2html -dir=html/en -tocname index $FILES lib
-
-echo "<html><head><title>po4a</title></head><body><center><h1>po4a</h1><p>The po4a (po for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation.</p><br>English documentation: <a href=\"en/po4a.7.html\">Introduction</a> <a href=\"en\">Index</a><br><br>Documentation translations:<br>" > html/index.html
+# Generate the English man pages
+find lib -name "*.pm" | while read file
+do
+	name=$(basename $file)
+	name=${name//.pm/}
+	pod2man --section=3pm --release="Po4a Tools" --center="Po4a Tools" \
+	    $file html/en/man3pm/Locale::Po4a::$name.3pm
+done
+for file in po4a po4a-gettextize po4a-normalize po4a-translate po4a-updatepo
+do
+	pod2man --section=1 --release="Po4a Tools" --center="Po4a Tools" \
+	    $file html/en/man1/$file.1
+done
 
+# Main page
+echo "<html>
+ <head>
+  <title>po4a</title>
+ </head>
+ <body>
+  <center>
+   <h1>po4a</h1>
+   <p>
+    The po4a (po for anything) project goal is to ease translations (and
+    more interestingly, the maintenance of translations) using gettext tools
+    on areas where they were not expected like documentation.
+   </p>
+   <br>
+   English documentation:
+   <a href=\"en/man7/po4a.7.html\">Introduction</a>
+   <a href=\"en\">Index</a>
+   <br>
+   <br>
+   Documentation translations:
+   <br>" > html/index.html
 for lang in $LANGS ; do
-	mkdir -p html/$lang html/tmp
+	PERC=`percent_lang $lang`
+	echo "   $lang ($PERC% translated):
+   <a href=\"$lang/man7/po4a.7.html\">Introduction</a>
+   <a href=\"$lang/\">Index</a>
+   <br>" >> html/index.html
+done
+echo "   <br>
+   <a href=\"http://alioth.debian.org/projects/po4a/\">Alioth project page</a>" >> html/index.html
+echo "   <br>
+   <a href=\"http://packages.qa.debian.org/po4a\">
+    Debian developer information
+   </a>" >> html/index.html
+echo "   <br>
+   <br>
+   Last update: `LANG=C date`
+  </center>
+ </body>
+</html>" >> html/index.html
 
-	#Translate $FILES
-	for file in $FILES ; do
-		newfile=${file##*/}
-		PERL5LIB=lib perl po4a-translate $PO4A_OPTS -a doc/addendum.$lang -p po/pod/$lang.po -m $file -l html/tmp/$newfile
-	done
+for lang in en $LANGS ; do
+	echo Generate the $lang index
+	[ -d html/$lang/man3 ] && mv html/$lang/man3 html/$lang/man3pm
 
-	mkdir -p html/tmp/lib/Locale/Po4a
-	#Translate modules
-	for file in lib/Locale/Po4a/*.pm ; do
-		newfile=${file##*/}
-		PERL5LIB=lib perl po4a-translate $PO4A_OPTS -a doc/addendum.$lang -m $file -p po/pod/$lang.po -l html/tmp/lib/Locale/Po4a/$newfile
+	echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
+<html>
+ <head>
+  <meta content=\"text/html; charset=$(get_charset $lang)\" http-equiv=\"Content-Type\">
+  <title>Table of Contents</title>
+ </head>
+ <body>
+  <h1>Table of Contents</h1>
+  <hr>
+   <table>" > html/$lang/index.html
+	for man in html/$lang/man*/*
+	do
+		title=$(lexgrog "$man" | sed -ne 's/.*: \".* - //;s/"$//;p')
+		man=$(echo $man | sed -e "s/^html\/$lang\///")
+		man=${man%.gz}
+		man=${man/1p/1}
+		ref=$man.html
+		man=$(basename $man)
+		man=$(echo $man | sed -e 's/^\(.*\)\.\([0-9]\(pm\)\?\)$/\1(\2)/')
+		echo "    <tr>
+     <td><a href=\"$ref\">$man</a></td>
+     <td>$title</td>
+     </td>
+    </tr>" >> html/$lang/index.html
 	done
+	echo "   </table>
+  <hr>
+ </body>
+</html>" >> html/$lang/index.html
 
-	mpod2html -dir=html/$lang -strname `get_name $lang` -tocname index html/tmp/*
-	rm -rf html/tmp
-
-	PERC=`percent_lang $lang`
-	echo "$lang ($PERC% translated): <a href=\"$lang/po4a.7.html\">Introduction</a> <a href=\"$lang/\">Index</a><br>" >> html/index.html
+	echo Generate the $lang HTML pages
+	for man in html/$lang/man*/*
+	do
+		if [ "$man" != "${man%.gz}" ]
+		then
+			gunzip $man
+			man=${man%.gz}
+		fi
+		out=${man/1p/1}.html
+		man2html -r $man | sed -e '/Content-type: text.html/d' \
+		                       -e '/cgi-bin.man.man2html/d' \
+		                       -e "s/<HEAD>/<HEAD><meta content=\"text\/html; charset=$(get_charset $lang)\" http-equiv=\"Content-Type\">/" > $out
+		rm -f $man
+	done
 done
 
-echo "<br><a href=\"http://alioth.debian.org/projects/po4a/\">Alioth project page</a>" >> html/index.html
-echo "<br><a href=\"http://packages.qa.debian.org/po4a\">Debian developer information</a>" >> html/index.html
-echo "<br><br>Last update: `LANG=C date`</center></body></html>" >> html/index.html
 
-chmod -R g+rw html
 scp -pr html/* po4a.alioth.debian.org:/var/lib/gforge/chroot/home/groups/po4a/htdocs/
+ssh po4a.alioth.debian.org chgrp -R po4a /var/lib/gforge/chroot/home/groups/po4a/htdocs/
+ssh po4a.alioth.debian.org chmod -R g+rw /var/lib/gforge/chroot/home/groups/po4a/htdocs/

Index: changelog
===================================================================
RCS file: /cvsroot/po4a/po4a/changelog,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- changelog	3 Jun 2006 00:39:27 -0000	1.17
+++ changelog	3 Jun 2006 13:12:15 -0000	1.18
@@ -35,6 +35,9 @@
   * New module.
   (tests)
   * Add an mdoc test.
+  (html-build-upload.sh)
+  * Update the script to build the html documentation. It now uses
+    man2html. (This was necessary for the Polish pages)
 
  -- Thu, 13 Apr 2006 11:08:43 +0200
 




More information about the Po4a-commits mailing list