mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
misc: adjust text formatting in tagged_string
This commit is contained in:
@@ -645,7 +645,10 @@ String simplify_tagged(const String& str) {
|
|||||||
// (where </tag> is the negation of tag)
|
// (where </tag> is the negation of tag)
|
||||||
bool add_or_cancel_tag(const String& tag, String& stack, bool all = false) {
|
bool add_or_cancel_tag(const String& tag, String& stack, bool all = false) {
|
||||||
if (all || starts_with(tag, _("/")) ||
|
if (all || starts_with(tag, _("/")) ||
|
||||||
starts_with(tag, _("b")) || starts_with(tag, _("i")) || starts_with(tag, _("sym")) || starts_with(tag, _("u"))) {
|
starts_with(tag, _("b")) ||
|
||||||
|
starts_with(tag, _("i")) ||
|
||||||
|
starts_with(tag, _("u")) ||
|
||||||
|
starts_with(tag, _("sym"))) {
|
||||||
// cancel out all close tags, but not all open tags,
|
// cancel out all close tags, but not all open tags,
|
||||||
// so <xx></xx> is always removed
|
// so <xx></xx> is always removed
|
||||||
// but </xx><xx> is not
|
// but </xx><xx> is not
|
||||||
@@ -692,8 +695,10 @@ String simplify_tagged_overlap(const String& str) {
|
|||||||
Char c = str.GetChar(i);
|
Char c = str.GetChar(i);
|
||||||
if (c == _('<')) {
|
if (c == _('<')) {
|
||||||
String tag = tag_at(str, i);
|
String tag = tag_at(str, i);
|
||||||
if (starts_with(tag, _("b")) || starts_with(tag, _("i")) || starts_with(tag, _("sym")) || starts_with(tag, _("u")) ||
|
if (starts_with(tag, _("b")) || starts_with(tag, _("/b")) ||
|
||||||
starts_with(tag, _("/b")) || starts_with(tag, _("/i")) || starts_with(tag, _("/sym")) || starts_with(tag, _("/u"))) {
|
starts_with(tag, _("i")) || starts_with(tag, _("/i")) ||
|
||||||
|
starts_with(tag, _("u")) || starts_with(tag, _("/u")) ||
|
||||||
|
starts_with(tag, _("sym")) || starts_with(tag, _("/sym"))) {
|
||||||
// optimize this tag
|
// optimize this tag
|
||||||
if (open_tags.find(_("<") + tag + _(">")) == String::npos) {
|
if (open_tags.find(_("<") + tag + _(">")) == String::npos) {
|
||||||
// we are not already inside this tag
|
// we are not already inside this tag
|
||||||
|
|||||||
Reference in New Issue
Block a user