commit 051ebbcf402cb6c7879941a22b4f6f78af32dbb7
Author: Georg Baum <[email protected]>
Date: Wed Nov 11 20:41:28 2015 +0100
Add utility to update documentation files
updatedocs.py is a small script that updates all documentation files to the
current format.
diff --git a/development/Makefile.am b/development/Makefile.am
index 22c0990..4c83143 100644
--- a/development/Makefile.am
+++ b/development/Makefile.am
@@ -17,7 +17,11 @@ tools/gen_lfuns.py \
tools/generate_symbols_images.lyx \
tools/generate_symbols_images.py \
tools/generate_symbols_list.py \
+tools/generate_symbols_svg.lyx \
+tools/generate_symbols_svg.py \
tools/unicodesymbols.py \
+tools/updatedocs.py \
+tools/updatelayouts.py \
tools/x-font \
tools/README \
tools/count_total_lines_of_compiled_code.sh \
diff --git a/development/tools/updatedocs.py b/development/tools/updatedocs.py
new file mode 100644
index 0000000..d2c7fe8
--- /dev/null
+++ b/development/tools/updatedocs.py
@@ -0,0 +1,54 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# file updatedocs.py
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+
+# author Georg Baum
+
+# Full author contact details are available in file CREDITS
+
+# This script converts documentation .lyx files to current format
+# The old files are backuped with extension ".old"
+
+
+import os, re, string, sys, subprocess, shutil
+
+
+def convertdir(docdir, prefix, lyx2lyx):
+ olddir = os.getcwd()
+ os.chdir(docdir)
+ for i in os.listdir("."):
+ if os.path.isdir(i):
+ subdir = os.path.join(docdir, i)
+ subprefix = os.path.join(prefix, i)
+ convertdir(subdir, subprefix, lyx2lyx)
+ continue
+ (base, ext) = os.path.splitext(i)
+ if ext != ".lyx":
+ continue
+ old = i + ".old"
+ shutil.copy(i, old)
+ if sys.executable and sys.executable != '':
+ cmd = [sys.executable, lyx2lyx, old, '-o', i]
+ else:
+ # assume that python is in the path
+ cmd = [lyx2lyx, old, '-o', i]
+ sys.stderr.write('Converting %s\n' % os.path.join(prefix, i))
+ subprocess.call(cmd)
+ os.chdir(olddir)
+
+
+def main(argv):
+
+ toolsdir = os.path.dirname(argv[0])
+ docdir = os.path.abspath(os.path.join(toolsdir, '../../lib/doc'))
+ lyx2lyx = os.path.abspath(os.path.join(toolsdir,
"../../lib/lyx2lyx/lyx2lyx"))
+ convertdir(docdir, '', lyx2lyx)
+
+ return 0
+
+
+if __name__ == "__main__":
+ main(sys.argv)