commit 556efce34b7a9de21cddb828cf0f66aa3f72e6b3
Author: Enrico Forestieri <[email protected]>
Date:   Thu Dec 5 10:05:53 2024 +0100

    Account for extensions when creating a LyX archive
    
    LyX archives created after importing a LaTeX document may not
    include bibliography style and catalog files. This is because
    tex2lyx does not remove extensions, but the lyxpak script
    expects files without extensions. So, teach lyxpak to also take
    possible extensions into account.
    
    Fixes #13129
---
 lib/scripts/lyxpak.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/scripts/lyxpak.py b/lib/scripts/lyxpak.py
index 0d9151592e..38cd4c62b8 100755
--- a/lib/scripts/lyxpak.py
+++ b/lib/scripts/lyxpak.py
@@ -183,8 +183,11 @@ def gather_files(curfile, incfiles, lyx2lyx):
             file = match.group(3).strip(b'"')
             if file.startswith(b"bibtotoc,"):
                 file = file[9:]
+            ext = os.path.splitext(file)[-1]
+            if ext != b'.bst':
+                file = file + b'.bst'
             if not os.path.isabs(file):
-                file = os.path.join(curdir, file + b'.bst')
+                file = os.path.join(curdir, file)
             if os.path.exists(file):
                 incfiles.append(abspath(file))
             i += 1
@@ -196,10 +199,12 @@ def gather_files(curfile, incfiles, lyx2lyx):
             bibfiles = match.group(3).strip(b'"').split(b',')
             j = 0
             while j < len(bibfiles):
-                if os.path.isabs(bibfiles[j]):
-                    file = bibfiles[j] + b'.bib'
-                else:
-                    file = os.path.join(curdir, bibfiles[j] + b'.bib')
+                file = bibfiles[j]
+                ext = os.path.splitext(file)[-1]
+                if ext != b'.bib':
+                    file = file + b'.bib'
+                if not os.path.isabs(file):
+                    file = os.path.join(curdir, file)
                 if os.path.exists(file):
                     incfiles.append(abspath(file))
                 j += 1
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to