mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
fix problems with ] in optional latex arguments
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8919 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3f9e3449d5
commit
0786aa3247
@ -19,6 +19,14 @@
|
||||
|
||||
2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* paragraph_pimpl.C (simpleTeXSpecialChars): remove special
|
||||
treatment for ']'
|
||||
|
||||
* paragraph.C (simpleTeXOnePar): when we have a \item with
|
||||
optional argument, enclose the argument with curly brackets (in
|
||||
case it contains a closing square bracket)
|
||||
|
||||
* text2.C (editXY):
|
||||
* text2.C (editXY):
|
||||
* text3.C (checkInsetHit): constify
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* insettext.C (editXY):
|
||||
* insetoptarg.C (latexOptional): if the optional argument contains
|
||||
a ']' enclose it in {curly brackets}
|
||||
|
||||
* insettext.C (editXY):
|
||||
* insettabular.C (editXY):
|
||||
* insetcollapsable.C (editXY):
|
||||
* insetbase.C (editXY): constify
|
||||
|
@ -17,10 +17,12 @@
|
||||
#include "LColor.h"
|
||||
#include "paragraph.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
|
||||
|
||||
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
||||
@ -72,8 +74,11 @@ int InsetOptArg::latex(Buffer const &, ostream &,
|
||||
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << '[';
|
||||
int const i = InsetText::latex(buf, os, runparams);
|
||||
os << ']';
|
||||
return i + 2;
|
||||
ostringstream ss;
|
||||
InsetText::latex(buf, ss, runparams);
|
||||
string str = ss.str();
|
||||
if (str.find(']') != string::npos)
|
||||
str = '{' + str + '}';
|
||||
os << '[' << str << ']';
|
||||
return str.length() + 2;
|
||||
}
|
||||
|
@ -920,8 +920,10 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
|
||||
unsigned int column = 0;
|
||||
|
||||
if (body_pos > 0) {
|
||||
os << '[';
|
||||
++column;
|
||||
// the optional argument is kept in curly brackets in
|
||||
// case it contains a ']'
|
||||
os << "[{";
|
||||
column += 2;
|
||||
basefont = getLabelFont(bparams, outerfont);
|
||||
} else {
|
||||
basefont = getLayoutFont(bparams, outerfont);
|
||||
@ -959,8 +961,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
|
||||
}
|
||||
basefont = getLayoutFont(bparams, outerfont);
|
||||
running_font = basefont;
|
||||
os << ']';
|
||||
++column;
|
||||
os << "}] ";
|
||||
column +=3;
|
||||
}
|
||||
if (style->isCommand()) {
|
||||
os << '{';
|
||||
|
@ -666,7 +666,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
|
||||
column += 17;
|
||||
break;
|
||||
|
||||
case '*': case '[': case ']':
|
||||
case '*': case '[':
|
||||
// avoid being mistaken for optional arguments
|
||||
os << '{' << c << '}';
|
||||
column += 2;
|
||||
|
Loading…
Reference in New Issue
Block a user