mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
* comments
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23625 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c17df2980b
commit
29dca708f7
@ -2407,13 +2407,20 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
|
|
||||||
else if (t.cs() == "newcommandx" ||
|
else if (t.cs() == "newcommandx" ||
|
||||||
t.cs() == "renewcommandx") {
|
t.cs() == "renewcommandx") {
|
||||||
|
// \newcommandx{\foo}[2][usedefault, addprefix=\global,1=default]{#1,#2}
|
||||||
|
|
||||||
|
// get command name
|
||||||
string command;
|
string command;
|
||||||
if (p.next_token().cat() == catBegin)
|
if (p.next_token().cat() == catBegin)
|
||||||
command = p.verbatim_item();
|
command = p.verbatim_item();
|
||||||
else
|
else
|
||||||
command = "\\" + p.get_token().cs();
|
command = "\\" + p.get_token().cs();
|
||||||
|
|
||||||
|
// get arity, we do not check that it fits to the given
|
||||||
|
// optional parameters here.
|
||||||
string const opt1 = p.getOpt();
|
string const opt1 = p.getOpt();
|
||||||
|
|
||||||
|
// get options and default values for optional parameters
|
||||||
std::vector<string> optionalValues;
|
std::vector<string> optionalValues;
|
||||||
int optionalsNum = 0;
|
int optionalsNum = 0;
|
||||||
if (p.next_token().character() == '[') {
|
if (p.next_token().character() == '[') {
|
||||||
@ -2479,10 +2486,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
|||||||
p.get_token();
|
p.get_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// concat the default values to the optionals string
|
||||||
string optionals;
|
string optionals;
|
||||||
for (unsigned i = 0; i < optionalValues.size(); ++i)
|
for (unsigned i = 0; i < optionalValues.size(); ++i)
|
||||||
optionals += "[" + optionalValues[i] + "]";
|
optionals += "[" + optionalValues[i] + "]";
|
||||||
|
|
||||||
|
// register and output command
|
||||||
add_known_command(command, opt1, optionalsNum);
|
add_known_command(command, opt1, optionalsNum);
|
||||||
string const ert = "\\newcommand{" + command + '}' + opt1
|
string const ert = "\\newcommand{" + command + '}' + opt1
|
||||||
+ optionals + '{' + p.verbatim_item() + '}';
|
+ optionals + '{' + p.verbatim_item() + '}';
|
||||||
|
Loading…
Reference in New Issue
Block a user