InsetCommandParams)
* src/mathed/InsetMathCommand.[Ch]
(CommandInset::createDialogStr): Move to InsetMathRef, since it is
no longer generic.
* src/mathed/MathFactory.C
(createInsetMath_fromDialogStr): Use InsetCommandMailer instead of
manual parsing. This ensures that the syntax is correct.
* src/mathed/InsetMathRef.[Ch]
(InsetMathRef::createDialogStr): Moved here from InsetMathCommand,
but use InsetCommandMailer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17738
a592a061-630c-0410-9148-
cb99ea01b6c8
return name_;
}
-
-string const CommandInset::createDialogStr(string const & name) const
-{
- odocstringstream os;
- os << from_ascii(name + " LatexCommand ");
- WriteStream ws(os);
- write(ws);
- return to_utf8(os.str()) + "\n\\end_inset\n\n";
-}
-
-
} // namespace lyx
// void infoize(odocstream & os) const;
///
virtual docstring const screenLabel() const;
- /// generate something that will be understood by the Dialogs.
- std::string const createDialogStr(std::string const & name) const;
///
docstring const & commandname() const { return name_; }
private:
#include "outputparams.h"
#include "sgml.h"
+#include "insets/insetcommand.h"
+
namespace lyx {
}
+string const RefInset::createDialogStr(string const & name) const
+{
+ InsetCommandParams icp(to_ascii(commandname()));
+ icp["reference"] = asString(cell(0));
+ if (!cell(1).empty())
+ icp["name"] = asString(cell(1));
+ return InsetCommandMailer::params2string(name, icp);
+}
+
+
RefInset::ref_type_info RefInset::types[] = {
{ from_ascii("ref"), from_ascii(N_("Standard")), from_ascii(N_("Ref: "))},
{ from_ascii("eqref"), from_ascii(N_("Equation")), from_ascii(N_("EqRef: "))},
/// docbook output
int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
+ /// generate something that will be understood by the Dialogs.
+ std::string const createDialogStr(std::string const & name) const;
struct ref_type_info {
///
#include "debug.h"
+#include "insets/insetcommand.h"
+
#include "support/filetools.h" // LibFileSearch
#include "support/lstrings.h"
bool createInsetMath_fromDialogStr(docstring const & str, MathArray & ar)
{
// An example str:
- // "ref LatexCommand \\ref{sec:Title}\n\\end_inset\n\n";
+ // "ref LatexCommand ref\nreference \"sec:Title\"\n\\end_inset\n\n";
docstring name;
docstring body = split(str, name, ' ');
if (name != "ref" )
return false;
- // body comes with a head "LatexCommand " and a
- // tail "\nend_inset\n\n". Strip them off.
- docstring trimmed;
- body = split(body, trimmed, ' ');
- split(body, trimmed, '\n');
-
- mathed_parse_cell(ar, trimmed);
+ InsetCommandParams icp("ref");
+ // FIXME UNICODE
+ InsetCommandMailer::string2params("ref", to_utf8(str), icp);
+ mathed_parse_cell(ar, icp.getCommand());
if (ar.size() != 1)
return false;