commit 16e88307581b2a08a4d513b9a5bfa3a806947e7d
Author: Enrico Forestieri <[email protected]>
Date: Sat Feb 1 18:06:01 2025 +0100
Also include local layout files in a LyX archive
Fixes #13149.
---
lib/scripts/lyxpak.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/scripts/lyxpak.py b/lib/scripts/lyxpak.py
index 306be08c16..9bef8861f5 100755
--- a/lib/scripts/lyxpak.py
+++ b/lib/scripts/lyxpak.py
@@ -36,6 +36,7 @@ re_input =
re.compile(b'^(.*)\\\\(input|include){(\\s*)(.+)(\\s*)}.*$')
re_ertinput = re.compile(b'^(input|include)({)(\\s*)(.+)(\\s*)}.*$')
re_package = re.compile(b'^(.*)\\\\(usepackage){(\\s*)(.+)(\\s*)}.*$')
re_class = re.compile(b'^(\\\\)(textclass)(\\s+)(.+)\\s*$')
+re_latexclass =
re.compile(b'^(.*)\\\\(DeclareLaTeXClass)\\[(\\s*)(.+)(\\s*)\\].*$')
re_norecur =
re.compile(b'^(.*)\\\\(verbatiminput|lstinputlisting|includegraphics\\[*.*\\]*){(\\s*)(.+)(\\s*)}.*$')
re_ertnorecur =
re.compile(b'^(verbatiminput|lstinputlisting|includegraphics\\[*.*\\]*)({)(\\s*)(.+)(\\s*)}.*$')
re_filename = re.compile(b'^(\\s*)(filename)(\\s+)(.+)\\s*$')
@@ -146,8 +147,23 @@ def gather_files(curfile, incfiles, lyx2lyx):
extlist = ['.sty']
if not match:
match = re_class.match(lines[i])
- extlist = ['.cls']
- if not match:
+ if match:
+ extlist = ['.cls']
+ file = tostr(match.group(4).strip(b'"'))
+ local_layout = os.path.join(curdir, file) + '.layout'
+ if os.path.exists(local_layout):
+ if not abspath(local_layout) in incfiles:
+ incfiles.append(abspath(local_layout))
+ f = gzopen(local_layout)
+ l = f.readlines()
+ f.close()
+ j = 0
+ while j < len(l):
+ match = re_latexclass.match(l[j])
+ if match:
+ break
+ j += 1
+ else:
if maybe_in_ert:
match = re_ertnorecur.match(lines[i])
else:
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs