mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-02-20 15:14:26 +01:00
Implement handling [color=white] like bbcode tags.
This commit is contained in:
parent
0e4222e5af
commit
33be242319
@ -167,7 +167,20 @@ void BBCodeParserTag::process() {
|
|||||||
|
|
||||||
if (fspc_index == -1) {
|
if (fspc_index == -1) {
|
||||||
// no args
|
// no args
|
||||||
tag = tag_text;
|
|
||||||
|
int feq_ind = tag_text.find('=');
|
||||||
|
if (feq_ind == -1) {
|
||||||
|
tag = tag_text;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tag is like: [color=white]
|
||||||
|
//tag will be like color
|
||||||
|
tag = tag_text.substr(0, feq_ind);
|
||||||
|
|
||||||
|
//Add color=white as argument
|
||||||
|
parse_args(tag_text);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +266,7 @@ void BBCodeParserTag::parse_args(const String &args) {
|
|||||||
// missing closing ' or " if c is ' or "
|
// missing closing ' or " if c is ' or "
|
||||||
// else missing parameter
|
// else missing parameter
|
||||||
|
|
||||||
a->data = args.substr(next_char_index, args.size() - next_char_index - 1);
|
a->data = args.substr(next_char_index, args.size() - next_char_index);
|
||||||
attributes.push_back(a);
|
attributes.push_back(a);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -323,7 +336,7 @@ String BBCodeParserTag::to_string(const int level) {
|
|||||||
|
|
||||||
if (tags.size() != 0) {
|
if (tags.size() != 0) {
|
||||||
s.append_repeat(" ", level);
|
s.append_repeat(" ", level);
|
||||||
|
|
||||||
for (int i = 0; i < tags.size(); ++i) {
|
for (int i = 0; i < tags.size(); ++i) {
|
||||||
s += tags[i]->to_string(level + 1) + "\n";
|
s += tags[i]->to_string(level + 1) + "\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user