mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +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>
|
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):
|
* text2.C (editXY):
|
||||||
* text3.C (checkInsetHit): constify
|
* text3.C (checkInsetHit): constify
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
2004-08-13 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
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):
|
* insettabular.C (editXY):
|
||||||
* insetcollapsable.C (editXY):
|
* insetcollapsable.C (editXY):
|
||||||
* insetbase.C (editXY): constify
|
* insetbase.C (editXY): constify
|
||||||
|
@ -17,10 +17,12 @@
|
|||||||
#include "LColor.h"
|
#include "LColor.h"
|
||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::auto_ptr;
|
using std::auto_ptr;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
using std::ostringstream;
|
||||||
|
|
||||||
|
|
||||||
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
||||||
@ -72,8 +74,11 @@ int InsetOptArg::latex(Buffer const &, ostream &,
|
|||||||
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
|
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
os << '[';
|
ostringstream ss;
|
||||||
int const i = InsetText::latex(buf, os, runparams);
|
InsetText::latex(buf, ss, runparams);
|
||||||
os << ']';
|
string str = ss.str();
|
||||||
return i + 2;
|
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;
|
unsigned int column = 0;
|
||||||
|
|
||||||
if (body_pos > 0) {
|
if (body_pos > 0) {
|
||||||
os << '[';
|
// the optional argument is kept in curly brackets in
|
||||||
++column;
|
// case it contains a ']'
|
||||||
|
os << "[{";
|
||||||
|
column += 2;
|
||||||
basefont = getLabelFont(bparams, outerfont);
|
basefont = getLabelFont(bparams, outerfont);
|
||||||
} else {
|
} else {
|
||||||
basefont = getLayoutFont(bparams, outerfont);
|
basefont = getLayoutFont(bparams, outerfont);
|
||||||
@ -959,8 +961,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
|
|||||||
}
|
}
|
||||||
basefont = getLayoutFont(bparams, outerfont);
|
basefont = getLayoutFont(bparams, outerfont);
|
||||||
running_font = basefont;
|
running_font = basefont;
|
||||||
os << ']';
|
os << "}] ";
|
||||||
++column;
|
column +=3;
|
||||||
}
|
}
|
||||||
if (style->isCommand()) {
|
if (style->isCommand()) {
|
||||||
os << '{';
|
os << '{';
|
||||||
|
@ -666,7 +666,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
|
|||||||
column += 17;
|
column += 17;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '*': case '[': case ']':
|
case '*': case '[':
|
||||||
// avoid being mistaken for optional arguments
|
// avoid being mistaken for optional arguments
|
||||||
os << '{' << c << '}';
|
os << '{' << c << '}';
|
||||||
column += 2;
|
column += 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user