]> git.lyx.org Git - features.git/commitdiff
generate TOC files on the fly and fix broken documents (bug 2027)
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 28 Sep 2005 13:47:03 +0000 (13:47 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 28 Sep 2005 13:47:03 +0000 (13:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10491 a592a061-630c-0410-9148-cb99ea01b6c8

lib/doc/ChangeLog
lib/doc/Makefile.am
lib/doc/de_UserGuide.lyx
lib/doc/depend.py
lib/doc/doc_toc.py
lib/doc/it_UserGuide.lyx

index 1b7378a6190ac15cd7c966c57c2d184835b29418..78f0594843cb1b86adc4b36f90bf9bdfc556478e 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-28  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * de_UserGuide.lyx, it_UserGuide.lyx: repair invalid syntax, maybe
+       caused by a lyx2lyx bug
+       * Makefile.am: generate TOC files automatically
+       * Makefile.am: rework TOC generation rules to work with srcdir != builddir
+       * depend.py: make it work with srcdir != builddir
+       * depend.py: adjust generated TOCs rule to Makefile.am changes
+       * doc_toc.py: make it work with srcdir != builddir
+
 2005-09-28  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * UserGuide.lyx: 
index 93daa4ff6804a66e1e1cb02bec8971ea7519f56a..cff57aee81527648a54ccd360d4a1767b69916de 100644 (file)
@@ -1,31 +1,26 @@
 include $(top_srcdir)/config/common.am
 
-DISTCLEANFILES += LyXConfig.lyx LaTeXConfig.lyx Makefile.depend
+DISTCLEANFILES += LyXConfig.lyx LaTeXConfig.lyx $(TOCs)
 
-EXTRA_DIST = depend.py doc_toc.py LyXConfig.lyx.in README.Documentation $(docfiles)
+EXTRA_DIST = depend.py doc_toc.py LyXConfig.lyx.in README.Documentation $(DEPENDFILE) $(docfiles)
 
-docfiles = \
-       cs_TOC.lyx \
+docfiles = $(TOCs) \
        cs_Tutorial.lyx \
        Customization.lyx \
        da_Intro.lyx \
-       da_TOC.lyx \
        de_Customization.lyx \
        de_Extended.lyx \
        de_FAQ.lyx \
        de_Intro.lyx \
-       de_TOC.lyx \
        de_Tutorial.lyx \
        de_UserGuide.lyx \
        DocStyle.lyx \
        es_Intro.lyx \
-       es_TOC.lyx \
        es_Tutorial.lyx \
        eu_Customization.lyx \
        eu_Extended.lyx \
        eu_FAQ.lyx \
        eu_Intro.lyx \
-       eu_TOC.lyx \
        eu_Tutorial.lyx \
        eu_UserGuide.lyx \
        Extended.lyx \
@@ -34,50 +29,36 @@ docfiles = \
        fr_Extended.lyx \
        fr_FAQ.lyx \
        fr_Intro.lyx \
-       fr_TOC.lyx \
        fr_Tutorial.lyx \
        fr_UserGuide.lyx \
        he_Intro.lyx \
-       he_TOC.lyx \
        he_Tutorial.lyx \
        hu_Intro.lyx \
-       hu_TOC.lyx \
        Intro.lyx \
        it_Customization.lyx \
        it_Intro.lyx \
-       it_TOC.lyx \
        it_Tutorial.lyx \
        it_UserGuide.lyx \
        LaTeXConfig.lyx.in \
        nl_Intro.lyx \
-       nl_TOC.lyx \
        nl_Tutorial.lyx \
        no_Intro.lyx \
-       no_TOC.lyx \
        pl_Extended.lyx \
        pl_Intro.lyx \
-       pl_TOC.lyx \
        pl_Tutorial.lyx \
        pt_Intro.lyx \
-       pt_TOC.lyx \
        pt_Tutorial.lyx \
        Reference.lyx \
        ro_Intro.lyx \
-       ro_TOC.lyx \
        ru_FAQ.lyx \
        ru_Intro.lyx \
-       ru_TOC.lyx \
        ru_Tutorial.lyx \
-       sk_TOC.lyx \
        sk_Tutorial.lyx \
        sk_UserGuide.lyx \
        sl_Intro.lyx \
-       sl_TOC.lyx \
        sl_Tutorial.lyx \
        sv_Intro.lyx \
-       sv_TOC.lyx \
        sv_Tutorial.lyx \
-       TOC.lyx \
        Tutorial.lyx \
        UserGuide.lyx \
        escher-lsd.eps \
@@ -89,16 +70,18 @@ doc_DATA = \
        $(docfiles) \
        LaTeXConfig.lyx
 
-# TODO can we instead just #include the DEPENDFILE in this Makefile?
-# problem with this is that the DEPENDFILE that's included won't be the updated
-# one. JMarc should know how to handle this.
-
 DEPENDFILE = Makefile.depend
+include $(DEPENDFILE)
+
+TOCs : $(DEPENDFILE) $(TOCs)
+       @echo Made TOCs succesfully.
 
-TOCs : depend
-       make -f $(DEPENDFILE) TOCs
+# Force regeneration of $(DEPENDFILE) when Makefile.am changes because
+# new doc files might have been added
+$(DEPENDFILE): Makefile.am
+       python $(srcdir)/depend.py > $(DEPENDFILE)
 
-depend:
-       python depend.py > $(DEPENDFILE)
+# Force generation of the TOC files for 'make dist'
+distdir: TOCs
 
-.PHONY: depend
+.PHONY: TOCs
index 1bbcf72c67b4a43f5ff2139d32be3a586d25c68f..8807f73e0f28a78a094364d38a29a20b21683981 100644 (file)
@@ -10653,8 +10653,6 @@ Umschalt+Alt\InsetSpace ~
 \end_layout
 
 \begin_deeper
-\end_layout
-
 \begin_deeper
 \begin_layout Standard
 
index 8fdb70c3de718381492f071c666b920752e68f5c..d3b33400833546972c98fc212899e3ec9ad43646 100644 (file)
@@ -31,12 +31,14 @@ from glob import glob
 possible_documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "Extended", "Customization")
 lang_pattern = re.compile('^([a-z]{2})_')
 
-def documents(prefix):
+def documents(srcdir, prefix):
     result = []
     for file in possible_documents:
-        fname = prefix + file + '.lyx'
+        fname = srcdir + '/' + prefix + file + '.lyx'
         if os.access(fname, os.F_OK):
             result.append(fname)
+        else:
+            result.append(srcdir + '/' + file + '.lyx')
     return result
 
 
@@ -50,8 +52,9 @@ def main(argv):
 
     # What are the languages available? And its documents?
     languages = {}
-    for file in glob('*'):
-        lang = lang_pattern.match(file)
+    srcdir = os.path.dirname(argv[0])
+    for file in glob(srcdir + '/*'):
+        lang = lang_pattern.match(os.path.basename(file))
         if lang:
             if lang.group(1) not in languages:
                 languages[lang.group(1)] = [file]
@@ -63,8 +66,8 @@ def main(argv):
     langs.sort()
 
     # The default language is english and doesn't need any prefix
-    print 'TOC.lyx:', '.lyx '.join(possible_documents) + '.lyx'
-    print '\tpython doc_toc.py'
+    print 'TOC.lyx:', ('.lyx ' + srcdir + '/').join(possible_documents) + '.lyx'
+    print '\tpython %s/doc_toc.py' % srcdir
     print
     tocs = ['TOC.lyx']
 
@@ -73,15 +76,17 @@ def main(argv):
         toc_name = lang + '_TOC.lyx'
         tocs.append(toc_name)
 
-        languages[lang].remove(toc_name)
+        if toc_name in languages[lang]:
+            languages[lang].remove(toc_name)
+        if srcdir + '/' + toc_name in languages[lang]:
+            languages[lang].remove(srcdir + '/' + toc_name)
 
         print toc_name + ':', ' '.join(languages[lang])
-        print '\tpython doc_toc.py %s' % lang
+        print '\tpython %s/doc_toc.py %s' % (srcdir, lang)
         print
 
     # Write meta-rule to call all the other rules
-    print 'TOCs:', ' '.join(tocs)
-    print '\t@echo Made TOCs succesfully.'
+    print 'TOCs =', ' '.join(tocs)
 
 
 if __name__ == "__main__":
index 1c00c43ef0ffcadd16ac3b1b7233aa1bd311c59a..c50ad1e7c6194d365f78f148394047dae9628009 100755 (executable)
@@ -25,7 +25,7 @@
 import sys
 import os
 
-sys.path.insert(0,"../lyx2lyx")
+sys.path.insert(0, os.path.dirname(sys.argv[0]) + "/../lyx2lyx")
 import parser_tools
 import LyX
 import depend
@@ -105,9 +105,11 @@ def main(argv):
         if lang not in info:
             lang = 'en'
 
+    srcdir = os.path.dirname(sys.argv[0])
+
     # Determine existing translated documents for that language.
     toc_general = []
-    for file in depend.documents(pref):
+    for file in depend.documents(srcdir, pref):
         file = LyX.File(input= file)
         file.convert()
         toc_general.extend(file.get_toc())
index 6c3e92974b820c35d7296a4d5a67727ddc57eb49..c2f69003da17feda000d341aad0b6b527294e0ec 100644 (file)
@@ -23257,8 +23257,6 @@ paragrafo
 
 
 \begin_deeper
-\end_layout
-
 \begin_deeper
 \begin_layout Standard