Hi,
   in Chemnitz, this year, Jean-Marc and I discussed the update of the
scheme use to generate dinamically the TOC files for the different
translated languages.

  I have studied the subject and this is what I propose:
  
  - replace the present non working perl script with a shiny new script that
  I send attached, it is not complete yet.
  
  - delete the TOC_top, as you can see all the information present in the
  directory is already in the script. Also the directories that we are using
  from lyx2lyx have the know how to create a correct script file with those
  attributes.
  
  - replace the call scheme, instead of
  Doc_toc Toc_Top_File Doc [Doc ...]
  
  it should be
  
  Doc_toc [lang]
  
  if the language is not present then assume english. (The script already
  does this).

  I would like to have further input before proceeding. If you don't have
any objection I will do it until the weekend.

--
José Abílio 
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# This file is part of the LyX Documentation
# Copyright (C) 2004 José Matos <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# This script creates a "master table of contents" for a set of LyX docs.
# It does so by going through the files and printing out all of the
# chapter, section, and sub(sub)section headings out. (It numbers the
# sections sequentially; hopefully noone's using Section* in the docs.)

import sys
import os

sys.path.insert(0,"../lyx2lyx")
import parser_tools
import LyX

# Specific language information
# dict["isoname"] = (language, language_quotes, enconding, TOC_translated)
dict = { 'da' : ('danish', 'german', 'latin1', "Indholdsfortegnelse over LyX's 
dokumentation"),
         'de' : ('german', 'german', 'latin1', "Inhaltsverzeichnis LyX Dokumentation"),
         'fr' : ('french', 'french', 'latin1', "Plan de la documentation"),
         'ru' : ('russian', 'english', 'koi8-r', "LyX Documentation Table of 
Contents"),
         'sl' : ('slovene', 'german', 'latin2', "Kazalo dokumentacije LyXa"),
         'en' : ('english', 'english', 'latin1', "LyX Documentation Table of 
Contents")}

documents = ("Intro", "FAQ", "Tutorial", "UserGuide", "Extended", "Customization")
                 
def usage(pname):
    print """Usage: %s [lang]

    lang is the language to build the TOC file, if not present use english.
""" % pname


def main(argv):
    if len(argv) > 2:
        usage()
        sys.exit(1)

    # choose language and prefix for files
    if len(argv) == 1:
        lang = "en"
        pref = ""
    else:
        lang = argv[1]
        pref = lang + '_'
        # fallback
        if lang not in dict:
            lang = 'en'

    tr_files = []
    for file in documents:
        fname = pref + file + '.lyx'
        if os.access(fname, os.F_OK): tr_files.append(fname)

    print tr_files

if __name__ == "__main__":
    main(sys.argv)

Reply via email to