void InsetInclude::read(LyXLex & lex)
{
if (lex.isOK()) {
- lex.next();
+ lex.eatLine();
string const command = lex.getString();
params_.scanCommand(command);
}
string token;
while (lex.isOK()) {
- lex.eatLine();
+ lex.next();
token = lex.getString();
if (token == "\\end_inset")
break;
int InsetInclude::latex(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(to_utf8(params_["filename"]));
int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (isVerbatim(params_)) {
+ os << '[' << getScreenLabel(buffer) << '\n';
// FIXME: We don't know the encoding of the file
- docstring const str = from_utf8(
- getFileContents(includedFilename(buffer, params_)));
+ docstring const str =
+ from_utf8(getFileContents(includedFilename(buffer, params_)));
os << str;
- // Return how many newlines we issued.
- return int(lyx::count(str.begin(), str.end(), '\n'));
+ os << "\n]";
+ return PLAINTEXT_NEWLINE + 1; // one char on a separate line
+ } else {
+ docstring const str = '[' + getScreenLabel(buffer) + ']';
+ os << str;
+ return str.size();
}
- return 0;
}
int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile = to_utf8(params_["filename"]);
docstring const latex_string(InsetInclude const & inset, Buffer const & buffer)
{
odocstringstream os;
- OutputParams runparams;
+ OutputParams runparams(0);
runparams.flavor = OutputParams::LATEX;
inset.latex(buffer, os, runparams);