mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Add constant for escaped <
This commit is contained in:
@@ -160,7 +160,7 @@ class TagStack {
|
||||
String html_escape(const String& str) {
|
||||
String ret;
|
||||
FOR_EACH_CONST(c, str) {
|
||||
if (c == _('\1') || c == _('<')) { // escape <
|
||||
if (c == ESCAPED_LANGLE || c == _('<')) { // escape <
|
||||
ret += _("<");
|
||||
} else if (c == _('>')) { // escape >
|
||||
ret += _(">");
|
||||
@@ -209,8 +209,8 @@ String to_html(const String& str_in, const SymbolFontP& symbol_font, double symb
|
||||
String str = remove_tag_contents(str_in,_("<sep-soft"));
|
||||
String ret;
|
||||
Tag bold (_("<b>"), _("</b>")),
|
||||
italic(_("<i>"), _("</i>")),
|
||||
symbol(_("<span class=\"symbol\">"), _("</span>"));
|
||||
italic(_("<i>"), _("</i>")),
|
||||
symbol(_("<span class=\"symbol\">"), _("</span>"));
|
||||
TagStack tags;
|
||||
String symbols;
|
||||
for (size_t i = 0 ; i < str.size() ; ) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <script/parser.hpp>
|
||||
#include <script/to_value.hpp>
|
||||
#include <util/error.hpp>
|
||||
#include <util/tagged_string.hpp>
|
||||
#include <util/io/package_manager.hpp> // for "include file" semi hack
|
||||
#include <stack>
|
||||
|
||||
@@ -281,7 +282,7 @@ void TokenIterator::readStringToken(bool string_mode) {
|
||||
else if (c == _('r')) str += _('\r');
|
||||
else if (c == _('t')) str += _('\t');
|
||||
else if (c == _('&')); // escape for nothing
|
||||
else if (c == _('<')) str += _('\1'); // escape for < in tagged string
|
||||
else if (c == _('<')) str += ESCAPED_LANGLE; // escape for < in tagged string
|
||||
else if (c == _('\\') || c == _('"') || c == _('\'') || c == _('{') || c == _('}')) {
|
||||
str += c; // \ or { or " or ', don't warn about these, since they look escape-worthy
|
||||
} else if (c >= '0' && c <= '9') {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/tagged_string.hpp>
|
||||
#include <script/value.hpp>
|
||||
#include <script/to_value.hpp>
|
||||
#include <script/context.hpp>
|
||||
@@ -305,7 +306,7 @@ String quote_string(String const& str) {
|
||||
out += _('"');
|
||||
FOR_EACH_CONST(c, str) {
|
||||
if (c == _('"') || c == _('\\')) { out += _('\\'); out += c; }
|
||||
else if (c == _('\1')) out += _("\\<");
|
||||
else if (c == ESCAPED_LANGLE) out += _("\\<");
|
||||
else if (c == _('\n')) out += _("\\n");
|
||||
else if (c == _('\r')) out += _("\\r");
|
||||
else if (c == _('\t')) out += _("\\t");
|
||||
|
||||
Reference in New Issue
Block a user