mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
Remove now unused originaldir flag from Converter.{cpp,h}.
Update documentation to reflect removal. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18824 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
98f355e5a7
commit
3d362bf35c
@ -1,5 +1,5 @@
|
||||
#LyX 1.5.0rc1 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 271
|
||||
#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 274
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass book
|
||||
@ -38,7 +38,6 @@
|
||||
\tracking_changes false
|
||||
\output_changes false
|
||||
\author "usti"
|
||||
\author "Richard Heck"
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -17901,7 +17900,7 @@ Note that the only difference so far is in the name of the file, no special
|
||||
If the document is of any literate class LyX will then use the internal
|
||||
LyX to Noweb converter, followed by the Noweb to LaTeX converter
|
||||
\begin_inset Foot
|
||||
status open
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
The converters are defined in the
|
||||
@ -17925,6 +17924,17 @@ Conversion
|
||||
\end_inset
|
||||
|
||||
tab.
|
||||
See section
|
||||
\begin_inset LatexCommand ref
|
||||
reference "sub:converters"
|
||||
|
||||
\end_inset
|
||||
|
||||
of the
|
||||
\emph on
|
||||
Customization
|
||||
\emph default
|
||||
manual for general information about converters.
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
@ -17968,7 +17978,9 @@ When the build menu option is chosen or the corresponding button in the
|
||||
Noweb->Program
|
||||
\family default
|
||||
converter.
|
||||
Typically, this converter (like any other converter), has two parts:
|
||||
This converter needs to be defined by the user and is not installed by
|
||||
default, though the Program format is.
|
||||
This converter (like any other converter) will have two parts:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Enumerate
|
||||
@ -18015,7 +18027,7 @@ build-script
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
(a program or script) with the name of the Noweb file (generally a file
|
||||
(a program or script) with the name of the Noweb file (normally a file
|
||||
in the LyX temp directory).
|
||||
|
||||
\end_layout
|
||||
@ -18059,7 +18071,7 @@ Flags
|
||||
|
||||
|
||||
\family typewriter
|
||||
originaldir,parselog=listerrors
|
||||
parselog=listerrors
|
||||
\family default
|
||||
|
||||
\begin_inset Quotes erd
|
||||
@ -18105,6 +18117,74 @@ listerrors
|
||||
program.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
The build will normally take place in LyX's temporary directory, so the
|
||||
files produced by the conversion will be in that directory.
|
||||
LyX will copy out what it regards as the `main' file, but the
|
||||
\family typewriter
|
||||
Noweb->Program
|
||||
\family default
|
||||
conversion may produce several files, and so most of these would then be
|
||||
deleted when LyX was closed.
|
||||
The present solution is to use a `copier',
|
||||
\begin_inset Foot
|
||||
status collapsed
|
||||
|
||||
\begin_layout Standard
|
||||
See section
|
||||
\begin_inset LatexCommand ref
|
||||
reference "sec:converters-etc"
|
||||
|
||||
\end_inset
|
||||
|
||||
of the
|
||||
\emph on
|
||||
Customization
|
||||
\emph default
|
||||
manual for information on these.
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
in this case, the
|
||||
\family typewriter
|
||||
ext_copy.py
|
||||
\family default
|
||||
script in its default mode, so that the entire contents of the temporary
|
||||
directory is copied.
|
||||
More will get copied than is needed, to be sure, but nothing will be lost.
|
||||
If, however, you know what extensions the generated files will have, this
|
||||
can be improved by using the
|
||||
\family typewriter
|
||||
-e
|
||||
\family default
|
||||
option to
|
||||
\family typewriter
|
||||
ext_copy
|
||||
\family default
|
||||
.
|
||||
This option takes a comma-separated list of extensions to copy.
|
||||
So, for example, if the conversion will generate only files with the extensions
|
||||
|
||||
\family typewriter
|
||||
.c
|
||||
\family default
|
||||
and
|
||||
\family typewriter
|
||||
.h
|
||||
\family default
|
||||
, then the correct definition would be:
|
||||
\end_layout
|
||||
|
||||
\begin_layout LyX-Code
|
||||
python -tt $$s/scripts/ext_copy.py -e c,h $$i $$o
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
The result will be that only files with these two extensions will be copied
|
||||
out.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Paragraph
|
||||
Build instructions in the document
|
||||
\end_layout
|
||||
|
@ -119,7 +119,7 @@ Converter::Converter(string const & f, string const & t,
|
||||
string const & c, string const & l)
|
||||
: from(f), to(t), command(c), flags(l),
|
||||
From(0), To(0), latex(false), xml(false),
|
||||
original_dir(false), need_aux(false)
|
||||
need_aux(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -134,8 +134,6 @@ void Converter::readFlags()
|
||||
latex = true;
|
||||
else if (flag_name == "xml")
|
||||
xml = true;
|
||||
else if (flag_name == "originaldir")
|
||||
original_dir = true;
|
||||
else if (flag_name == "needaux")
|
||||
need_aux = true;
|
||||
else if (flag_name == "resultdir")
|
||||
@ -400,12 +398,10 @@ bool Converters::convert(Buffer const * buffer,
|
||||
}
|
||||
|
||||
// FIXME UNICODE
|
||||
string const infile2 = (conv.original_dir)
|
||||
? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
|
||||
from_utf8(path)));
|
||||
string const outfile2 = (conv.original_dir)
|
||||
? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
|
||||
from_utf8(path)));
|
||||
string const infile2 =
|
||||
to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
|
||||
string const outfile2 =
|
||||
to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
|
||||
|
||||
string command = conv.command;
|
||||
command = subst(command, token_from, quoteName(infile2));
|
||||
@ -428,43 +424,41 @@ bool Converters::convert(Buffer const * buffer,
|
||||
buffer->message(_("Executing command: ")
|
||||
+ from_utf8(command));
|
||||
|
||||
Systemcall::Starttype const type = (dummy)
|
||||
? Systemcall::DontWait : Systemcall::Wait;
|
||||
Systemcall one;
|
||||
int res;
|
||||
if (conv.original_dir) {
|
||||
FileName path(buffer->filePath());
|
||||
support::Path p(path);
|
||||
res = one.startscript(type,
|
||||
if (dummy) {
|
||||
res = one.startscript(Systemcall::DontWait,
|
||||
to_filesystem8bit(from_utf8(command)));
|
||||
} else
|
||||
res = one.startscript(type,
|
||||
to_filesystem8bit(from_utf8(command)));
|
||||
|
||||
if (!real_outfile.empty()) {
|
||||
Mover const & mover = getMover(conv.to);
|
||||
if (!mover.rename(outfile, real_outfile))
|
||||
res = -1;
|
||||
else
|
||||
LYXERR(Debug::FILES)
|
||||
<< "renaming file " << outfile
|
||||
<< " to " << real_outfile
|
||||
<< endl;
|
||||
// Finally, don't forget to tell any future
|
||||
// converters to use the renamed file...
|
||||
outfile = real_outfile;
|
||||
}
|
||||
|
||||
if (!conv.parselog.empty()) {
|
||||
string const logfile = infile2 + ".log";
|
||||
string const script = libScriptSearch(conv.parselog);
|
||||
string const command2 = script +
|
||||
" < " + quoteName(infile2 + ".out") +
|
||||
" > " + quoteName(logfile);
|
||||
one.startscript(Systemcall::Wait,
|
||||
to_filesystem8bit(from_utf8(command2)));
|
||||
if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
|
||||
return false;
|
||||
// We're not waiting for the result, so we can't do anything
|
||||
// else here.
|
||||
} else {
|
||||
res = one.startscript(Systemcall::Wait,
|
||||
to_filesystem8bit(from_utf8(command)));
|
||||
if (!real_outfile.empty()) {
|
||||
Mover const & mover = getMover(conv.to);
|
||||
if (!mover.rename(outfile, real_outfile))
|
||||
res = -1;
|
||||
else
|
||||
LYXERR(Debug::FILES)
|
||||
<< "renaming file " << outfile
|
||||
<< " to " << real_outfile
|
||||
<< endl;
|
||||
// Finally, don't forget to tell any future
|
||||
// converters to use the renamed file...
|
||||
outfile = real_outfile;
|
||||
}
|
||||
|
||||
if (!conv.parselog.empty()) {
|
||||
string const logfile = infile2 + ".log";
|
||||
string const script = libScriptSearch(conv.parselog);
|
||||
string const command2 = script +
|
||||
" < " + quoteName(infile2 + ".out") +
|
||||
" > " + quoteName(logfile);
|
||||
one.startscript(Systemcall::Wait,
|
||||
to_filesystem8bit(from_utf8(command2)));
|
||||
if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (res) {
|
||||
|
@ -55,8 +55,6 @@ public:
|
||||
bool latex;
|
||||
/// The converter is xml
|
||||
bool xml;
|
||||
/// Do we need to run the converter in the original directory?
|
||||
bool original_dir;
|
||||
/// This converter needs the .aux files
|
||||
bool need_aux;
|
||||
/// If the converter put the result in a directory, then result_dir
|
||||
|
Loading…
x
Reference in New Issue
Block a user