]> git.lyx.org Git - lyx.git/blobdiff - development/tools/updatedocs.py
* es/Intro.lyx: Accept all changes and disable CT
[lyx.git] / development / tools / updatedocs.py
old mode 100644 (file)
new mode 100755 (executable)
index 902248a..1448e8d
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # file updatedocs.py
@@ -14,6 +14,7 @@
 
 
 import os, re, string, sys, subprocess, shutil
+from gen_lfuns import main as genlfuns
 
 
 def convertdir(docdir, prefix, lyx2lyx, lyx, systemlyxdir):
@@ -39,10 +40,7 @@ def convertdir(docdir, prefix, lyx2lyx, lyx, systemlyxdir):
         sys.stderr.write('Converting %s\n' % os.path.join(prefix, i))
         subprocess.call(cmd)
         if lyx != '':
-            # This is a hack, but without modifying the doc LyX refuses to save and stays open
-            # FIXME: Is self-insert a; char-delete-backward always a noop?
-            #        What if change-tracking is enabled?
-            cmd = [lyx, '-f', '-x', 'command-sequence self-insert a; char-delete-backward; buffer-write; lyx-quit', i]
+            cmd = [lyx, '-f', '-x', 'command-sequence buffer-write force; lyx-quit', i]
             subprocess.call(cmd)
     os.chdir(olddir)
 
@@ -50,10 +48,22 @@ def convertdir(docdir, prefix, lyx2lyx, lyx, systemlyxdir):
 def main(argv):
 
     toolsdir = os.path.dirname(argv[0])
+
+    # first generate LFUNs.lyx
+    lyxaction = os.path.abspath(os.path.join(toolsdir, "../../src/LyXAction.cpp"))
+    lfunspath = os.path.abspath(os.path.join(toolsdir, "../../lib/doc"))
+    lfuns = os.path.join(lfunspath, "LFUNs.lyx")
+    # genlfuns refuses to overwrite files
+    if os.path.exists(lfuns):
+        os.rename(lfuns, os.path.join(lfunspath, "LFUNs.lyx.old"))
+    # genlfuns requires a trailing slash
+    genlfuns(["genlfuns", lyxaction, lfunspath + os.sep])
+
+    # then update all docs
     lyx2lyx = os.path.abspath(os.path.join(toolsdir, "../../lib/lyx2lyx/lyx2lyx"))
     systemlyxdir = os.path.abspath(os.path.join(toolsdir, "../../lib"))
     if len(argv) > 1:
-        sys.stderr.write('Warning: Converting with LyX is experimental. Check the results carefully.\n'))
+        sys.stderr.write('Warning: Converting with LyX is experimental. Check the results carefully.\n')
         lyx = os.path.abspath(argv[1])
     else:
         lyx = ''