#include "Font.h"
#include "InsetList.h"
#include "Language.h"
-#include "LaTeXFeatures.h"
-#include "Layout.h"
#include "LyXRC.h"
#include "OutputParams.h"
#include "Paragraph.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
#include "support/textutils.h"
#include "support/gettext.h"
struct OutputState
{
- OutputState() : open_encoding_(none), cjk_inherited_(0),
- prev_env_language_(nullptr), nest_level_(0)
+ OutputState() : prev_env_language_(nullptr), open_encoding_(none),
+ cjk_inherited_(0), nest_level_(0)
{
}
- OpenEncoding open_encoding_;
- int cjk_inherited_;
Language const * prev_env_language_;
- int nest_level_;
stack<int> lang_switch_depth_; // Both are always empty when
stack<string> open_polyglossia_lang_; // not using polyglossia
+ OpenEncoding open_encoding_;
+ int cjk_inherited_;
+ int nest_level_;
};
struct TeXEnvironmentData
{
- bool cjk_nested;
Layout const * style;
Language const * par_language;
Encoding const * prev_encoding;
+ bool cjk_nested;
bool leftindent_open;
};
popLanguageName();
}
}
+ if (data.style->latextype == LATEX_BIB_ENVIRONMENT)
+ // bibliography needs a blank line after
+ // each item for backref to function properly
+ // (see #12041)
+ os << '\n';
state->nest_level_ -= 1;
string const & name = data.style->latexname();
if (!name.empty())
void getArgInsets(otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs,
- map<int, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix)
+ map<size_t, lyx::InsetArgument const *> ilist, vector<string> required, string const & prefix)
{
- unsigned int const argnr = latexargs.size();
+ size_t const argnr = latexargs.size();
if (argnr == 0)
return;
}
}
- for (unsigned int i = 1; i <= argnr; ++i) {
- map<int, InsetArgument const *>::const_iterator lit = ilist.find(i);
+ for (size_t i = 1; i <= argnr; ++i) {
+ map<size_t, InsetArgument const *>::const_iterator lit = ilist.find(i);
bool inserted = false;
if (lit != ilist.end()) {
- InsetArgument const * ins = (*lit).second;
+ InsetArgument const * ins = lit->second;
if (ins) {
Layout::LaTeXArgMap::const_iterator const lait =
latexargs.find(ins->name());
if (lait != latexargs.end()) {
- Layout::latexarg arg = (*lait).second;
+ Layout::latexarg arg = lait->second;
docstring ldelim;
docstring rdelim;
if (!arg.nodelims) {
}
}
}
- if (runparams.for_search) {
+ if (runparams.for_search && argnr > 1) {
// Mark end of arguments for findadv() only
os << "\\endarguments{}";
}
void addArgInsets(Paragraph const & par, string const & prefix,
Layout::LaTeXArgMap const & latexargs,
- map<int, InsetArgument const *> & ilist,
+ map<size_t, InsetArgument const *> & ilist,
vector<string> & required)
{
for (auto const & table : par.insetList()) {
}
string const name = prefix.empty() ?
arg->name() : split(arg->name(), ':');
- // why converting into an integer?
- unsigned int const nr = convert<unsigned int>(name);
- if (ilist.find(nr) == ilist.end())
- ilist[nr] = arg;
+ size_t const nr = convert<size_t>(name);
+ ilist.insert({nr, arg});
Layout::LaTeXArgMap::const_iterator const lit =
latexargs.find(arg->name());
if (lit != latexargs.end()) {
Layout::LaTeXArgMap const & latexargs,
string const & prefix)
{
- map<int, InsetArgument const *> ilist;
+ map<size_t, InsetArgument const *> ilist;
vector<string> required;
addArgInsets(par, prefix, latexargs, ilist, required);
getArgInsets(os, runparams, latexargs, ilist, required, prefix);
Layout::LaTeXArgMap const & latexargs,
string const & prefix)
{
- map<int, InsetArgument const *> ilist;
+ map<size_t, InsetArgument const *> ilist;
vector<string> required;
depth_type const current_depth = pit->params().depth();
}
ParagraphList::const_iterator spit = prev(pit, offset);
-
for (; spit != pars.end(); ++spit) {
if (spit->layout() != current_layout ||
spit->params().depth() < current_depth)
Layout::LaTeXArgMap const & latexargs,
string const & prefix)
{
- map<int, InsetArgument const *> ilist;
+ map<size_t, InsetArgument const *> ilist;
vector<string> required;
for (Paragraph const & par : pars) {
// The full doc will be exported but it is easier to just rely on
// runparams range parameters that will be passed TeXEnvironment.
runparams.par_begin = 0;
- runparams.par_end = paragraphs.size();
+ runparams.par_end = static_cast<int>(paragraphs.size());
}
pit_type pit = runparams.par_begin;
os << '\n' << '\n';
continue;
}
+ } else {
+ // This is the last par
+ Paragraph const & cpar = paragraphs.at(pit);
+ if (!runparams.for_search && !cpar.empty()
+ && cpar.isDeleted(0, cpar.size()) && !bparams.output_changes) {
+ if (!cpar.parEndChange().deleted())
+ os << '\n' << '\n';
+ continue;
+ }
}
TeXEnvironmentData const data =
// shouldn't ever reach here (see above) but avoids warning.
return make_pair(true, 0);
case Encoding::inputenc: {
- int count = inputenc_arg.length();
+ size_t count = inputenc_arg.length();
if (oldEnc.package() == Encoding::CJK &&
state->open_encoding_ == CJK) {
os << "\\end{CJK}";
return make_pair(true, count + 16);
}
case Encoding::CJK: {
- int count = inputenc_arg.length();
+ size_t count = inputenc_arg.length();
if (oldEnc.package() == Encoding::CJK &&
state->open_encoding_ == CJK) {
os << "\\end{CJK}";