These are needed to enable lyx2lyx to work with "files with spaces". As an
added bonus, the alert will now be triggered if lyx2lyx is not found.
Oh, and I added the missing description of the '-f' option back to the
1.4.x version of lyx2lyx :)
Everybody happy for me to commit these?
--
Angus
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1021.2.81
diff -u -p -r1.1021.2.81 ChangeLog
--- src/ChangeLog 10 May 2005 15:00:04 -0000 1.1021.2.81
+++ src/ChangeLog 18 May 2005 22:09:10 -0000
@@ -1,3 +1,7 @@
+2005-05-18 Angus Leeming <[EMAIL PROTECTED]>
+
+ * buffer.C (readFile): Quote all file names passed to lyx2lyx.
+
2005-05-09 Angus Leeming <[EMAIL PROTECTED]>
* Makefile.am: make compilation of pspell.[Ch] and ispell.[Ch] dependent
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.399.2.16
diff -u -p -r1.399.2.16 buffer.C
--- src/buffer.C 18 Apr 2005 17:44:02 -0000 1.399.2.16
+++ src/buffer.C 18 May 2005 22:09:13 -0000
@@ -1221,22 +1221,25 @@ bool Buffer::readFile(LyXLex & lex, stri
"Use LyX 0.10.x to read this!"));
return false;
} else if (!filename.empty()) {
- string command = "python " +
- LibFileSearch("lyx2lyx", "lyx2lyx");
- if (command.empty()) {
+ string const lyx2lyx = LibFileSearch("lyx2lyx", "lyx2lyx");
+ if (lyx2lyx.empty()) {
Alert::alert(_("ERROR!"),
_("Can't find conversion script."));
return false;
}
string const tmpfile = lyx::tempName();
- command += " -t"
- + tostr(LYX_FORMAT)
- + " -o " + tmpfile + ' '
- + QuoteName(filename);
+ ostringstream command;
+ command << "python " << QuoteName(lyx2lyx)
+ << " -t " << tostr(LYX_FORMAT)
+ << " -o " << QuoteName(tmpfile) << ' '
+ << QuoteName(filename);
+ string const command_str = STRCONV(command.str());
+
lyxerr[Debug::INFO] << "Running '"
- << command << '\''
+ << command_str << '\''
<< endl;
- cmd_ret const ret = RunCommand(command);
+
+ cmd_ret const ret = RunCommand(command_str);
if (ret.first) {
Alert::alert(_("ERROR!"),
_("An error occured while "
@@ -2141,7 +2144,7 @@ void Buffer::makeLaTeXFile(ostream & os,
<< endl;
texrow.newline();
}
-
+
// if we are doing a real file with body, even if this is the
// child of some other buffer, let's cut the link here.
string save_parentname;
@@ -2157,7 +2160,7 @@ void Buffer::makeLaTeXFile(ostream & os,
if (!only_body) {
params.parentname = save_parentname;
}
-
+
// add this just in case after all the paragraphs
os << endl;
texrow.newline();
@@ -3085,7 +3088,7 @@ void Buffer::simpleDocBookOnePar(ostream
if (style->latexparam() == "CDATA")
os << "<![CDATA[";
}
-
+
break;
}
case Paragraph::META_NEWLINE:
Index: lib/lyx2lyx/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/ChangeLog,v
retrieving revision 1.68
diff -u -p -r1.68 ChangeLog
--- lib/lyx2lyx/ChangeLog 18 May 2005 14:50:29 -0000 1.68
+++ lib/lyx2lyx/ChangeLog 18 May 2005 22:08:24 -0000
@@ -1,3 +1,8 @@
+2005-05-18 Angus Leeming <[EMAIL PROTECTED]>
+
+ * lyx2lyx (parse_options): Add the description of the '-f' option
+ back again.
+
2005-05-18 Georg Baum <[EMAIL PROTECTED]>
* lyx_1_4.py (convert_breaks): Don't treat every token that starts
@@ -5,7 +10,8 @@
2005-05-06 José Matos <[EMAIL PROTECTED]>
- * lyx_1_4.py (convert_breaks): put all paragraph parameters into a single line.
+ * lyx_1_4.py (convert_breaks): put all paragraph parameters into a
+ single line.
2005-05-04 José Matos <[EMAIL PROTECTED]>
@@ -257,7 +263,7 @@
* lyx_1_4.py (convert_frameless_box): Replace instead of adding
new code.
-.
+
2004-04-14 José Matos <[EMAIL PROTECTED]>
* error.py
@@ -416,4 +422,3 @@
* lyxconvert_223.py:
* lyxconvert_224.py (convert_minipage): move funtion to its right place.
(convert_breaks): convert line and page break, at bottom and top.
-
Index: lib/lyx2lyx/lyx2lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v
retrieving revision 1.32
diff -u -p -r1.32 lyx2lyx
--- lib/lyx2lyx/lyx2lyx 5 Jan 2005 18:52:59 -0000 1.32
+++ lib/lyx2lyx/lyx2lyx 18 May 2005 22:08:24 -0000
@@ -32,6 +32,7 @@ Options:
-d, --debug level level=0..2 (O_ no debug information, 2_verbose)
default: level=1
-e, --err error_file name of the error file or else goes to stderr
+ -f, --from version initial version (optional)
-t, --to version final version (optional)
-o, --output name name of the output file or else goes to stdout
-q, --quiet same as --debug=0"""
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2182
diff -u -p -r1.2182 ChangeLog
--- src/ChangeLog 12 May 2005 12:22:35 -0000 1.2182
+++ src/ChangeLog 18 May 2005 22:08:44 -0000
@@ -1,3 +1,7 @@
+2005-05-18 Angus Leeming <[EMAIL PROTECTED]>
+
+ * buffer.C (readFile): Quote all file names passed to lyx2lyx.
+
2005-05-12 Martin Vermeer <[EMAIL PROTECTED]>
* tabular.[hC]: added setCellInset to fix tabular paste.
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.617
diff -u -p -r1.617 buffer.C
--- src/buffer.C 11 May 2005 16:42:11 -0000 1.617
+++ src/buffer.C 18 May 2005 22:08:45 -0000
@@ -638,9 +638,8 @@ bool Buffer::readFile(LyXLex & lex, stri
filename));
return false;
}
- string command =
- "python " + LibFileSearch("lyx2lyx", "lyx2lyx");
- if (command.empty()) {
+ string const lyx2lyx = LibFileSearch("lyx2lyx", "lyx2lyx");
+ if (lyx2lyx.empty()) {
Alert::error(_("Conversion script not found"),
bformat(_("%1$s is from an earlier"
" version of LyX, but the"
@@ -649,14 +648,18 @@ bool Buffer::readFile(LyXLex & lex, stri
filename));
return false;
}
- command += " -t"
- + convert<string>(LYX_FORMAT)
- + " -o " + tmpfile + ' '
- + QuoteName(filename);
+ ostringstream command;
+ command << "python " << QuoteName(lyx2lyx)
+ << " -t " << convert<string>(LYX_FORMAT)
+ << " -o " << QuoteName(tmpfile) << ' '
+ << QuoteName(filename);
+ string const command_str = command.str();
+
lyxerr[Debug::INFO] << "Running '"
- << command << '\''
+ << command_str << '\''
<< endl;
- cmd_ret const ret = RunCommand(command);
+
+ cmd_ret const ret = RunCommand(command_str);
if (ret.first != 0) {
Alert::error(_("Conversion script failed"),
bformat(_("%1$s is from an earlier version"