#include "InsetInclude.h"
#include "InsetIndex.h"
#include "InsetLabel.h"
+#include "InsetLine.h"
#include "InsetNomencl.h"
#include "InsetRef.h"
#include "InsetTOC.h"
return InsetPrintIndex::findInfo(cmdName);
case LABEL_CODE:
return InsetLabel::findInfo(cmdName);
+ case LINE_CODE:
+ return InsetLine::findInfo(cmdName);
case NOMENCL_CODE:
return InsetNomencl::findInfo(cmdName);
case NOMENCL_PRINT_CODE:
return InsetPrintIndex::defaultCommand();
case LABEL_CODE:
return InsetLabel::defaultCommand();
+ case LINE_CODE:
+ return InsetLine::defaultCommand();
case NOMENCL_CODE:
return InsetNomencl::defaultCommand();
case NOMENCL_PRINT_CODE:
return InsetPrintIndex::isCompatibleCommand(s);
case LABEL_CODE:
return InsetLabel::isCompatibleCommand(s);
+ case LINE_CODE:
+ return InsetLine::isCompatibleCommand(s);
case NOMENCL_CODE:
return InsetNomencl::isCompatibleCommand(s);
case NOMENCL_PRINT_CODE:
}
-
docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
docstring const & command,
ParamInfo::ParamHandling handling) const
{
docstring result;
- if (handling == ParamInfo::HANDLING_LATEXIFY) {
+ switch (handling) {
+ case ParamInfo::HANDLING_LATEXIFY: {
docstring uncodable;
for (size_t n = 0; n < command.size(); ++n) {
try {
- result += runparams.encoding->latexChar(command[n]);
+ char_type const c = command[n];
+ docstring const latex = runparams.encoding->latexChar(c);
+ result += latex;
+ if (latex.length() > 1 && latex[latex.length() - 1] != '}') {
+ // Prevent eating of a following
+ // space or command corruption by
+ // following characters
+ result += "{}";
+ }
} catch (EncodingException & /* e */) {
LYXERR0("Uncodable character in command inset!");
if (runparams.dryrun) {
"representable in the current encoding and therefore have been omitted:\n%2$s."),
from_utf8(insetType()), uncodable));
}
- } else if (handling == ParamInfo::HANDLING_ESCAPE)
+ break;
+ }
+ case ParamInfo::HANDLING_ESCAPE:
result = escape(command);
- else
+ break;
+ case ParamInfo::HANDLING_NONE:
result = command;
+ break;
+ } // switch
return result;
}
break;
case ParamInfo::LATEX_REQUIRED: {
- docstring const & data =
+ docstring const data =
prepareCommand(runparams, (*this)[name], it->handling());
s += '{' + data + '}';
noparam = false;
break;
}
case ParamInfo::LATEX_OPTIONAL: {
- docstring const & data =
+ docstring const data =
prepareCommand(runparams, (*this)[name], it->handling());
if (!data.empty()) {
s += '[' + data + ']';