namespace {
typedef Translator<std::string, InsetNoteParams::Type> NoteTranslator;
+typedef Translator<docstring, InsetNoteParams::Type> NoteTranslatorLoc;
NoteTranslator const init_notetranslator()
{
}
-NoteTranslator const init_notetranslator_loc()
+NoteTranslatorLoc const init_notetranslator_loc()
{
- // FIXME UNICODE
- NoteTranslator translator(to_utf8(_("Note")), InsetNoteParams::Note);
- translator.addPair(to_utf8(_("Comment")), InsetNoteParams::Comment);
- translator.addPair(to_utf8(_("Greyed out")), InsetNoteParams::Greyedout);
- translator.addPair(to_utf8(_("Framed")), InsetNoteParams::Framed);
- translator.addPair(to_utf8(_("Shaded")), InsetNoteParams::Shaded);
+ NoteTranslatorLoc translator(_("Note"), InsetNoteParams::Note);
+ translator.addPair(_("Comment"), InsetNoteParams::Comment);
+ translator.addPair(_("Greyed out"), InsetNoteParams::Greyedout);
+ translator.addPair(_("Framed"), InsetNoteParams::Framed);
+ translator.addPair(_("Shaded"), InsetNoteParams::Shaded);
return translator;
}
}
-NoteTranslator const & notetranslator_loc()
+NoteTranslatorLoc const & notetranslator_loc()
{
- static NoteTranslator translator = init_notetranslator_loc();
+ static NoteTranslatorLoc translator = init_notetranslator_loc();
return translator;
}
{
string label;
lex >> label;
- if (lex)
+ if (lex.isOK())
type = notetranslator().find(label);
}
void InsetNote::init()
{
- setInsetName(from_utf8("Note"));
+ setInsetName(from_ascii("Note"));
setButtonLabel();
}
void InsetNote::setButtonLabel()
{
- // FIXME unicode
- docstring const label = from_utf8(notetranslator_loc().find(params_.type));
+ docstring const label = notetranslator_loc().find(params_.type);
setLabel(label);
LyXFont font(LyXFont::ALL_SANE);
docstring const str = ss.str();
os << str;
+ runparams_in.encoding = runparams.encoding;
// Return how many newlines we issued.
return int(lyx::count(str.begin(), str.end(), '\n'));
}
-int InsetNote::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+int InsetNote::plaintext(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
OutputParams runparams(runparams_in);
if (params_.type == InsetNoteParams::Comment) {
- os << "<remark>\n";
runparams.inComment = true;
// Ignore files that are exported inside a comment
runparams.exportdata.reset(new ExportData);
}
+ os << '[' << _("note") << ":\n";
+ InsetText::plaintext(buf, os, runparams);
+ os << "\n]";
- int const n = InsetText::docbook(buf, os, runparams);
-
- if (params_.type == InsetNoteParams::Comment)
- os << "\n</remark>\n";
-
- // Return how many newlines we issued.
- //return int(count(str.begin(), str.end(), '\n'));
- return n + 1 + 2;
+ return PLAINTEXT_NEWLINE + 1; // one char on a separate line
}
-int InsetNote::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+int InsetNote::docbook(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams_in) const
{
if (params_.type == InsetNoteParams::Note)
return 0;
OutputParams runparams(runparams_in);
if (params_.type == InsetNoteParams::Comment) {
+ os << "<remark>\n";
runparams.inComment = true;
// Ignore files that are exported inside a comment
runparams.exportdata.reset(new ExportData);
}
- os << "[";
- int const nlines = InsetText::plaintext(buf, os, runparams);
- os << "]";
+
+ int const n = InsetText::docbook(buf, os, runparams);
+
+ if (params_.type == InsetNoteParams::Comment)
+ os << "\n</remark>\n";
// Return how many newlines we issued.
- return nlines;
+ //return int(count(str.begin(), str.end(), '\n'));
+ return n + 1 + 2;
}