mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
fix handling of gzipped files, move default warning level to 1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8725 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
038f420cb7
commit
17ec2aa061
@ -1,3 +1,10 @@
|
||||
2004-05-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (convert_graphics):
|
||||
* lyx2lyx: introduce new member of the structure class, dir which
|
||||
carries the directory of the converted file.
|
||||
* lyx2lyx: move default warning level to 1.
|
||||
|
||||
2004-04-29 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* lyx_1_4.py (convert_graphics): new, convert graphics filenames
|
||||
|
@ -19,6 +19,7 @@
|
||||
import getopt
|
||||
import gzip
|
||||
import sys
|
||||
import os.path
|
||||
from parser_tools import read_file, write_file, read_version, set_version, \
|
||||
read_format, set_format, chain, lyxformat, get_value
|
||||
|
||||
@ -30,10 +31,11 @@ class struct:
|
||||
self.input = sys.stdin
|
||||
self.err = sys.stderr
|
||||
self.debug = 1
|
||||
self.dir = ""
|
||||
self.start = None
|
||||
self.end = None
|
||||
|
||||
def warning(self, message, debug_level= 10):
|
||||
def warning(self, message, debug_level= 1):
|
||||
if debug_level <= self.debug:
|
||||
self.err.write(message + "\n")
|
||||
|
||||
@ -94,6 +96,7 @@ def parse_options(argv, version, opt):
|
||||
|
||||
if args:
|
||||
file = args[0]
|
||||
opt.dir = os.path.dirname(os.path.abspath(file))
|
||||
try:
|
||||
gzip.open(file).readline()
|
||||
opt.output = gzip.GzipFile("","wb",6,opt.output)
|
||||
|
@ -1121,10 +1121,6 @@ def revert_float(lines, opt):
|
||||
def convert_graphics(lines, opt):
|
||||
""" Add extension to filenames of insetgraphics if necessary.
|
||||
"""
|
||||
if opt.input == stdin:
|
||||
dir = ""
|
||||
else:
|
||||
dir = os.path.dirname(os.path.abspath(opt.input.name))
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(lines, "\\begin_inset Graphics", i)
|
||||
@ -1136,7 +1132,7 @@ def convert_graphics(lines, opt):
|
||||
return
|
||||
i = i + 1
|
||||
filename = split(lines[j])[1]
|
||||
absname = os.path.normpath(os.path.join(dir, filename))
|
||||
absname = os.path.normpath(os.path.join(opt.dir, filename))
|
||||
if opt.input == stdin and not os.path.isabs(filename):
|
||||
# We don't know the directory and cannot check the file.
|
||||
# We could use a heuristic and take the current directory,
|
||||
|
Loading…
Reference in New Issue
Block a user