diff --git a/src/components/builder.cpp b/src/components/builder.cpp index 2180e9a6..e11abda3 100644 --- a/src/components/builder.cpp +++ b/src/components/builder.cpp @@ -91,97 +91,8 @@ void builder::node(string str, bool add_space) { return; } - string::size_type n, m; - string s(move(str)); + append(move(str)); - while (true) { - if (s.empty()) { - break; - - } else if ((n = s.find("%{F-}")) == 0) { - color_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{F#")) == 0 && (m = s.find('}')) != string::npos) { - if (m - n - 4 == 2) { - color_alpha(s.substr(n + 3, m - 3)); - } else { - color(s.substr(n + 3, m - 3)); - } - s.erase(n, m + 1); - - } else if ((n = s.find("%{B-}")) == 0) { - background_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{B#")) == 0 && (m = s.find('}')) != string::npos) { - background(s.substr(n + 3, m - 3)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{T-}")) == 0) { - font_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{T")) == 0 && (m = s.find('}')) != string::npos) { - font(strtol(s.substr(n + 3, m - 3).c_str(), nullptr, 10)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{U-}")) == 0) { - line_color_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{u-}")) == 0) { - underline_color_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{o-}")) == 0) { - overline_color_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{u#")) == 0 && (m = s.find('}')) != string::npos) { - underline_color(s.substr(n + 3, m - 3)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{o#")) == 0 && (m = s.find('}')) != string::npos) { - overline_color(s.substr(n + 3, m - 3)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{U#")) == 0 && (m = s.find('}')) != string::npos) { - line_color(s.substr(n + 3, m - 3)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{+u}")) == 0) { - underline(); - s.erase(0, 5); - - } else if ((n = s.find("%{+o}")) == 0) { - overline(); - s.erase(0, 5); - - } else if ((n = s.find("%{-u}")) == 0) { - underline_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{-o}")) == 0) { - overline_close(); - s.erase(0, 5); - - } else if ((n = s.find("%{")) == 0 && (m = s.find('}')) != string::npos) { - append(s.substr(n, m + 1)); - s.erase(n, m + 1); - - } else if ((n = s.find("%{")) > 0) { - append(s.substr(0, n)); - s.erase(0, n); - - } else { - break; - } - } - - if (!s.empty()) { - append(s); - } if (add_space) { space(); }