replace insetVerbatim with InsetText methods (bug 1731), fix LaTeX output problems

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9144 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2004-10-30 13:27:30 +00:00
parent 876a495c6b
commit 29285691b1
2 changed files with 22 additions and 49 deletions

View File

@ -1,3 +1,10 @@
2004-10-30 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetcharstyle.C (latex, linuxdoc, docbook, plaintext): use
InsetText methods rather than outputVerbatim (escapes special
characters) [bug 1731]
* insetcharstyle.C (outputVerbatim): remove this function.
2004-10-29 José Matos <jamatos@lyx.org>
* insetgraphics.C (uniqueID): transfered to sgml.C
@ -5,7 +12,7 @@
2004-10-29 Andreas Vox <vox@isp.uni-luebeck.de>
* insetlabel.C (docbook, linuxdoc):
* insetref.C (docbook, linuxdoc) sanitize id.
* insetref.C (docbook, linuxdoc): sanitize id.
2004-10-29 Georg Baum <Georg.Baum@post.rwth-aachen.de>

View File

@ -163,77 +163,43 @@ void InsetCharStyle::priv_dispatch(LCursor & cur, FuncRequest & cmd)
}
namespace {
int outputVerbatim(std::ostream & os, InsetText const & inset)
int InsetCharStyle::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
int lines = 0;
ParagraphList::const_iterator par = inset.paragraphs().begin();
ParagraphList::const_iterator end = inset.paragraphs().end();
while (par != end) {
lyx::pos_type siz = par->size();
for (lyx::pos_type i = 0; i < siz; ++i) {
if (par->isNewline(i)) {
os << '\n';
++lines;
} else {
os << par->getChar(i);
}
}
++par;
if (par != end) {
os << "\n";
lines ++;
}
}
return lines;
}
} // namespace anon
int InsetCharStyle::latex(Buffer const &, ostream & os,
OutputParams const &) const
{
os << "%\n\\" << params_.latexname;
os << "\\" << params_.latexname;
if (!params_.latexparam.empty())
os << params_.latexparam;
os << "{";
int i = outputVerbatim(os, *this);
os << "}%\n";
i += 2;
int i = InsetText::latex(buf, os, runparams);
os << "}";
return i;
}
int InsetCharStyle::linuxdoc(Buffer const &, std::ostream & os,
OutputParams const &) const
int InsetCharStyle::linuxdoc(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
ostringstream oss;
int i = outputVerbatim(oss, *this);
sgml::openTag(os, params_.latexname, params_.latexparam);
os << sgml::escapeString(oss.str());
int i = InsetText::linuxdoc(buf, os, runparams);
sgml::closeTag(os, params_.latexname);
return i;
}
int InsetCharStyle::docbook(Buffer const &, std::ostream & os,
OutputParams const &) const
int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
ostringstream oss;
int i = outputVerbatim(oss, *this);
sgml::openTag(os, params_.latexname, params_.latexparam);
os << sgml::escapeString(oss.str());
int i = InsetText::docbook(buf, os, runparams);
sgml::closeTag(os, params_.latexname);
return i;
}
int InsetCharStyle::plaintext(Buffer const &, std::ostream & os,
OutputParams const & /*runparams*/) const
int InsetCharStyle::plaintext(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
return outputVerbatim(os, *this);
return InsetText::plaintext(buf, os, runparams);
}