-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sections with spaces to not be interpreted as optargs
- Loading branch information
Showing
3 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package TeXCalc.latex.command; | ||
|
||
public class OptCommand extends Command { | ||
|
||
public OptCommand(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public String to(String s) { | ||
// TODO Auto-generated method stub | ||
String w = ""; | ||
if(s.contains(" ")) { | ||
String[] args = s.split(" "); | ||
if(!args[args.length-1].trim().equals("")) | ||
w += "["+ args[args.length-1] + "]"; | ||
for(int i =0; i < args.length-1;++i) { | ||
//if(!args[i].trim().equals("")) | ||
w += "{" + args[i] + "}"; | ||
} | ||
} | ||
else { | ||
w = "{" + s + "}"; | ||
} | ||
return "\\" + name + w + "\n"; | ||
} | ||
|
||
} |