#include "Lexer.h"
#include "output_xhtml.h"
#include "ParIterator.h"
+#include "TexRow.h"
+#include "texstream.h"
#include "TextClass.h"
#include "support/debug.h"
docstring deferred = InsetText::insetAsXHTML(newxs, rp, opts);
newxs << html::EndTag(htmltype);
- if (rp.inFloat == OutputParams::NONFLOAT)
+ if (rp.inFloat == OutputParams::NONFLOAT) {
// In this case, this float needs to be deferred, but we'll put it
// before anything the text itself deferred.
deferred = ods.str() + '\n' + deferred;
- else
+ } else {
// In this case, the whole thing is already being deferred, so
// we can write to the stream.
// Note that things will already have been escaped, so we do not
// want to escape them again.
xs << XHTMLStream::ESCAPE_NONE << ods.str();
+ }
return deferred;
}
void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
{
if (runparams_in.inFloat != OutputParams::NONFLOAT) {
+ if (!paragraphs().empty() && !runparams_in.nice)
+ // improve TexRow precision in non-nice mode
+ os << safebreakln;
+
if (runparams_in.moving_arg)
os << "\\protect";
os << "\\subfloat";
OutputParams rp = runparams_in;
rp.moving_arg = true;
- docstring const caption = getCaption(rp);
- if (!caption.empty()) {
- os << caption;
- }
+ os << getCaption(rp);
os << '{';
// The main argument is the contents of the float. This is not a moving argument.
rp.moving_arg = false;
bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const
{
- return !params_.subfloat && newtype != "LongTableNoNumber";
+ return !params_.subfloat && newtype != "Unnumbered";
}
-docstring InsetFloat::getCaption(OutputParams const & runparams) const
+TexString InsetFloat::getCaption(OutputParams const & runparams) const
{
- if (paragraphs().empty())
- return docstring();
-
InsetCaption const * ins = getCaptionInset();
if (ins == 0)
- return docstring();
+ return TexString();
- TexRow texrow;
- odocstringstream ods;
- otexstream os(ods, texrow);
+ otexstringstream os;
ins->getArgs(os, runparams);
- ods << '[';
- odocstringstream odss;
- otexstream oss(odss, texrow);
- ins->getArgument(oss, runparams);
- docstring arg = odss.str();
+
+ if (!runparams.nice)
+ // increase TexRow precision in non-nice mode
+ os << safebreakln;
+ os << '[';
+ otexstringstream os2;
+ ins->getArgument(os2, runparams);
+ TexString ts = os2.release();
+ docstring & arg = ts.str;
// Protect ']'
if (arg.find(']') != docstring::npos)
arg = '{' + arg + '}';
- ods << arg;
- ods << ']';
- return ods.str();
+ os << move(ts);
+ os << ']';
+ if (!runparams.nice)
+ os << safebreakln;
+ return os.release();
}