mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Add -skipchildren command line switch (bug #4435)
This allows to skip generated files, e.g. an alternative xfig export which we do not understand, as mentioned in bug #4435.
This commit is contained in:
parent
33c3e63f40
commit
fbabfdfa46
@ -48,6 +48,11 @@ Use the \fB\-f\fR option (carefully) to clobber any existing files.
|
||||
Noweb. Translate a noweb (aka literate programming) file. This should be
|
||||
(almost?) equivalent to running \*[lq]noweb2lyx foo.tex foo.lyx\*[rq]. This option
|
||||
requires the \fB\-c\fR option.
|
||||
.TP
|
||||
.BI \-skipchildren
|
||||
Do not translate child documents included via \f(CW\einclude\fR and \f(CW\einput\fR.
|
||||
This option is useful if the child documents are generated files and/or contain many
|
||||
commands that \fBtex2lyx\fR does not understand yet.
|
||||
.\" .TP
|
||||
.\" .BI \-r
|
||||
.\" Regular environments (see the section on \fISyntax Files\fR). If you give more than one
|
||||
|
@ -447,6 +447,7 @@ string default_encoding;
|
||||
string syntaxfile;
|
||||
bool copy_files = false;
|
||||
bool overwrite_files = false;
|
||||
bool skip_children = false;
|
||||
int error_code = 0;
|
||||
|
||||
/// return the number of arguments consumed
|
||||
@ -463,6 +464,7 @@ int parse_help(string const &, string const &)
|
||||
"\t-f Force overwrite of .lyx files.\n"
|
||||
"\t-help Print this message and quit.\n"
|
||||
"\t-n translate a noweb (aka literate programming) file.\n"
|
||||
"\t-skipchildren Do not translate included child documents.\n"
|
||||
"\t-roundtrip re-export created .lyx file infile.lyx.lyx to infile.lyx.tex.\n"
|
||||
"\t-s syntaxfile read additional syntax file.\n"
|
||||
"\t-sysdir SYSDIR Set system directory to SYSDIR.\n"
|
||||
@ -565,6 +567,13 @@ int parse_noweb(string const &, string const &)
|
||||
}
|
||||
|
||||
|
||||
int parse_skipchildren(string const &, string const &)
|
||||
{
|
||||
skip_children = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_roundtrip(string const &, string const &)
|
||||
{
|
||||
roundtrip = true;
|
||||
@ -594,6 +603,7 @@ void easyParse(int & argc, char * argv[])
|
||||
cmdmap["-f"] = parse_force;
|
||||
cmdmap["-s"] = parse_syntaxfile;
|
||||
cmdmap["-n"] = parse_noweb;
|
||||
cmdmap["-skipchildren"] = parse_skipchildren;
|
||||
cmdmap["-sysdir"] = parse_sysdir;
|
||||
cmdmap["-userdir"] = parse_userdir;
|
||||
cmdmap["-roundtrip"] = parse_roundtrip;
|
||||
@ -667,6 +677,12 @@ bool overwriteFiles()
|
||||
}
|
||||
|
||||
|
||||
bool skipChildren()
|
||||
{
|
||||
return skip_children;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
/*!
|
||||
|
@ -183,6 +183,8 @@ extern std::string getParentFilePath(bool input);
|
||||
extern bool overwriteFiles();
|
||||
/// Do we need to copy included files to the output directory?
|
||||
extern bool copyFiles();
|
||||
/// Shall we skip child documents and keep them as TeX?
|
||||
extern bool skipChildren();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -3814,8 +3814,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
string const abslyxname = makeAbsPath(
|
||||
lyxname, getParentFilePath(false)).absFileName();
|
||||
bool xfig = false;
|
||||
external = FileName(absfigname).exists();
|
||||
if (t.cs() == "input") {
|
||||
if (!skipChildren())
|
||||
external = FileName(absfigname).exists();
|
||||
if (t.cs() == "input" && !skipChildren()) {
|
||||
string const ext = getExtension(abstexname);
|
||||
|
||||
// Combined PS/LaTeX:
|
||||
@ -3867,6 +3868,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
FileName abssrc(abstexname);
|
||||
copy_file(abssrc, outname);
|
||||
} else if (t.cs() != "verbatiminput" &&
|
||||
!skipChildren() &&
|
||||
tex2lyx(abstexname, FileName(abslyxname),
|
||||
p.getEncoding())) {
|
||||
outname = lyxname;
|
||||
|
Loading…
Reference in New Issue
Block a user