InsetQuote works again.

Is this simple stream modifier thing OK?


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-11-19 23:29:07 +00:00
parent 6d4db0ee44
commit 603b94966a
4 changed files with 48 additions and 15 deletions

View File

@ -26,6 +26,7 @@
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "output_xhtml.h"
#include "support/debug.h"
#include "support/docstream.h"
@ -688,31 +689,32 @@ int InsetSpace::docbook(odocstream & os, OutputParams const &) const
}
docstring InsetSpace::xhtml(odocstream & os, OutputParams const &) const
docstring InsetSpace::xhtml(XHTMLStream & xs, OutputParams const &) const
{
string output;
switch (params_.kind) {
case InsetSpaceParams::NORMAL:
os << " ";
output = " ";
break;
case InsetSpaceParams::ENSKIP:
case InsetSpaceParams::ENSPACE:
os << "&ensp;";
output ="&ensp;";
break;
case InsetSpaceParams::QQUAD:
os << "&emsp;";
output ="&emsp;";
case InsetSpaceParams::THICK:
case InsetSpaceParams::QUAD:
os << "&emsp;";
output ="&emsp;";
break;
case InsetSpaceParams::THIN:
os << "&thinsp;";
output ="&thinsp;";
break;
case InsetSpaceParams::PROTECTED:
case InsetSpaceParams::MEDIUM:
case InsetSpaceParams::NEGTHIN:
case InsetSpaceParams::NEGMEDIUM:
case InsetSpaceParams::NEGTHICK:
os << "&nbsp;";
output ="&nbsp;";
break;
case InsetSpaceParams::HFILL:
case InsetSpaceParams::HFILL_PROTECTED:
@ -722,14 +724,17 @@ docstring InsetSpace::xhtml(odocstream & os, OutputParams const &) const
case InsetSpaceParams::RIGHTARROWFILL:
case InsetSpaceParams::UPBRACEFILL:
case InsetSpaceParams::DOWNBRACEFILL:
// FIXME Can we do anything with those in HTML?
os << '\n';
// FIXME XHTML
// Can we do anything with those in HTML?
break;
case InsetSpaceParams::CUSTOM:
case InsetSpaceParams::CUSTOM_PROTECTED:
// FIXME Probably we could do some sort of blank span?
os << '\n';
// FIXME XHTML
// Probably we could do some sort of blank span?
break;
}
// don't escape the entities!
xs << XHTMLStream::NextRaw() << from_ascii(output);
return docstring();
}

View File

@ -129,7 +129,7 @@ public:
///
int docbook(odocstream &, OutputParams const &) const;
///
docstring xhtml(odocstream &, OutputParams const &) const;
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
/// the string that is passed to the TOC

View File

@ -187,7 +187,11 @@ void XHTMLStream::clearTagDeque()
XHTMLStream & XHTMLStream::operator<<(docstring const & d)
{
clearTagDeque();
os_ << html::htmlize(d);
if (nextraw_) {
os_ << d;
nextraw_ = false;
} else
os_ << html::htmlize(d);
return *this;
}
@ -195,7 +199,12 @@ XHTMLStream & XHTMLStream::operator<<(docstring const & d)
XHTMLStream & XHTMLStream::operator<<(const char * s)
{
clearTagDeque();
os_ << html::htmlize(from_ascii(s));
docstring const d = from_ascii(s);
if (nextraw_) {
os_ << d;
nextraw_ = false;
} else
os_ << html::htmlize(d);
return *this;
}
@ -203,7 +212,18 @@ XHTMLStream & XHTMLStream::operator<<(const char * s)
XHTMLStream & XHTMLStream::operator<<(char_type c)
{
clearTagDeque();
os_ << html::escapeChar(c);
if (nextraw_) {
os_ << c;
nextraw_ = false;
} else
os_ << html::escapeChar(c);
return *this;
}
XHTMLStream & XHTMLStream::operator<<(NextRaw const &)
{
nextraw_ = true;
return *this;
}

View File

@ -101,6 +101,12 @@ public:
XHTMLStream & operator<<(EndTag const &);
///
XHTMLStream & operator<<(CompTag const &);
/// A trivial struct that functions as a stream modifier.
/// << NextRaw() causes the next string-like thing sent to the
/// stream not to be escaped.
struct NextRaw {};
///
XHTMLStream & operator<<(NextRaw const &);
private:
///
void clearTagDeque();
@ -120,6 +126,8 @@ private:
TagDeque pending_tags_;
/// remembers the history, so we can make sure we nest properly.
TagStack tag_stack_;
///
bool nextraw_;
};
///