The branch, master, has been updated. - Log -----------------------------------------------------------------
commit c10044ddc0363b5cdcd0a449c15b151747649c21 Author: Georg Baum <[email protected]> Date: Tue Jan 8 21:39:24 2013 +0100 Add consistency checks. development/tools/generate_symbols_images.py now checks for each symbol in lib/symbols whether its image is listed in lib/Makefile.am and whether it has a toolbar entry in lib/ui/stdtoolbars.inc. diff --git a/development/tools/generate_symbols_images.py b/development/tools/generate_symbols_images.py index 7787e5d..a043c9c 100644 --- a/development/tools/generate_symbols_images.py +++ b/development/tools/generate_symbols_images.py @@ -75,7 +75,30 @@ def getreplacements(filename): found = True -def createimage(name, path, template, lyxexe, tempdir, replacements): +def gettoolbaritems(filename): + items = [] + uifile = open(filename, 'rt') + regexp = re.compile(r'.*Item "([^"\[]+)(\[\[[^\]]+\]\])?"\s*"math-insert\s+([^"]+)"') + for line in uifile.readlines(): + m = regexp.match(line) + if m: + if '\\' + m.group(1) == m.group(3): + items.append(m.group(1)) + return items + + +def getmakefileentries(filename): + items = [] + makefile = open(filename, 'rt') + regexp = re.compile(r'.*images/math/(.+)\.png') + for line in makefile.readlines(): + m = regexp.match(line) + if m: + items.append(m.group(1)) + return items + + +def createimage(name, path, template, lyxexe, tempdir, replacements, toolbaritems, makefileentries): """ Create the image file for symbol name in path. """ if name in replacements.keys(): @@ -91,10 +114,20 @@ def createimage(name, path, template, lyxexe, tempdir, replacements): return filename = name pngname = os.path.join(path, filename + '.png') + if name in toolbaritems: + if filename in makefileentries: + suffix = ' (found in toolbar and makefile)' + else: + suffix = ' (found in only in toolbar)' + else: + if filename in makefileentries: + suffix = ' (found only in makefile)' + else: + suffix = ' (not found)' if os.path.exists(pngname): - print 'Skipping ' + name + print 'Skipping ' + name + suffix return - print 'Generating ' + name + print 'Generating ' + name + suffix lyxname = os.path.join(tempdir, filename) lyxfile = open(lyxname + '.lyx', 'wt') lyxfile.write(template.replace('$a$', '$\\' + name + '$')) @@ -140,13 +173,17 @@ def main(argv): symbols = getlist(argv[1], base) cppfile = os.path.join(os.path.dirname(base), '../../src/frontends/qt4/GuiApplication.cpp') replacements = getreplacements(cppfile) + uifile = os.path.join(os.path.dirname(base), '../../lib/ui/stdtoolbars.inc') + toolbaritems = gettoolbaritems(uifile) + makefile = os.path.join(os.path.dirname(base), '../../lib/Makefile.am') + makefileentries = getmakefileentries(makefile) lyxtemplate = base + '.lyx' templatefile = open(base + '.lyx', 'rt') template = templatefile.read() templatefile.close() tempdir = tempfile.mkdtemp() for i in symbols: - createimage(i, argv[2], template, argv[1], tempdir, replacements) + createimage(i, argv[2], template, argv[1], tempdir, replacements, toolbaritems, makefileentries) shutil.rmtree(tempdir) else: error(usage(argv[0])) commit 731c1f9ac4d5de55705fe8eb707c98b9abfb4b3b Author: Georg Baum <[email protected]> Date: Tue Jan 8 19:47:46 2013 +0100 Fix commandline export of \implies. See the added comment in lib/symbols for details. diff --git a/lib/symbols b/lib/symbols index 2ed922c..a0e30a9 100644 --- a/lib/symbols +++ b/lib/symbols @@ -4,6 +4,12 @@ # # The syntax of lib/symbols is very ad hoc. # There are several possible formats of a line, which are quite different. +# If you put any symbol with a requirement inside an iffont clause, you +# must put an alternative definition with the same requirement in the +# corresponding else clause. Otherwise the LaTeX output would depend on the +# availability of the font. This usually no problem in GUI mode, since all +# fonts are shipped with LyX, but in command line mode no font is available +# at all. # New symbols for font packages may be created using # development/tools/generate_symbols_list.py (but may require manual fixes # as well). @@ -1124,6 +1130,8 @@ iffont cmsy \def\mapsto{\mapstochar\kern-9mu\rightarrow} \def\longmapsto{\mapstochar\kern-6mu\lyxbar\kern-11mu\rightarrow} \def\models{\vert\kern-7mu\lyxeq} +else +\def\implies{=>} amsmath endif iffont cmm \def\hookrightarrow{\lhook\kern-12mu\rightarrow} ----------------------------------------------------------------------- Summary of changes: development/tools/generate_symbols_images.py | 45 +++++++++++++++++++++++-- lib/symbols | 8 ++++ 2 files changed, 49 insertions(+), 4 deletions(-) hooks/post-receive -- The LyX Source Repository
