mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
The roundtrip of the math manual produces a compilable document now:
- translate the arguments of \texorpdfstring, so that the floating footnote code gets enabled - honor the ForcePlainLayout flag of insets like the Index inset - remove hardcoded \url support, this is handled by the general Flex inset code git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37297 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d8e5e13690
commit
87944eedc7
@ -358,8 +358,18 @@ $$
|
|||||||
%
|
%
|
||||||
% Arguments whose text is "translate" will have regular LaTeX in them (as
|
% Arguments whose text is "translate" will have regular LaTeX in them (as
|
||||||
% opposed to commands with special syntax) which should be translated by
|
% opposed to commands with special syntax) which should be translated by
|
||||||
% reLyX like regular LaTeX. \mbox{} is an obvious example. LyX doesn't
|
% tex2lyx like regular LaTeX. \mbox{} is an obvious example. LyX doesn't
|
||||||
% support it, but only the "\mbox{" and the "}" need to be in TeX mode.
|
% support it, but only the "\mbox{" and the "}" need to be in TeX mode.
|
||||||
|
% "translate" should be specified for as many arguments aspossible.
|
||||||
|
% Besides the better on-screen display of the contents (a math inset looks
|
||||||
|
% better than a formula in ERT), it enables LyX to apply some fixes to LaTeX
|
||||||
|
% limitations: For example, footnotes in section headings do not work in
|
||||||
|
% LaTeX, but LyX produces preamble code to fix that. Of course this works only
|
||||||
|
% for footnote insets and not for footnotes in ERT. Example:
|
||||||
|
% \section{title \texorpdfstring{\footnote{foo}}{bar}}
|
||||||
|
% is some code that may occur in a .tex file created by LyX. The re-import
|
||||||
|
% works only because the first argument of \texorpdfstring is specified as
|
||||||
|
% translatable in this file.
|
||||||
|
|
||||||
\abstractname
|
\abstractname
|
||||||
\Acrobatmenu{}{} % from the hyperref package
|
\Acrobatmenu{}{} % from the hyperref package
|
||||||
@ -640,7 +650,7 @@ $$
|
|||||||
\tableofcontents
|
\tableofcontents
|
||||||
\tabularnewline[]
|
\tabularnewline[]
|
||||||
\telephone{translate}
|
\telephone{translate}
|
||||||
\texorpdfstring{}{} % from the hyperref package
|
\texorpdfstring{translate}{translate} % from the hyperref package
|
||||||
\textcircled{translate}
|
\textcircled{translate}
|
||||||
\textcolor[]{,,}{translate}
|
\textcolor[]{,,}{translate}
|
||||||
%\textcolor{}{}
|
%\textcolor{}{}
|
||||||
|
@ -63,7 +63,8 @@ void parse_text(Parser & p, std::ostream & os, unsigned flags, bool outer,
|
|||||||
* Therefore this may only be used to parse text in insets or table cells.
|
* Therefore this may only be used to parse text in insets or table cells.
|
||||||
*/
|
*/
|
||||||
void parse_text_in_inset(Parser & p, std::ostream & os, unsigned flags,
|
void parse_text_in_inset(Parser & p, std::ostream & os, unsigned flags,
|
||||||
bool outer, Context const & context);
|
bool outer, Context const & context,
|
||||||
|
InsetLayout const * layout = 0);
|
||||||
|
|
||||||
|
|
||||||
/// in math.cpp
|
/// in math.cpp
|
||||||
|
@ -41,10 +41,15 @@ namespace lyx {
|
|||||||
|
|
||||||
|
|
||||||
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
Context const & context)
|
Context const & context, InsetLayout const * layout)
|
||||||
{
|
{
|
||||||
|
bool const forcePlainLayout =
|
||||||
|
layout ? layout->forcePlainLayout() : false;
|
||||||
Context newcontext(true, context.textclass);
|
Context newcontext(true, context.textclass);
|
||||||
newcontext.font = context.font;
|
if (forcePlainLayout)
|
||||||
|
newcontext.layout = &context.textclass.plainLayout();
|
||||||
|
else
|
||||||
|
newcontext.font = context.font;
|
||||||
parse_text(p, os, flags, outer, newcontext);
|
parse_text(p, os, flags, outer, newcontext);
|
||||||
newcontext.check_end_layout(os);
|
newcontext.check_end_layout(os);
|
||||||
}
|
}
|
||||||
@ -52,6 +57,17 @@ void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
|
Context const & context, string const & name)
|
||||||
|
{
|
||||||
|
InsetLayout const * layout = 0;
|
||||||
|
DocumentClass::InsetLayouts::const_iterator it =
|
||||||
|
context.textclass.insetLayouts().find(from_ascii(name));
|
||||||
|
if (it != context.textclass.insetLayouts().end())
|
||||||
|
layout = &(it->second);
|
||||||
|
parse_text_in_inset(p, os, flags, outer, context, layout);
|
||||||
|
}
|
||||||
|
|
||||||
/// parses a paragraph snippet, useful for example for \\emph{...}
|
/// parses a paragraph snippet, useful for example for \\emph{...}
|
||||||
void parse_text_snippet(Parser & p, ostream & os, unsigned flags, bool outer,
|
void parse_text_snippet(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||||
Context & context)
|
Context & context)
|
||||||
@ -2419,7 +2435,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
begin_inset(os, "Index\n");
|
begin_inset(os, "Index\n");
|
||||||
os << "status collapsed\n";
|
os << "status collapsed\n";
|
||||||
parse_text_in_inset(p, os, FLAG_ITEM, false, context);
|
parse_text_in_inset(p, os, FLAG_ITEM, false, context, "Index");
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2457,14 +2473,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
skip_spaces_braces(p);
|
skip_spaces_braces(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "url") {
|
|
||||||
context.check_layout(os);
|
|
||||||
begin_inset(os, "Flex URL\n");
|
|
||||||
os << "status collapsed\n";
|
|
||||||
parse_text_in_inset(p, os, FLAG_ITEM, false, context);
|
|
||||||
end_inset(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (LYX_FORMAT >= 408 &&
|
else if (LYX_FORMAT >= 408 &&
|
||||||
(t.cs() == "textsuperscript" || t.cs() == "textsubscript")) {
|
(t.cs() == "textsuperscript" || t.cs() == "textsubscript")) {
|
||||||
context.check_layout(os);
|
context.check_layout(os);
|
||||||
@ -3149,7 +3157,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
begin_inset(os, "Flex ");
|
begin_inset(os, "Flex ");
|
||||||
os << to_utf8(newinsetlayout->name()) << '\n'
|
os << to_utf8(newinsetlayout->name()) << '\n'
|
||||||
<< "status collapsed\n";
|
<< "status collapsed\n";
|
||||||
parse_text_in_inset(p, os, FLAG_ITEM, false, context);
|
parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout);
|
||||||
end_inset(os);
|
end_inset(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user