#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:
}
-
docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
docstring const & command,
ParamInfo::ParamHandling handling) const
{
docstring result;
- if (handling == ParamInfo::HANDLING_LATEXIFY) {
- docstring uncodable;
- for (size_t n = 0; n < command.size(); ++n) {
- try {
- result += runparams.encoding->latexChar(command[n]);
- } catch (EncodingException & /* e */) {
- LYXERR0("Uncodable character in command inset!");
- if (runparams.dryrun) {
- result += "<" + _("LyX Warning: ")
- + _("uncodable character") + " '";
- result += docstring(1, command[n]);
- result += "'>";
- } else
- uncodable += command[n];
- }
- }
- if (!uncodable.empty()) {
+ switch (handling) {
+ case ParamInfo::HANDLING_LATEXIFY: {
+ pair<docstring, docstring> command_latexed =
+ runparams.encoding->latexString(command, runparams.dryrun);
+ result = command_latexed.first;
+ if (!command_latexed.second.empty()) {
// 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 the inset %1$s are not\n"
"representable in the current encoding and therefore have been omitted:\n%2$s."),
- from_utf8(insetType()), uncodable));
+ from_utf8(insetType()), command_latexed.second));
}
- } 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 + ']';