#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:
default:
LASSERT(false, /**/);
}
- static const ParamInfo pi;
+ static ParamInfo pi;
return pi; // to silence the warning
}
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:
void InsetCommandParams::setCmdName(string const & name)
{
- if (!isCompatibleCommand(insetCode_, cmdName_)) {
+ if (!isCompatibleCommand(insetCode_, name)) {
LYXERR0("InsetCommand: Incompatible command name " <<
name << ".");
throw ExceptionMessage(WarningException, _("InsetCommand Error: "),
}
-
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) {
// issue a warning about omitted characters
// FIXME: should be passed to the error dialog
frontend::Alert::warning(_("Uncodable characters"),
- bformat(_("The following characters that are used in an inset (%1$s) are\n"
- "not representable in the current encoding and have been omitted:\n%2$s."),
+ bformat(_("The following characters that are used in the inset %1$s are not\n"
+ "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 + ']';