Added support for separators that are part of a parameter;

Keywords match whole words only;
Added english_singular/plural functions;
Fixed possible infinite loop in reader

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@347 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-12 20:17:49 +00:00
parent 175e246579
commit 2d48f27fe0
7 changed files with 329 additions and 101 deletions
+2 -1
View File
@@ -132,6 +132,7 @@ void Reader::readLine(bool in_string) {
}
key = cannocial_name_form(trim(key));
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
if (key.empty() && pos!=String::npos) key = _(" "); // we don't want an empty key if there was a colon
}
void Reader::unknownKey() {
@@ -162,7 +163,7 @@ void Reader::unknownKey() {
return;
}
}
if (indent == expected_indent) {
if (indent >= expected_indent) {
warning(_("Unexpected key: '") + key + _("'"));
do {
moveNext();
-5
View File
@@ -386,11 +386,6 @@ String remove_tag_contents(const String& str, const String& tag) {
// ----------------------------------------------------------------------------- : Updates
/// Return all open or close tags in the given range from a string
/** for example:
* if close_tags == false, "text<tag>text</tag>text" --> "<tag>"
* if close_tags == true, "text<tag>text</tag>text" --> "</tag>"
*/
String get_tags(const String& str, size_t start, size_t end, bool open_tags, bool close_tags) {
String ret;
bool intag = false;
+7
View File
@@ -143,6 +143,13 @@ String remove_tag_contents(const String& str, const String& tag);
// ----------------------------------------------------------------------------- : Updates
/// Return all open or close tags in the given range from a string
/** for example:
* if close_tags == false, "text<tag>text</tag>text" --> "<tag>"
* if close_tags == true, "text<tag>text</tag>text" --> "</tag>"
*/
String get_tags(const String& str, size_t start, size_t end, bool open_tags, bool close_tags);
/// Replace a subsection of 'input' with 'replacement'.
/** The section to replace is indicated by [start...end).
* This function makes sure tags still match. It also attempts to cancel out tags.