mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Increase tex2lyx output format to 288.
278: Nothing to do, tex2lyx writes already an \end_deeper for each \begin_deeper 279-280: Nothing to do, tex2lyx does not produce character styles yet 281-282: Nothing to do (empty lyx2lyx conversion) 283: Nothing to do, tex2lyx does not produce character styles yet 284-286: Nothing to do (empty lyx2lyx conversion) 287: Nothing to do, tex2lyx does not produce wrapped figures yet 288: Use new syntax for command inset This time, the (not format related) bug fix is to parse the starred jurabib and natbib citation commands correctly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36927 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e1505e5e4d
commit
7610b9add5
@ -146,5 +146,18 @@ and bibliography:
|
|||||||
|
|
||||||
blub
|
blub
|
||||||
|
|
||||||
|
Test for missing \textbackslash end\_deeper (file format 278).
|
||||||
|
This must stay at the very end of the document!
|
||||||
|
\begin{itemize}
|
||||||
|
\item par1
|
||||||
|
|
||||||
|
par2
|
||||||
|
\begin{enumerate}
|
||||||
|
\item par1
|
||||||
|
|
||||||
|
par2
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -114,7 +114,7 @@ extern CommandMap known_math_environments;
|
|||||||
///
|
///
|
||||||
extern bool noweb_mode;
|
extern bool noweb_mode;
|
||||||
/// LyX format that is created by tex2lyx
|
/// LyX format that is created by tex2lyx
|
||||||
int const LYX_FORMAT = 277;
|
int const LYX_FORMAT = 288;
|
||||||
|
|
||||||
/// path of the master .tex file
|
/// path of the master .tex file
|
||||||
extern std::string getMasterFilePath();
|
extern std::string getMasterFilePath();
|
||||||
|
@ -95,7 +95,8 @@ char const * const known_ref_commands[] = { "ref", "pageref", "vref",
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* natbib commands.
|
* natbib commands.
|
||||||
* The starred forms are also known.
|
* The starred forms are also known except for "citefullauthor",
|
||||||
|
* "citeyear" and "citeyearpar".
|
||||||
*/
|
*/
|
||||||
char const * const known_natbib_commands[] = { "cite", "citet", "citep",
|
char const * const known_natbib_commands[] = { "cite", "citet", "citep",
|
||||||
"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar",
|
"citealt", "citealp", "citeauthor", "citeyear", "citeyearpar",
|
||||||
@ -111,7 +112,7 @@ char const * const known_jurabib_commands[] = { "cite", "citet", "citep",
|
|||||||
// "fullcite",
|
// "fullcite",
|
||||||
// "footcite", "footcitet", "footcitep", "footcitealt", "footcitealp",
|
// "footcite", "footcitet", "footcitep", "footcitealt", "footcitealp",
|
||||||
// "footciteauthor", "footciteyear", "footciteyearpar",
|
// "footciteauthor", "footciteyear", "footciteyearpar",
|
||||||
"citefield", "citetitle", "cite*", 0 };
|
"citefield", "citetitle", 0 };
|
||||||
|
|
||||||
/// LaTeX names for quotes
|
/// LaTeX names for quotes
|
||||||
char const * const known_quotes[] = { "dq", "guillemotleft", "flqq", "og",
|
char const * const known_quotes[] = { "dq", "guillemotleft", "flqq", "og",
|
||||||
@ -355,13 +356,13 @@ void begin_inset(ostream & os, string const & name)
|
|||||||
os << "\n\\begin_inset " << name;
|
os << "\n\\begin_inset " << name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*// use this void when format 288 is supported
|
|
||||||
void begin_command_inset(ostream & os, string const & name,
|
void begin_command_inset(ostream & os, string const & name,
|
||||||
string const & latexname)
|
string const & latexname)
|
||||||
{
|
{
|
||||||
os << "\n\\begin_inset CommandInset " << name;
|
begin_inset(os, "CommandInset ");
|
||||||
os << "\nLatexCommand " << latexname << "\n";
|
os << name << "\nLatexCommand " << latexname << '\n';
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
void end_inset(ostream & os)
|
void end_inset(ostream & os)
|
||||||
@ -1502,8 +1503,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
else if (t.cs() == "bibitem") {
|
else if (t.cs() == "bibitem") {
|
||||||
context.set_item();
|
context.set_item();
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "bibitem", "bibitem");
|
||||||
os << t.cs() << "\n";
|
|
||||||
os << "label \"" << p.getOptContent() << "\"\n";
|
os << "label \"" << p.getOptContent() << "\"\n";
|
||||||
os << "key \"" << p.verbatim_item() << "\"\n";
|
os << "key \"" << p.verbatim_item() << "\"\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
@ -1857,8 +1857,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
else if (t.cs() == "tableofcontents") {
|
else if (t.cs() == "tableofcontents") {
|
||||||
p.skip_spaces();
|
p.skip_spaces();
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "toc", "tableofcontents");
|
||||||
os << t.cs() << "\n";
|
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
skip_braces(p); // swallow this
|
skip_braces(p); // swallow this
|
||||||
}
|
}
|
||||||
@ -1996,8 +1995,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (is_known(t.cs(), known_ref_commands)) {
|
else if (is_known(t.cs(), known_ref_commands)) {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "ref", t.cs());
|
||||||
os << t.cs() << "\n";
|
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
// FIXME: Move the substitution into parser::getOpt()?
|
// FIXME: Move the substitution into parser::getOpt()?
|
||||||
os << subst(p.getOpt(), "\n", " ");
|
os << subst(p.getOpt(), "\n", " ");
|
||||||
@ -2057,8 +2055,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
// LyX cannot handle newlines in the parameter
|
// LyX cannot handle newlines in the parameter
|
||||||
before = subst(before, "\n", " ");
|
before = subst(before, "\n", " ");
|
||||||
}
|
}
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "citation", command);
|
||||||
os << t.cs() << "\n";
|
|
||||||
os << "after " << '"' << after << '"' << "\n";
|
os << "after " << '"' << after << '"' << "\n";
|
||||||
os << "before " << '"' << before << '"' << "\n";
|
os << "before " << '"' << before << '"' << "\n";
|
||||||
os << "key " << '"' << p.verbatim_item() << '"' << "\n";
|
os << "key " << '"' << p.verbatim_item() << '"' << "\n";
|
||||||
@ -2066,9 +2063,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (use_jurabib &&
|
else if (use_jurabib &&
|
||||||
is_known(t.cs(), known_jurabib_commands)) {
|
is_known(t.cs(), known_jurabib_commands) &&
|
||||||
|
(t.cs() == "cite" || p.next_token().asInput() != "*")) {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
string const command = t.cs();
|
string command = t.cs();
|
||||||
|
if (p.next_token().asInput() == "*") {
|
||||||
|
command += '*';
|
||||||
|
p.get_token();
|
||||||
|
}
|
||||||
char argumentOrder = '\0';
|
char argumentOrder = '\0';
|
||||||
vector<string> const & options = used_packages["jurabib"];
|
vector<string> const & options = used_packages["jurabib"];
|
||||||
if (find(options.begin(), options.end(),
|
if (find(options.begin(), options.end(),
|
||||||
@ -2102,8 +2104,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
before.erase(0, 1);
|
before.erase(0, 1);
|
||||||
before.erase(before.length() - 1, 1);
|
before.erase(before.length() - 1, 1);
|
||||||
}
|
}
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "citation", command);
|
||||||
os << t.cs() << "\n";
|
|
||||||
os << "after " << '"' << after << '"' << "\n";
|
os << "after " << '"' << after << '"' << "\n";
|
||||||
os << "before " << '"' << before << '"' << "\n";
|
os << "before " << '"' << before << '"' << "\n";
|
||||||
os << "key " << '"' << citation << '"' << "\n";
|
os << "key " << '"' << citation << '"' << "\n";
|
||||||
@ -2114,8 +2115,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
string after = subst(p.getOptContent(), "\n", " ");
|
string after = subst(p.getOptContent(), "\n", " ");
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "citation", "cite");
|
||||||
os << t.cs() << "\n";
|
|
||||||
os << "after " << '"' << after << '"' << "\n";
|
os << "after " << '"' << after << '"' << "\n";
|
||||||
os << "key " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
os << "key " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
@ -2123,8 +2123,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "index") {
|
else if (t.cs() == "index") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "index", "index");
|
||||||
os << t.cs() << "\n";
|
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
@ -2132,8 +2131,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "nomenclature") {
|
else if (t.cs() == "nomenclature") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "nomenclature", "nomenclature");
|
||||||
os << t.cs() << "\n";
|
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
string prefix = subst(p.getOptContent(), "\n", " ");
|
string prefix = subst(p.getOptContent(), "\n", " ");
|
||||||
if (!prefix.empty())
|
if (!prefix.empty())
|
||||||
@ -2145,8 +2143,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "label") {
|
else if (t.cs() == "label") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "label", "label");
|
||||||
os << t.cs() << "\n";
|
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
@ -2154,24 +2151,21 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "printindex") {
|
else if (t.cs() == "printindex") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "index_print", "printindex");
|
||||||
os << t.cs() << "\n";
|
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
skip_braces(p);
|
skip_braces(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "printnomenclature") {
|
else if (t.cs() == "printnomenclature") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "nomencl_print", "printnomenclature");
|
||||||
os << t.cs() << "\n";
|
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
skip_braces(p);
|
skip_braces(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "url") {
|
else if (t.cs() == "url") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "url", "url");
|
||||||
os << t.cs() << "\n";
|
|
||||||
// LyX cannot handle newlines in a latex command
|
// LyX cannot handle newlines in a latex command
|
||||||
os << "target " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
os << "target " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
@ -2551,7 +2545,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "bibliography") {
|
else if (t.cs() == "bibliography") {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "LatexCommand ");
|
begin_command_inset(os, "bibliography", "bibliography");
|
||||||
os << "bibtex" << "\n";
|
os << "bibtex" << "\n";
|
||||||
os << "bibfiles " << '"' << p.verbatim_item() << '"' << "\n";
|
os << "bibfiles " << '"' << p.verbatim_item() << '"' << "\n";
|
||||||
// Do we have a bibliographystyle set?
|
// Do we have a bibliographystyle set?
|
||||||
|
Loading…
Reference in New Issue
Block a user