gimp-help-2 r2593 - in branches/xml2po-support: . tools



Author: ulfehlert
Date: Wed Nov  5 20:37:28 2008
New Revision: 2593
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2593&view=rev

Log:
2008-11-05  Ulf-D. Ehlert  <ulfehlert svn gnome org>

	* tools/migrate.sh: create authors.xml; reformat 'en' XML files

	* Makefile.GNU: enabled making draft, pdf, odf
	* Makefile.am: enabled making draft, pdf, odf; removed profiling


Modified:
   branches/xml2po-support/ChangeLog
   branches/xml2po-support/Makefile.GNU
   branches/xml2po-support/Makefile.am
   branches/xml2po-support/tools/migrate.sh

Modified: branches/xml2po-support/Makefile.GNU
==============================================================================
--- branches/xml2po-support/Makefile.GNU	(original)
+++ branches/xml2po-support/Makefile.GNU	Wed Nov  5 20:37:28 2008
@@ -21,7 +21,7 @@
 XSLTFLAGS = --nonet
 
 XMLLINT      = xmllint
-XMLLINTFLAGS = --nonet -noout
+XMLLINTFLAGS = --nonet
 
 XML2PO = tools/xml2po
 
@@ -36,6 +36,11 @@
 MSGMERGE      = msgmerge
 MSGMERGEFLAGS = --quiet --backup=none --update
 
+DBLATEX          = dblatex
+DBLATEXFLAGS     =
+DOCBOOK2ODF      = docbook2odf
+DOCBOOK2ODFFLAGS =
+
 # Standard shell commands
 echo_n  = echo -n
 mkdir_p = mkdir -p
@@ -52,6 +57,8 @@
 podir    = po
 xmlpodir = xml
 htmldir  = html
+pdfdir   = pdf
+odfdir   = odf
 
 # Find files and directories
 xml_file_predicates =       \
@@ -69,21 +76,16 @@
 # Files & directories
 XML_FILES := $(shell cd $(srcdir) && find $(xmldir) $(xml_file_predicates))
 XML_DIRS  := $(shell cd $(srcdir) && find $(xmldir) $(dir_predicates))
-#DIR_TREE   = $(patsubst $(xmldir)/%, %, $(XML_DIRS))
-#DIR_TREE   = $(XML_DIRS:$(xmldir)/%=%)
 
-#POT_FILES  = $(patsubst $(xmldir)/%.xml, $(potdir)/%.pot, $(XML_FILES))
 POT_FILES  = $(XML_FILES:$(xmldir)/%.xml=$(potdir)/%.pot)
-#POT_DIRS   = $(patsubst $(xmldir)/%, $(potdir)/%, $(XML_DIRS))
-#POT_DIRS   = $(XML_DIRS:$(xmldir)/%=$(potdir)/%)
 
 # XXX: requires that "plainhtml.xsl" has been renamed to "html.xsl"
 HTML_STYLESHEETS = stylesheets/html*.xsl
 
-# to be generated from stylesheets/authors.xml
-AUTHORS_DOCBOOK_XML = src/preface/authors.xml
-#
+# list of authors and contributors
 AUTHORS_STYLESHEET_XML = stylesheets/authors.xml
+# automatically generated authors section (DocBook)
+AUTHORS_DOCBOOK_XML = src/preface/authors.xml
 
 # To talk or not to talk, that is the question!
 VERBOSE ?= 1
@@ -141,12 +143,12 @@
 #     $2 - translation language
 #     $3 - output PO file
 # TODO: include compendium (cf. "info msgmerge")
-pot2po  = if [ -f $@ ]; then \
-              $(MSGFMT)   $(MSGFMTFLAGS)   $(3); \
-              $(MSGMERGE) $(MSGMERGEFLAGS) $(3) $(1) && touch $(3); \
-          else \
-              $(MSGINIT)  $(MSGINITFLAGS) --input $(1) --locale=$(2) --output $(3); \
-          fi
+pot2po = if [ -f $@ ]; then \
+             $(MSGFMT)   $(MSGFMTFLAGS)   $(3); \
+             $(MSGMERGE) $(MSGMERGEFLAGS) $(3) $(1) && touch $(3); \
+         else \
+             $(MSGINIT)  $(MSGINITFLAGS) --input $(1) --locale=$(2) --output $(3); \
+         fi
 
 # Merge PO file into (translated) XML file
 #
@@ -157,8 +159,14 @@
 #     $2 - PO file containing translations
 #     $3 - translation language
 #     $4 - resulting (translated) XML file
-po2xml  = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
-          | sed -e '/Warning: image file .* not found./d'
+ifeq ("$(XMLLINT)", "")
+po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
+         | sed -e '/Warning: image file .* not found./d'
+else
+po2xml = ($(XML2PO) --po-file=$(2) --language=$(3) --output='-' $(1) \
+         | $(XMLLINT) $(XMLLINTFLAGS) --format --output $(4) -) 2>&1 \
+         | sed -e '/Warning: image file .* not found./d'
+endif
 
 
 ########################################################################
@@ -166,13 +174,11 @@
 ########################################################################
 
 first: all
+all: validate html index AUTHORS
 
 # ignore
 validate: ;
-html: ;
-#index: ;
 
-all: validate html index AUTHORS
 
 
 ########################################################################
@@ -259,8 +265,9 @@
 $(foreach LANG,$(PO_LANGS),$(eval $(call MAKE_XML_RULES,$(LANG))))
 
 # Special case: en
+# TODO: check this
 en_XML_FILES = $(XML_FILES:$(xmldir)/%=$(xmlpodir)/en/%)
-$(en_XML_FILES): $(xmlpodir)/en
+$(en_XML_FILES): $(xmlpodir)/en ;
 
 # TODO: make relative link rather than absolute link(?)
 $(xmlpodir)/en: $(XML_FILES)
@@ -285,40 +292,42 @@
 ####            Make HTML files:  XML --> HTML                      ####
 ########################################################################
 
-#html-%: index-% html/%/index.html ;
+html: $(foreach lang,$(LANGUAGES),html-$(lang)) ;
+
+# html-% -> index-% -> html/%/gimp-help.xml -> html/%/gimp-xrefs.xml -> html/%/index.html
 html-%: index-% ;
 
-html/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS)
+$(htmldir)/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS)
 	$(msg) "*** Making html for $* ... "
-	$(cmd) rm -rf html/$*
-	$(cmd) $(mkdir_p) html/$*
-	$(cmd) test -L html/images || $(ln_s) ../images html/
+	$(cmd) rm -rf $(htmldir)/$*
+	$(cmd) $(mkdir_p) $(htmldir)/$*
+	$(cmd) test -h $(htmldir)/images || $(ln_s) ../images $(htmldir)/
 
 	$(cmd) $(XSLTPROC) \
 	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
 	  --xinclude \
 	  --stringparam l10n.gentext.default.language $* \
-	  -o html/$*/ \
+	  -o $(htmldir)/$*/ \
 	  stylesheets/plainhtml.xsl \
 	  $(xmlpodir)/$*/gimp.xml
 
 	$(cmd) for file in $(srcdir)/stylesheets/*.css; do \
-		if [ -f $$file ]; then cp -fp $$file html/$*; fi; \
+		if [ -f $$file ]; then cp -fp $$file $(htmldir)/$*; fi; \
 	done
 
 	$(cmd) for file in $(srcdir)/stylesheets/$*/*.css; do \
-		if [ -f $$file ]; then cp -fp $$file html/$*; fi; \
+		if [ -f $$file ]; then cp -fp $$file $(htmldir)/$*; fi; \
 	done
 
 # The xrefs file is a side effect of the HTML build
-html/%/gimp-xrefs.xml: html/%/index.html
+$(htmldir)/%/gimp-xrefs.xml: $(htmldir)/%/index.html
 	$(cmd) touch $@
 
 ####  Context Help  ####
 index: $(foreach lang,$(LANGUAGES),index-$(lang)) ;
-index-%: html/%/gimp-help.xml ;
+index-%: $(htmldir)/%/gimp-help.xml ;
 
-html/%/gimp-help.xml: html/%/gimp-xrefs.xml stylesheets/makeindex.xsl
+$(htmldir)/%/gimp-help.xml: $(htmldir)/%/gimp-xrefs.xml stylesheets/makeindex.xsl
 	$(cmd) $(XSLTPROC) \
 	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
 	  $(srcdir)/stylesheets/makeindex.xsl \
@@ -326,10 +335,101 @@
 	  > $@
 
 .PRECIOUS: \
-	html/%/index.html \
-	html/%/gimp-help.xml \
-	html/%/gimp-xrefs.xml
+	$(htmldir)/%/index.html \
+	$(htmldir)/%/gimp-help.xml \
+	$(htmldir)/%/gimp-xrefs.xml
+
+
+########################################################################
+####            HTML draft (single page preview)                    ####
+########################################################################
+
+%.draft: %.xml stylesheets/drafthtml.xsl
+	@echo "Making draft page(s), ignore any XSLT complaints:"
+	$(cmd) id=`sed -e 's/.*id=.//; tmatch; d; :match; s/["'"'"'].*//; q' $<`; \
+	test -n "$$id" || id=noname; \
+	langs="$(shell echo $@ | \
+	               sed -e 's,^$(xmldir)/.*,$(LANGUAGES),; t' \
+	                   -e 's,^$(xmlpodir)/\([^/]\+\)/.*,\1,')"; \
+	for lang in $${langs}; do \
+		destdir=$(htmldir)/$${lang}; \
+		test -d $${destdir} && continue || \
+		$(mkdir_p) $${destdir}; \
+		cp -fp $(srcdir)/stylesheets/*.css \
+		       $(srcdir)/stylesheets/$$lang/*.css \
+		    $${destdir} 2>/dev/null; \
+	done; \
+	\
+	for lang in $${langs}; do \
+		destdir=$(htmldir)/$${lang}; \
+		echo "Making $${destdir}/$${id}-draft.html ... "; \
+		xmlfile="$<"; xmlfile=$${xmlfile#*/}; \
+		xmlfile=$(xmlpodir)/$${lang}/$${xmlfile#$${lang}/}; \
+		$(XSLTPROC) \
+		    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+		    --xinclude \
+		    --stringparam l10n.gentext.default.language $$lang \
+		    --novalid \
+		    --output $${destdir}/$${id}-draft.html \
+		    $(srcdir)/stylesheets/drafthtml.xsl \
+		    $${xmlfile} \
+		; \
+	done && \
+	echo "(Remember that links won't work in a draft file.)"
+
+
+########################################################################
+####            Make PDF files:  XML --> PDF                        ####
+########################################################################
+
+ifneq ("$(DBLATEX)", "")
+
+pdf: $(foreach lang,$(LANGUAGES),pdf-$(lang))
+pdf-%: $(pdfdir)/%.pdf
+
+$(pdfdir)/%.pdf: $(xmlpodir)/%/gimp.xml stylesheets/plainprint.xsl
+	test -d $(pdfdir) || $(mkdir_p) $(pdfdir)
+	$(DBLATEX) $(DBLATEXFLAGS) \
+	    --xsl-user=$(srcdir)/stylesheets/plainprint.xsl \
+	    --output=$@ $<
+
+else
+
+pdf pdf-%:
+	@echo "*** Cannot build PDFs because dblatex(1) was not found ***"
+	@exit 69
+
+endif
+
+
+########################################################################
+####            Make ODF files:  XML --> ODF                        ####
+########################################################################
 
+ifneq ("$(DOCBOOK2ODF)","")
+
+odf: $(foreach lang,$(LANGUAGES),odf-$(lang)) ;
+odf-%: $(odfdir)/%.odt ;
+
+odf/%.odt: $(xmlpodir)/%/gimp-alldocs.xml
+	$(cmd) test -d $(odfdir) || $(mkdir_p) $(odfdir)
+	$(cmd) $(mkdir_p) odf
+	$(cmd) $(DOCBOOK2ODF) $(DOCBOOK2ODFFLAGS) \
+	    --debug -v \
+	    --output-dir=`pwd` \
+	    --output-file=$@ \
+	    $< 
+
+$(xmlpodir)/%/gimp-alldocs.xml: $(xmlpodir)/%/gimp.xml
+	$(XMLLINT) $(XMLLINTFLAGS) --xinclude --output $@ $<
+
+else
+
+odf odf-%:
+	@echo "*** Cannot build ODFs because docbook2odf(1) was not found ***"
+	@exit 69
+
+endif
 
 ########################################################################
 ####            AUTHORS                                             ####

Modified: branches/xml2po-support/Makefile.am
==============================================================================
--- branches/xml2po-support/Makefile.am	(original)
+++ branches/xml2po-support/Makefile.am	Wed Nov  5 20:37:28 2008
@@ -17,26 +17,31 @@
 PO_LANGS = $(filter-out $(XML_LANG), $(LANGUAGES))
 
 ## Essential external programs and their default options
-## (these variables are provided via "configure" -- see configure.ac)
+## (some of these variables are provided via "configure" -- see configure.ac)
 ##
 ## XSLTPROC  = xsltproc
 ## XSLTFLAGS = --nonet
 ##
 ## XMLLINT      = xmllint
-## XMLLINTFLAGS = --nonet -noout
+XMLLINTFLAGS = --nonet
 ##
 ## XML2PO = tools/xml2po
 ##
 ## MSGUNIQ       = msguniq 
-## MSGUNIQFLAGS  = 
+MSGUNIQFLAGS  = 
 ## MSGCAT        = msgcat 
-## MSGCATFLAGS   = --width=80 
+MSGCATFLAGS   = --width=80 
 ## MSGINIT       = msginit
 ## MSGINITFLAGS  = --no-translator
 ## MSGFMT        = msgfmt
 ## MSGFMTFLAGS   = --check --use-fuzzy --statistics
 ## MSGMERGE      = msgmerge
 ## MSGMERGEFLAGS = --quiet --backup=none --update
+##
+## DBLATEX       = dblatex
+DBLATEXFLAGS  =
+## DOCBOOK2ODF      = docbook2odf
+DOCBOOK2ODFFLAGS =
 
 # Standard shell commands
 echo_n = echo $(ECHO_N)
@@ -136,11 +141,15 @@
 DISTCHECK_CONFIGURE_FLAGS = --without-gimp
 
 # gimp-help directories
+## remember that automake defines "srcdir"
 helpdir  = $(gimpdatadir)/help
 xmldir   = src
-xmlpodir = xml
 potdir   = pot
 podir    = po
+xmlpodir = xml
+htmldir  = html
+pdfdir   = pdf
+odfdir   = odf
 
 
 ########################################################################
@@ -239,8 +248,14 @@
 #     $2 - PO file containing translations
 #     $3 - translation language
 #     $4 - resulting (translated) XML file
-po2xml  = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
-          | sed -e '/Warning: image file .* not found./d'
+if HAVE_XMLLINT
+po2xml = ($(XML2PO) --po-file=$(2) --language=$(3) --output='-' $(1) \
+         | $(XMLLINT) $(XMLLINTFLAGS) --format --output $(4) -) 2>&1 \
+         | sed -e '/Warning: image file .* not found./d'
+else
+po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
+         | sed -e '/Warning: image file .* not found./d'
+endif
 
 
 ########################################################################
@@ -316,14 +331,15 @@
 
 # Special case: en
 # HIDE FROM AUTOMAKE #en_XML_FILES = $(XML_FILES:$(xmldir)/%=$(xmlpodir)/en/%)
-$(en_XML_FILES): $(xmlpodir)/en
+# TODO: check this
+$(en_XML_FILES): $(xmlpodir)/en ;
 
 # TODO: make relative link rather than absolute link(?)
 $(xmlpodir)/en: $(XML_FILES)
 	$(cmd) src_dir=$$(cd $(srcdir)/$(xmldir) && pwd); \
-	poxml_dir=$(builddir)/$(xmlpodir); \
+	poxml_dir=$(xmlpodir); \
 	test -d $${poxml_dir} || $(mkdir_p) $${poxml_dir}; \
-	test -d $${poxml_dir}/en || $(ln_s) $${src_dir} $${poxml_dir}/en; \
+	test -d $${poxml_dir}/en || $(ln_s) $(abs_builddir)/$${src_dir} $${poxml_dir}/en; \
 	touch $@
 
 # Special case: en
@@ -335,16 +351,16 @@
 ########################################################################
 
 # Note that Automake already defines an "html" target
-html-local: $(foreach lang,$(ALL_LINGUAS),html-$(lang))
+html-local: $(foreach lang,$(ALL_LINGUAS),html-$(lang)) ;
 
-#html-%: index-% html/%/index.html ;
+# html-% -> index-% -> html/%/gimp-help.xml -> html/%/gimp-xrefs.xml -> html/%/index.html
 html-%: index-% ;
 
-html/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS)
+$(htmldir)/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS)
 	$(msg) "*** Making html for $* ... "
-	$(cmd) rm -rf html/$*
-	$(cmd) $(mkdir_p) html/$*
-	$(cmd) test -L html/images || $(ln_s) ../images html/
+	$(cmd) rm -rf $(htmldir)/$*
+	$(cmd) $(mkdir_p) $(htmldir)/$*
+	$(cmd) test -h $(htmldir)/images || $(ln_s) ../images $(htmldir)/
 
 	$(cmd) $(XSLTPROC) \
 	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
@@ -355,22 +371,22 @@
 	  $(xmlpodir)/$*/gimp.xml
 
 	$(cmd) for file in $(srcdir)/stylesheets/*.css; do \
-		if [ -f $$file ]; then cp -fp $$file html/$*; fi; \
+		if [ -f $$file ]; then cp -fp $$file $(htmldir)/$*; fi; \
 	done
 
 	$(cmd) for file in $(srcdir)/stylesheets/$*/*.css; do \
-		if [ -f $$file ]; then cp -fp $$file html/$*; fi; \
+		if [ -f $$file ]; then cp -fp $$file $(htmldir)/$*; fi; \
 	done
 
 # The xrefs file is a side effect of the HTML build
-html/%/gimp-xrefs.xml: html/%/index.html
+$(htmldir)/%/gimp-xrefs.xml: $(htmldir)/%/index.html
 	$(cmd) touch $@
 
 ####  Context Help  ####
 index: $(foreach lang,$(LANGUAGES),index-$(lang)) ;
-index-%: html/%/gimp-help.xml ;
+index-%: $(htmldir)/%/gimp-help.xml ;
 
-html/%/gimp-help.xml: html/%/gimp-xrefs.xml stylesheets/makeindex.xsl
+$(htmldir)/%/gimp-help.xml: $(htmldir)/%/gimp-xrefs.xml stylesheets/makeindex.xsl
 	$(cmd) $(XSLTPROC) \
 	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
 	  $(srcdir)/stylesheets/makeindex.xsl \
@@ -378,73 +394,67 @@
 	  > $@
 
 .PRECIOUS: \
-	html/%/index.html \
-	html/%/gimp-help.xml \
-	html/%/gimp-xrefs.xml
-
-
-## TODO ## #### XML profiling
-## TODO ## 
-## TODO ## # Note that "src/gimp.xml" must be the first prerequisite
-## TODO ## # (it doesn't matter that it's listed twice)
-## TODO ## xml/%.xml: src/gimp.xml stylesheets/profile.xsl $(XML_FILES)
-## TODO ## 	@$(mkdir_p) xml
-## TODO ## 
-## TODO ## 	@echo "Profiling  XML for:" $*
-## TODO ## 	@$(XSLTPROC) \
-## TODO ## 	  $(XSLTFLAGS) \
-## TODO ## 	  --xinclude \
-## TODO ## 	  --stringparam profile.lang $* \
-## TODO ## 	  $(top_srcdir)/stylesheets/profile.xsl \
-## TODO ## 	  $< \
-## TODO ## 	  > $  tmp
-## TODO ## 
-## TODO ## 	@sed -e 's/xmlns[:a-z]*="[^"]*" //' \
-## TODO ## 	    -e 's/lang="[A-Za-z_;]*"/lang="$*"/' \
-## TODO ## 	    -e '/^[ \t]*$$/d' \
-## TODO ## 	  < $  tmp \
-## TODO ## 	  > $@
-## TODO ## 
-## TODO ## 	@rm -f $  tmp
-## TODO ## 
-## TODO ## if HAVE_XMLLINT
-## TODO ## 	@$(XMLLINT) --noout $@
-## TODO ## endif
+	$(htmldir)/%/index.html \
+	$(htmldir)/%/gimp-help.xml \
+	$(htmldir)/%/gimp-xrefs.xml
 
-## TODO ## #### PDF output
 
+########################################################################
+####            Make PDF files:  XML --> PDF                        ####
+########################################################################
 if HAVE_DBLATEX
 
-## TODO ## pdf/%.pdf: xml/%.xml stylesheets/plainprint.xsl
-## TODO ## 	$(mkdir_p) pdf
-## TODO ## 	dblatex -p $(top_srcdir)/stylesheets/plainprint.xsl $< -o $@
-## TODO ## 
-## TODO ## # Note that Automake already defines a "pdf" target
-## TODO ## pdf-local: $(foreach lang,$(ALL_LINGUAS),pdf/$(lang).pdf)
+## Note that Automake already defines a "pdf" target
+pdf-local: $(foreach lang,$(ALL_LINGUAS),pdf-$(lang)) ;
+pdf-%: $(pdfdir)/%.pdf ;
+
+$(pdfdir)/%.pdf: $(xmlpodir)/%/gimp.xml stylesheets/plainprint.xsl
+	test -d $(pdfdir) || $(mkdir_p) $(pdfdir)
+	$(DBLATEX) $(DBLATEXFLAGS) \
+	    --xsl-user=$(srcdir)/stylesheets/plainprint.xsl \
+	    --output=$@ $<
 
 else
 
-## TODO ## pdf-local:
-## TODO ## 	@echo "*** Cannot build PDFs because dblatex(1) was not found ***"
-## TODO ## 	@false
+pdf-local pdf-%:
+	@echo "*** Cannot build PDFs because dblatex(1) was not found ***"
+	@exit 69
 
 endif
 
-## TODO ## #### ODF output
 
+########################################################################
+####            Make ODF files:  XML --> ODF                        ####
+########################################################################
 if HAVE_DOCBOOK2ODF
 
-## TODO ## odf/%.odt: xml/%.xml
-## TODO ## 	$(mkdir_p) odf
-## TODO ## 	$(DOCBOOK2ODF) --debug -v $< --output-dir=`pwd` --output-file=$@
+odf: $(foreach lang,$(ALL_LINGUAS),odf-$(lang)) ;
+odf-%: $(odfdir)/%.odt ;
+
+$(odfdir)/%.odt: $(xmlpodir)/%/gimp-alldocs.xml
+	$(cmd) test -d $(odfdir) || $(mkdir_p) $(odfdir)
+	$(cmd) $(mkdir_p) odf
+	$(cmd) $(DOCBOOK2ODF) $(DOCBOOK2ODFFLAGS) \
+	    --debug -v \
+	    --output-dir=`pwd` \
+	    --output-file=$@ \
+	    $< 
 
-## TODO ## odf: $(foreach lang,$(ALL_LINGUAS),odf/$(lang).odt)
+if HAVE_XMLLINT
+$(xmlpodir)/%/gimp-alldocs.xml: $(xmlpodir)/%/gimp.xml
+	$(XMLLINT) $(XMLLINTFLAGS) --xinclude --output $@ $<
+else
+$(xmlpodir)/%/gimp-alldocs.xml: $(xmlpodir)/%/gimp.xml
+	@echo "*** WARNING: Cannot resolve xincludes ***"; \
+	echo  "*** because xmllint(1) was not found. ***"; \
+	cp -v $< $@
+endif
 
 else
 
-## TODO ## odf:
-## TODO ## 	@echo "*** Cannot build ODFs because docbook2odf(1) was not found ***"
-## TODO ## 	@false
+odf odf-%:
+	@echo "*** Cannot build ODFs because docbook2odf(1) was not found ***"
+	@exit 69
 
 endif
 
@@ -463,48 +473,42 @@
 ## TODO OR NOT TODO ## 	cd preview-$* && $(LN_S) ../html/$* .
 ## TODO OR NOT TODO ## 	cd preview-$* && $(LN_S) $(abs_top_srcdir)/images .
 
-## TODO ## #### HTML draft (single page preview)
+########################################################################
+####            HTML draft (single page preview)                    ####
+########################################################################
 
-## TODO ## %.draft: %.xml
-## TODO ## 	@echo "Making draft page (ignore any XSLT complaints):"
-## TODO ## 	@for lang in $(ALL_LINGUAS); do \
-## TODO ## 		test -d $(builddir)/html/$$lang && continue || \
-## TODO ## 		$(mkdir_p) $(builddir)/html/$$lang; \
-## TODO ## 		cp -fp $(srcdir)/stylesheets/*.css $(builddir)/html/$$lang; \
-## TODO ## 		for file in $(srcdir)/stylesheets/$$lang/*.css; do \
-## TODO ## 			test -f $$file || continue; \
-## TODO ## 			cp -fp $$file $(builddir)/html/$$lang/; \
-## TODO ## 		done; \
-## TODO ## 	done
-## TODO ## 
-## TODO ## 	@id=`sed -e 's/.*id=.//; tmatch; d; :match; s/["'"'"'].*//; q' $<`; \
-## TODO ## 	test -n "$$id" || id=noname; \
-## TODO ## 	for lang in $(ALL_LINGUAS); do \
-## TODO ## 		echo "Making $(builddir)/html/$$lang/$${id}-draft.html ... "; \
-## TODO ## 		$(XSLTPROC) \
-## TODO ## 		    $(XSLTFLAGS) \
-## TODO ## 		    $(XSLTEXTRAFLAGS) \
-## TODO ## 		    --xinclude \
-## TODO ## 		    --stringparam profile.lang $$lang \
-## TODO ## 		    --novalid \
-## TODO ## 		    $(srcdir)/stylesheets/profile.xsl \
-## TODO ## 		    $< \
-## TODO ## 		| \
-## TODO ## 		sed -e 's/xmlns[:a-z]*="[^"]*" //' \
-## TODO ## 		    -e 's/lang="[A-Za-z_;]*"/lang="'$$lang'"/' \
-## TODO ## 		    -e '/^[ \t]*$$/d' \
-## TODO ## 		| \
-## TODO ## 		$(XSLTPROC) \
-## TODO ## 		    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
-## TODO ## 		    --xinclude \
-## TODO ## 		    --stringparam l10n.gentext.default.language $* \
-## TODO ## 		    --novalid \
-## TODO ## 		    --output $(builddir)/html/$$lang/$${id}-draft.html \
-## TODO ## 		    $(srcdir)/stylesheets/drafthtml.xsl \
-## TODO ## 		    - \
-## TODO ## 		; \
-## TODO ## 	done && \
-## TODO ## 	echo "(Remember that links won't work in a draft file.)"
+%.draft: %.xml stylesheets/drafthtml.xsl
+	@echo "Making draft page(s), ignore any XSLT complaints:"
+	$(cmd) id=`sed -e 's/.*id=.//; tmatch; d; :match; s/["'"'"'].*//; q' $<`; \
+	test -n "$$id" || id=noname; \
+	langs="$(shell echo $@ | \
+	               sed -e 's,^$(xmldir)/.*,$(LANGUAGES),; t' \
+	                   -e 's,^$(xmlpodir)/\([^/]\+\)/.*,\1,')"; \
+	for lang in $${langs}; do \
+		destdir=$(htmldir)/$${lang}; \
+		test -d $${destdir} && continue || \
+		$(mkdir_p) $${destdir}; \
+		cp -fp $(srcdir)/stylesheets/*.css \
+		       $(srcdir)/stylesheets/$$lang/*.css \
+		    $${destdir} 2>/dev/null; \
+	done; \
+	\
+	for lang in $${langs}; do \
+		destdir=$(htmldir)/$${lang}; \
+		echo "Making $${destdir}/$${id}-draft.html ... "; \
+		xmlfile="$<"; xmlfile=$${xmlfile#*/}; \
+		xmlfile=$(xmlpodir)/$${lang}/$${xmlfile#$${lang}/}; \
+		$(XSLTPROC) \
+		    $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+		    --xinclude \
+		    --stringparam l10n.gentext.default.language $$lang \
+		    --novalid \
+		    --output $${destdir}/$${id}-draft.html \
+		    $(srcdir)/stylesheets/drafthtml.xsl \
+		    $${xmlfile} \
+		; \
+	done && \
+	echo "(Remember that links won't work in a draft file.)"
 
 
 ########################################################################

Modified: branches/xml2po-support/tools/migrate.sh
==============================================================================
--- branches/xml2po-support/tools/migrate.sh	(original)
+++ branches/xml2po-support/tools/migrate.sh	Wed Nov  5 20:37:28 2008
@@ -2,9 +2,8 @@
 # this script migrates the content from DocBook XML files to PO/GETTEXT
 # supported XML files ??!?!
 
-# XXX: what about fi?
-#LINGUAS="de en es fr it ko nl no pl ru sv"
-: ${LINGUAS:="de fr"}
+# XXX: what about fi, hr?
+: ${LINGUAS:="de es fr it ko nl no pl ru sv"}
 
 : ${srcdir:=src}
 : ${oldsrcdir:=oldsrc}
@@ -21,17 +20,31 @@
 
 # clean-up
 if [ -d "$oldsrcdir" ]; then
-    echo >&2 Removing $srcdir, $potdir, $podir, $xmldir ...
+    echo Removing $srcdir, $potdir, $podir, $xmldir ...
     test -L $xmldir/en && rm $xmldir/en
     test -d $srcdir && rm -rf $srcdir
     test -d $potdir && rm -rf $potdir
     test -d $podir  && rm -rf $podir
     test -d $xmldir && rm -rf $xmldir
+    test -e $oldsrcdir/preface/authors.xml && \
+        rm -f $oldsrcdir/preface/authors.xml
     mv $oldsrcdir $srcdir
 fi
 
-echo >&2 "Splitting the source XML"
-echo >&2 "Warning: the following files and directories will be skipped:"
+if [ -e $srcdir/preface/titles.xml ] &&
+   [ -e stylesheets/authors_docbook.xsl ] &&
+   [ -e stylesheets/authors.xml ]; then
+    echo "Creating src/preface/authors.xml:"
+    echo xsltproc --nonet \
+        --output $srcdir/preface/authors.xml \
+        stylesheets/authors_docbook.xsl \
+        stylesheets/authors.xml
+else
+    echo >&2 "ERROR: Cannot make $srcdir/preface/authors.xml"
+fi
+
+echo "Splitting the source XML:"
+echo "Warning: the following files and directories will be skipped:"
 echo "$exclude_patterns" | sed -e 's/ /, /g; s/^/    /' >&2
 time \
 eval find $srcdir $exclude -o -name '*.xml' -print |
@@ -42,17 +55,34 @@
     $SPLIT --lang="$LINGUAS" --file="$srcfile" \
            --dest="$xmldir"/'*'/"${base#/}"/
 done
+test -e $srcdir/preface/authors.xml && rm -f $srcdir/preface/authors.xml
 echo
 
-echo >&2 Moving $srcdir and $xmldir ...
+echo Saving source directory ...
 mv -vi "$srcdir" "$oldsrcdir" && \
 mv -vi "$xmldir"/en "$srcdir" && \
-echo >&2 Creating "$xmldir"/en link to "$srcdir" ...
+echo Creating link "$xmldir"/en ...
 ln -vs $PWD/"$srcdir" "$xmldir"/en
 echo
 
 test "$1" = "split" && exit 0
 
+echo "Reformatting English XML files:"
+find $srcdir/ -type f -name '*.xml' |
+while read xmlfile; do
+    xmllint --nonet --format --output ${xmlfile%.xml}.xmllint $xmlfile
+    if test -s ${xmlfile%.xml}.xmllint && \
+       mv -f ${xmlfile%.xml}.xmllint $xmlfile
+    then
+        echo $xmlfile
+    else
+        echo "ERROR $xmlfile"
+    fi
+done
+echo
+
+test "$1" = "xmllint" && exit 0
+
 echo "Creating POT files"
 time \
 find $srcdir -name '*.xml' |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]