X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fconfigure.py;h=d379f5b0eb9346ee92bf889f6cbb705987bac540;hb=c09fcc890feadcbdca4308a12c99d4f7092ff735;hp=9ece0e754139189d34a7f049e2024282c65534e2;hpb=4d5c24e80d585fe6559f1e2a7f1f67c0f013215c;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index 9ece0e7541..d379f5b0eb 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -516,9 +516,9 @@ def checkFormatEntries(dtl_tools): \Format textparagraph txt "Plain Text, Join Lines" "" "" "%%" "document"''' ]) # path, xhtmlview = checkViewer('an HTML previewer', ['firefox', 'mozilla file://$$p$$i', 'netscape'], - rc_entry = [r'\Format xhtml xhtml "LyX HTML" X "%%" "" "document"']) + rc_entry = [r'\Format xhtml xhtml "LyXHTML" X "%%" "" "document"']) if xhtmlview == "": - addToRC(r'\Format xhtml xhtml "LyX HTML" X "" "" "document"') + addToRC(r'\Format xhtml xhtml "LyXHTML" X "" "" "document"') # checkEditor('a BibTeX editor', ['sensible-editor', 'jabref', 'JabRef', \ 'pybliographic', 'bibdesk', 'gbib', 'kbib', \ @@ -646,10 +646,17 @@ def checkConverterEntries(): else: addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py $$i $$o"''') + # Check if LyxBlogger is installed. + path, lyxblogger = checkProg('A LyX to WordPress Blog Publishing Tool', + ['lyxblogger $$i'], rc_entry = []) + if lyxblogger.find('lyxblogger') >= 0: + addToRC(r'\Format blog blog "LyxBlogger" "" "" "" "document"') + addToRC(r'\converter xhtml blog "lyxblogger $$i" ""') + # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ - path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i html,word symbol/! -cvalidate", \ - "htlatex.sh $$i html,word symbol/! -cvalidate", \ - "/usr/share/tex4ht/htlatex $$i html,word symbol/! -cvalidate"], + path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'", \ + "htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'", \ + "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"], rc_entry = [ r'\converter latex wordhtml "%%" "needaux"' ]) if htmlconv.find('htlatex') >= 0: addToRC(r'''\copier wordhtml "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''') @@ -667,7 +674,7 @@ def checkConverterEntries(): # Both SuSE and debian have oolatex checkProg('a LaTeX -> Open Document converter', [ 'oolatex $$i', 'mk4ht oolatex $$i', 'oolatex.sh $$i', '/usr/share/tex4ht/oolatex $$i', - 'htlatex $$i xhtml,ooffice ooffice/! -cmozhtf -coo -cvalidate'], + 'htlatex $$i \'xhtml,ooffice\' \'ooffice/! -cmozhtf\' \'-coo\' \'-cvalidate\''], rc_entry = [ r'\converter latex odt "%%" "needaux"' ]) # On windows it is called latex2rt.exe checkProg('a LaTeX -> RTF converter', ['latex2rtf -p -S -o $$o $$i', 'latex2rt -p -S -o $$o $$i'], @@ -750,8 +757,12 @@ def checkConverterEntries(): \converter agr ppm "gracebat -hardcopy -printfile $$o -hdevice PNM $$i 2>/dev/null" ""''', '']) # - checkProg('a Dot -> PDF converter', ['dot -Tpdf $$i -o $$o'], - rc_entry = [ r'\converter dot pdf "%%" ""']) + checkProg('a Dot -> Image converter', ['dot'], + rc_entry = [ + r'''\converter dot eps "dot -Teps $$i -o $$o" "" +\converter dot pdf "dot -Tpdf $$i -o $$o" "" +\converter dot png "dot -Tpng $$i -o $$o" ""''', + '']) # checkProg('a Dia -> PNG converter', ['dia -e $$o -t png $$i'], rc_entry = [ r'\converter dia png "%%" ""']) @@ -890,10 +901,17 @@ def processLayoutFile(file, bool_docbook): we expect output: - "article" "article" "article" "false" - "scrbook" "scrbook" "book (koma-script)" "false" - "svjog" "svjour" "article (Springer - svjour/jog)" "false" + "article" "article" "article" "false" "article.cls" + "scrbook" "scrbook" "book (koma-script)" "false" "scrbook.cls" + "svjog" "svjour" "article (Springer - svjour/jog)" "false" "svjour.cls,svjog.clo" ''' + def checkForClassExtension(x): + '''if the extension for a latex class is not + provided, add .cls to the classname''' + if not '.' in x: + return x.strip() + '.cls' + else: + return x.strip() classname = file.split(os.sep)[-1].split('.')[0] # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article} p = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}') @@ -904,7 +922,14 @@ def processLayoutFile(file, bool_docbook): avai = {'LaTeX':'false', 'DocBook':bool_docbook}[classtype] if opt == None: opt = classname - return '"%s" "%s" "%s" "%s"\n' % (classname, opt, desc, avai) + prereq_latex = checkForClassExtension(classname) + else: + prereq_list = optAll[1:-1].split(',') + prereq_list = map(checkForClassExtension, prereq_list) + prereq_latex = ','.join(prereq_list) + prereq_docbook = {'true':'', 'false':'docbook'}[bool_docbook] + prereq = {'LaTeX':prereq_latex, 'DocBook':prereq_docbook}[classtype] + return '"%s" "%s" "%s" "%s" "%s"\n' % (classname, opt, desc, avai, prereq) logger.warning("Layout file " + file + " has no \DeclareXXClass line. ") return "" @@ -1063,12 +1088,12 @@ def processModuleFile(file, bool_docbook): We expect output: "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category" ''' - p = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*?)\])?{(.*)}') - r = re.compile(r'#+\s*Requires: (.*)') - x = re.compile(r'#+\s*Excludes: (.*)') - c = re.compile(r'#+\s*Category: (.*)') - b = re.compile(r'#+\s*DescriptionBegin\s*$') - e = re.compile(r'#+\s*DescriptionEnd\s*$') + remods = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*?)\])?{(.*)}') + rereqs = re.compile(r'#+\s*Requires: (.*)') + reexcs = re.compile(r'#+\s*Excludes: (.*)') + recaty = re.compile(r'#+\s*Category: (.*)') + redbeg = re.compile(r'#+\s*DescriptionBegin\s*$') + redend = re.compile(r'#+\s*DescriptionEnd\s*$') modname = desc = pkgs = req = excl = catgy = "" readingDescription = False @@ -1078,18 +1103,20 @@ def processModuleFile(file, bool_docbook): for line in open(file).readlines(): if readingDescription: - res = e.search(line) + res = redend.search(line) if res != None: readingDescription = False desc = " ".join(descLines) + # Escape quotes. + desc = desc.replace('"', '\\"') continue descLines.append(line[1:].strip()) continue - res = b.search(line) + res = redbeg.search(line) if res != None: readingDescription = True continue - res = p.search(line) + res = remods.search(line) if res != None: (pkgs, modname) = res.groups() if pkgs == None: @@ -1098,42 +1125,46 @@ def processModuleFile(file, bool_docbook): tmp = [s.strip() for s in pkgs.split(",")] pkgs = ",".join(tmp) continue - res = r.search(line) + res = rereqs.search(line) if res != None: req = res.group(1) tmp = [s.strip() for s in req.split("|")] req = "|".join(tmp) continue - res = x.search(line) + res = reexcs.search(line) if res != None: excl = res.group(1) tmp = [s.strip() for s in excl.split("|")] excl = "|".join(tmp) continue - res = c.search(line) + res = recaty.search(line) if res != None: catgy = res.group(1) continue - if modname != "": - if pkgs != "": - # this module has some latex dependencies: - # append the dependencies to chkmodules.tex, - # which is \input'ed by chkconfig.ltx - testpackages = list() - for pkg in pkgs.split(","): - if "->" in pkg: - # this is a converter dependency: skip - continue - if pkg.endswith(".sty"): - pkg = pkg[:-4] - testpackages.append("\\TestPackage{%s}" % (pkg,)) - cm = open('chkmodules.tex', 'a') - for line in testpackages: - cm.write(line + '\n') - cm.close() - return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, desc, pkgs, req, excl, catgy) - logger.warning("Module file without \DeclareLyXModule line. ") - return "" + + if modname == "": + logger.warning("Module file without \DeclareLyXModule line. ") + return "" + + if pkgs != "": + # this module has some latex dependencies: + # append the dependencies to chkmodules.tex, + # which is \input'ed by chkconfig.ltx + testpackages = list() + for pkg in pkgs.split(","): + if "->" in pkg: + # this is a converter dependency: skip + continue + if pkg.endswith(".sty"): + pkg = pkg[:-4] + testpackages.append("\\TestPackage{%s}" % (pkg,)) + cm = open('chkmodules.tex', 'a') + for line in testpackages: + cm.write(line + '\n') + cm.close() + + return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, desc, pkgs, req, excl, catgy) + def checkTeXAllowSpaces():