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



Author: ulfehlert
Date: Sat Oct 18 11:59:23 2008
New Revision: 2584
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2584&view=rev

Log:
2008-10-18  Ulf-D. Ehlert  <ulfehlert svn gnome org>

	* tools/split_xml_multi_lang.py: fixed indexterm processing;
	fixed procedure processing

	* Makefile.am
	* tools/build-system.dot: updated

	* Makefile: renamed to...
	* Makefile.GNU: ... and updated; this Makefile may eventually
	become the base of an autotools-independent build system


Added:
   branches/xml2po-support/Makefile.GNU   (contents, props changed)
      - copied, changed from r2583, /branches/xml2po-support/Makefile
Removed:
   branches/xml2po-support/Makefile
Modified:
   branches/xml2po-support/ChangeLog
   branches/xml2po-support/Makefile.am
   branches/xml2po-support/tools/build-system.dot
   branches/xml2po-support/tools/split_xml_multi_lang.py

Copied: branches/xml2po-support/Makefile.GNU (from r2583, /branches/xml2po-support/Makefile)
==============================================================================
--- /branches/xml2po-support/Makefile	(original)
+++ branches/xml2po-support/Makefile.GNU	Sat Oct 18 11:59:23 2008
@@ -74,6 +74,10 @@
 # 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
+#
+AUTHORS_STYLESHEET_XML = stylesheets/authors.xml
 
 # To talk or not to talk, that is the question!
 VERBOSE ?= 1
@@ -163,7 +167,6 @@
 validate: ;
 html: ;
 #index: ;
-AUTHORS: ;
 
 all: validate html index AUTHORS
 
@@ -254,22 +257,21 @@
 
 # Special case: en
 en_XML_FILES = $(XML_FILES:$(xmldir)/%=$(xmlpodir)/en/%)
-$(en_XML_FILES): xmldir-en
+$(en_XML_FILES): $(xmlpodir)/en
 
-xmldir-en: $(xmlpodir)/en ;
 # TODO: make relative link rather than absolute link(?)
 $(xmlpodir)/en: $(XML_FILES)
-	$(cmd) target_dir=$$(cd $(srcdir)/$(xmldir) && pwd); \
-	link_dir=$(builddir)/$(xmlpodir); \
-	test -d $${link_dir} || $(fake) $(mkdir_p) $${link_dir}; \
-	test -d $${link_dir}/en || $(fake) $(ln_s) $${target_dir} $${link_dir}/en; \
+	$(cmd) src_dir=$$(cd $(srcdir)/$(xmldir) && pwd); \
+	poxml_dir=$(builddir)/$(xmlpodir); \
+	test -d $${poxml_dir} || $(fake) $(mkdir_p) $${poxml_dir}; \
+	test -d $${poxml_dir}/en || $(fake) $(ln_s) $${src_dir} $${poxml_dir}/en; \
 	touch $@
 
 
 # Targets suitable for command line
 
 # Special case: en
-xml-en: xmldir-en
+xml-en: $(xmlpodir)/en ;
 
 # Debugging
 list-xmlfiles-en list-xml-files-en list-xml-en:
@@ -280,7 +282,8 @@
 ####            Make HTML files:  XML --> HTML                      ####
 ########################################################################
 
-html-%: po-% index-% html/%/index.html ;
+#html-%: index-% html/%/index.html ;
+html-%: index-% ;
 
 html/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS)
 	$(msg) "*** Making html for $* ... "
@@ -329,6 +332,27 @@
 
 
 ########################################################################
+####            AUTHORS                                             ####
+########################################################################
+
+AUTHORS: $(AUTHORS_STYLESHEET_XML) stylesheets/authors_text.xsl $(AUTHORS_DOCBOOK_XML)
+	$(msg) "**** Making $@ ... "
+	$(cmd) $(XSLTPROC) \
+	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+	  $(srcdir)/stylesheets/authors_text.xsl \
+	  $< \
+	  > $@
+	
+$(AUTHORS_DOCBOOK_XML): $(AUTHORS_STYLESHEET_XML) src/preface/titles.xml stylesheets/authors_*.xsl
+	$(msg) "**** Making $@ ... "
+	$(cmd) $(XSLTPROC) \
+	  $(XSLTFLAGS) $(XSLTEXTRAFLAGS) \
+	  $(srcdir)/stylesheets/authors_docbook.xsl \
+	  $< \
+	  > $@
+
+
+########################################################################
 ####            Debugging etc.                                      ####
 ########################################################################
 
@@ -338,7 +362,7 @@
 list-potfiles list-pot-files list-pot:
 	@echo $(POT_FILES)
 
-build-system.png: build-system.dot
+build-system.png: tools/build-system.dot
 	@if type dot >/dev/null; then \
 		dot -Tpng -o $@ $<; \
 	fi
@@ -353,60 +377,3 @@
 	fi
 
 
-########################################################################
-####     Miscellaneous stuff, to be removed...                      ####
-########################################################################
-
-# Clone a directory tree
-#     $1 - location of destination directory tree
-#     $2 - list of source directories [XXX: drop this in favour of $(XML_DIRS)?]
-#clone_dirtree = for sourcedir in $(2); do \
-#                    test "$${sourcedir}" != "." || sourcedir="" ; \
-#                    sourcedir=$${sourcedir\#./}; \
-#                    destdir=$(builddir)/$(1)/$${sourcedir}; \
-#                    test -d $${destdir} || $(fake) $(mkdir_p) $${destdir}; \
-#                done
-
-# Get the XML files (prerequisites) for the HTML target
-#     $1 - locale (en, de, es, fr, ...)
-# Returns
-#     $(XML_FILES)             if $1 is 'en', 
-#     translated $(XML_FILES)  otherwise
-#xml_po_files = $(if $(findstring en,$(1)),$(XML_FILES),$(subst $(xmldir),$(xmlpodir)/$(1),$(XML_FILES)))
-#xml_po_files = $(subst $(xmldir),$(xmlpodir)/$(1),$(XML_FILES))
-
-# XXX: do we need this?
-# Special case 'en'
-#htmldir-en: $(xmldir)
-#
-#htmldir-%: xmldir-%
-#	$(msg) "Making $@"
-#	$(cmd) $(call clone_dirtree,html/$*,$(DIR_TREE))
-
-# XXX: I'm not sure if the following rule (using a function) works -
-# it seems to depend on the function...
-#html/%/index.html: $(call xml_po_files,%) $(HTML_STYLESHEETS)
-
-#html/en/index.html: $(call xml_po_files,en) $(HTML_STYLESHEETS)
-#html/en/index.html: $(XML_FILES) $(HTML_STYLESHEETS)
-
-# XXX: do we need this?
-#xmldir-%: podir-%
-#	$(msg) "Making $(xmlpodir)/$* directories"
-#	$(cmd) $(call clone_dirtree,$(xmlpodir)/$*,$(DIR_TREE))
-
-
-# XXX: do we need this?
-#podir-%: $(POT_DIRS)
-#	$(msg) "Making po directories ($*)"
-#	$(cmd) $(call clone_dirtree,$(podir)/$*,$(DIR_TREE))
-
-# XXX: do we need this?
-#podir-en:
-#	@echo >&2 "Skipped making po directory for 'en'."
-
-# XXX: do we need this?
-#potdir: $(POT_DIRS)
-#	$(msg) "Making pot directories ($(potdir))... "
-#	$(cmd)$(call clone_dirtree,$(potdir),$(DIR_TREE))
-

Modified: branches/xml2po-support/Makefile.am
==============================================================================
--- branches/xml2po-support/Makefile.am	(original)
+++ branches/xml2po-support/Makefile.am	Sat Oct 18 11:59:23 2008
@@ -413,7 +413,7 @@
 
 build-system.png: tools/build-system.dot
 	@$(DOT) -Tpng -o $@ $<; \
-	echo "build-system.png created."
+	echo "$@ created."
 
 dot: build-system.png
 

Modified: branches/xml2po-support/tools/build-system.dot
==============================================================================
--- branches/xml2po-support/tools/build-system.dot	(original)
+++ branches/xml2po-support/tools/build-system.dot	Sat Oct 18 11:59:23 2008
@@ -5,17 +5,20 @@
         - circle    main targets
         - ellipse   lang-dependent or auxiliary targets
         - box       file or directory targets
+        - polygon   file list
         - hexagon   TODO etc.
     Colors:
-        - blue      default, language-independent
-        - green     language-dependent
+        - blue      PO & POT
+        - green     XML
+        - yellow    HTML
+        - grey      minor targets etc.
         - red       TODO
-        - grey      TODO, ignore, etc.
 */
-digraph gimp {
+
+digraph gimp_build_system {
     node[shape=box];
 
-    all[label="all" color=blue shape="circle"]
+    all[label="all" color=blue shape="circle"];
 
     all -> validate[label="?"];
     all -> html;
@@ -23,83 +26,96 @@
     all -> authors;
 
     /* do_nothing[label="do nothing" color=grey shape=hexagon] */
-    todo[label="TODO" color=red shape=hexagon]
+    /* todo[label="TODO" color=red shape=hexagon] */
 
-    /* $(POT_FILES): $(potdir)/%.pot : $(xmldir)/%.xml */
+    node[shape=circle];
+    pot[label="pot"];
+    po[shape=circle];
 
-    src_files[label="src/*.xml" color=blue ]
-    pot_files[label="pot/*.pot" color=blue]
-    po_files[label="po/LANG/*.po" color=green]
-    node[shape=ellipse];
-    xml[label="xml" color=blue]
-    pot[label="pot" color=blue]
-
-    pot -> pot_files -> src_files
-    
-    /* XX_PO_FILES = $(patsubst $(potdir)/%.pot, $(podir)/XX/%.po, $(POT_FILES)) */
-
-    po[color=green shape=ellipse]
-    po_lang[label="po-LANG" color=green]
-    po -> po_lang[label="TODO" color=red]
-    po_lang -> po_files -> pot_files
-    /* po_en[label="po-en" color=grey] */
-    /* po_en -> do_nothing */
-
-    /* XX_XML_FILES = $(XML_FILES:$(xmldir)/%=$(xmlpodir)/$(1)/%)
-       $(XX_XML_FILES): $(xmlpodir)/XX/%.xml : $(podir)/XX/%.po */
-
-    xml[label="xml" color=blue shape=circle]
-    xml_files[label="xml/LANG/*.xml" color=green shape=box]
-    xml_dir[label="xml/LANG" color=green shape=box]
-    xml_dir_en[label="xml/en" color=green shape=box]
-    xml_lang[label="xml-LANG" color=green]
-    xml_en[label="xml-en" color=green shape=ellipse]
-
-    xml_dir -> xml_files -> po_files
-    xml_lang -> xml_files
-    xml_en -> xml_dir_en
-    xml_dir_en -> xml_files[label="link" color="grey"]
-
-    /* html-%: po-% index-% html/%/index.html */
-    /* html/%/index.html: $(xmlpodir)/% $(HTML_STYLESHEETS) */
-
-    /* html/%/gimp-xrefs.xml: html/%/index.html */
-
-    html_lang[label="html-LANG" color=green shape=ellipse]
-    html_main[label="html/LANG/index.html" color=green shape=box]
-    index_lang[label="index-LANG" color=green shape=ellipse]
-    xrefs_lang[label="html/LANG/gimp-xrefs.html" shape="box" color="green"] 
-    
-    html_lang -> po_lang
-    html_lang -> index_lang
-    html_lang -> html_main -> xml_dir
-    xrefs_lang -> html_main
+    po -> po_lang[label="TODO" color=red];
+    pot -> pot_files;
 
-    /* index: $(foreach lang,$(LANGUAGES),index-$(lang)) */
-    /* index-%: html/%/gimp-help.xml */
+    subgraph cluster_po {
+        color="blue";
+    
+        src_files[label="SRC FILES\n----\nsrc/*.xml" color=cyan shape=polygon side=4 skew=.5];
+        pot_files[label="POT FILES\n----\npot/LANG/*.pot" color=cyan shape=polygon side=4 skew=.5];
+        po_files[label="PO FILES\n----\npo/LANG/*.po" color=cyan shape=polygon side=4 skew=.5];
+    
+        pot_files -> src_files;
+        
+        node[shape=ellipse];
+        po_lang[label="po-LANG" color=grey shape=ellipse];
+        po_lang -> po_files -> pot_files;
+        /* po_en[label="po-en" color=grey] */
+        /* po_en -> do_nothing */
+    
+    } /* subgraph cluster_po */
 
-    /* html/%/gimp-help.xml: html/%/gimp-xrefs.xml stylesheets/makeindex.xsl */
+    subgraph cluster_authors {
+        color="grey";
 
-    index[color=grey shape=ellipse]
-    index_lang[label="index-LANG" color=green shape=ellipse]
-    help_lang[label="html/LANG/gimp-help.xml" color=green shape=box]
+        authors[label="AUTHORS" color=grey shape=box]
+        authors_xml[label="stylesheets/\nauthors.xml" color=grey shape=box]
+        authors -> authors_xml[color=grey]
+    } /* subgraph cluster_authors */
+
+
+    xml[label="xml" shape=circle];
+
+    subgraph cluster_xml {
+        color="green";
+    
+        xml_files[label="xml/LANG/*.xml" shape=box];
+        xml_dir[label="xml/LANG" shape=box]
+        xml_lang[label="xml-LANG" color=grey shape=ellipse]
+        /* xml_en[label="xml-en" color=green shape=ellipse] */
+    
+        xml_dir -> xml_files -> po_files
+        xml_lang -> xml_files
+        /* xml_en -> src_files[label="link" color="grey"] */
+
+    } /* subgraph cluster_xml */
 
+    html[color=blue shape=circle]
+    index[color=grey shape=ellipse]
     index -> index_lang[color=grey label="?"]
-    index_lang -> help_lang -> xrefs_lang
+
+    subgraph cluster_html {
+        color="yellow";
+    
+        html_lang[label="html-LANG" color=grey shape=ellipse]
+        html_main[label="html/LANG/index.html" shape=box]
+        index_lang[label="index-LANG" color=grey shape=ellipse]
+        xrefs_lang[label="html/LANG/gimp-xrefs.html" shape=box] 
+        help_lang[label="html/LANG/gimp-help.xml" shape=box]
+    
+        
+        /* html_lang -> po_lang */
+        html_lang -> index_lang
+        html_lang -> html_main[style=dashed color=grey label=" ?"]
+        html_main -> xml_dir[label=" stamp"]
+        xrefs_lang -> html_main
+    
+        index_lang -> help_lang -> xrefs_lang
+
+    } /* subgraph cluster_html */
+
 
     /* TODO */
 
-    html[shape=circle]
     xml[shape=circle]
-    check[color=blue shape=ellipse]
-    validate[color=blue shape=ellipse]
-    authors[label="AUTHORS" color=blue shape=box]
+    checks[color=blue shape=ellipse]
+    check1[label="check [...]" color=grey shape=ellipse]
+    validate[color=grey shape=ellipse]
+    xmllint[color=grey shape=ellipse]
 
     xml ->  xml_lang[label="TODO" color=red]
-    xml ->  xml_en[color=grey]
-    xml ->  po[color=grey label="TODO?"]
+    /* xml ->  xml_en[color=grey] */
+    xml ->  po[style=dashed color=grey label=" ?"]
     html -> html_lang[label="TODO" color=red]
-    authors -> todo
-    check -> validate -> todo
-}
+    checks -> validate[color=grey style=dashed label=" ?"]
+    checks -> check1[color=grey label=" TODO"]
+    validate -> xmllint[color=red style=dashed label=" TODO"]
 
+} /* digraph gimp_build_system */

Modified: branches/xml2po-support/tools/split_xml_multi_lang.py
==============================================================================
--- branches/xml2po-support/tools/split_xml_multi_lang.py	(original)
+++ branches/xml2po-support/tools/split_xml_multi_lang.py	Sat Oct 18 11:59:23 2008
@@ -50,7 +50,7 @@
               'bookinfo', 'appendixinfo')
 notes      = ('warning', 'caution', 'important', 'tip', 'note')
 containers = ('figure', 'caption', 'revhistory', 'formalpara', 'equation',
-              'informalequation', 'informalfigure', 'example')
+              'informalequation', 'informalfigure', 'example', 'indexterm')
 # XXX: making 'inlinemediaobject' "final" should also work
 nobjects   = ('textobject', 'mediaobject', 'screenshot', 'inlinemediaobject')
 lists      = ('itemizedlist', 'orderedlist', 'variablelist',
@@ -61,8 +61,8 @@
 
 # these tags are considered FINAL
 paras      = ('para', 'simpara', 'programlisting', 'blockquote')
-leafs      = ('phrase', 'revision', 'indexterm', 'graphic', 'alt', 'seg',
-              'anchor')
+leafs      = ('phrase', 'revision', 'graphic', 'alt', 'seg',
+              'anchor', 'primary', 'secondary', 'tertiary')
 fobjects   = ('imageobject',)
 fgui       = ('guiicon', 'guimenuitem')
 keys       = ('keycap', 'keycombo')
@@ -359,7 +359,7 @@
                 if len(nodes) == len(self.languages):
                     return nodes
 
-            for lang in (k for k in self.languages if not nodes.has_key(k)):
+            for lang in (k for k in self.languages if not k in nodes):
                 nodes[lang] = elem
             assert len(nodes) == len(self.languages)
 
@@ -482,10 +482,14 @@
         elif name in text_final_nodes:
             return self.has_nonempty_text(node)
         elif name in ('procedure', 'step'):
-            return self.get_langs(node) == 1
+            return len(self.get_langs(node)) == 1
         else:
-            self.logger.warn("don't know what to do with '%s', assuming final" % name)
-            return True
+            _final = self.has_nonempty_text(node)
+            if _final:
+                self.logger.warn("considered '%s' to be final" % name)
+            else:
+                self.logger.warn("considered '%s' to be not final" % name)
+            return _final
 
 
     def ignore(self, node):
@@ -555,7 +559,7 @@
     # parse command line
 
     usage = "usage: %prog [options] [FILE [DIR]]"
-    version = "%prog 0.6 2008-10-08"
+    version = "%prog 0.7 2008-10-18"
     cmdline = optparse.OptionParser(usage=usage, version=version)
 
     cmdline.set_defaults(languages= ",".join(languages))
@@ -622,7 +626,7 @@
 if __name__ == '__main__':
     if "--profile" in sys.argv:
         profile.run("main()")
-    if "--test" in sys.argv:
+    elif "--test" in sys.argv:
         runtests()
     else:
         main()



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