doc: Fix parsing of self-closing XML tags

Follow-up to #31925, `<member />` tags just before `</members>` would cause
a parsing issue, and we'd never notice that we're no longer parsing members.

Also added space before closing `/>`.
This commit is contained in:
Rémi Verschelde 2019-09-24 13:34:03 +02:00
parent 2f52d73c21
commit a7ac8ec876
104 changed files with 168 additions and 159 deletions

View file

@ -655,6 +655,15 @@
If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
</description>
</method>
<method name="repeat">
<return type="String">
</return>
<argument index="0" name="count" type="int">
</argument>
<description>
Returns original string repeated a number of times. The number of repetitions is given by the argument.
</description>
</method>
<method name="replace">
<return type="String">
</return>
@ -677,15 +686,6 @@
Replaces occurrences of a case-insensitive substring with the given one inside the string.
</description>
</method>
<method name="repeat">
<return type="String">
</return>
<argument index="0" name="count" type="int">
</argument>
<description>
Returns original string repeated a number of times. The number of repetitions is given by the argument.
</description>
</method>
<method name="rfind">
<return type="int">
</return>

View file

@ -8,6 +8,9 @@
</tutorials>
<methods>
</methods>
<members>
<member name="default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values" override="true" default="[ 0, false, 1, 1.0, 2, 0.0 ]" />
</members>
<constants>
</constants>
</class>

View file

@ -9,7 +9,7 @@
<methods>
</methods>
<members>
<member name="default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values" override="true" default="[ 0, false, 1, Vector3( 0, 0, 0 ), 2, Vector3( 0, 0, 0 ) ]"/>
<member name="default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values" override="true" default="[ 0, false, 1, Vector3( 1, 1, 1 ), 2, Vector3( 0, 0, 0 ) ]" />
</members>
<constants>
</constants>

View file

@ -872,7 +872,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials")
break; //end of <tutorials>
break; // End of <tutorials>.
}
} else if (name2 == "methods") {
@ -905,16 +905,18 @@ Error DocData::_load(Ref<XMLParser> parser) {
prop2.getter = parser->get_attribute_value("getter");
if (parser->has_attribute("enum"))
prop2.enumeration = parser->get_attribute_value("enum");
if (!parser->is_empty()) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
prop2.description = parser->get_node_data();
}
c.properties.push_back(prop2);
} else {
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "members")
break; //end of <constants>
break; // End of <members>.
}
} else if (name2 == "theme_items") {
@ -933,16 +935,18 @@ Error DocData::_load(Ref<XMLParser> parser) {
prop2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
prop2.type = parser->get_attribute_value("type");
if (!parser->is_empty()) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
prop2.description = parser->get_node_data();
}
c.theme_properties.push_back(prop2);
} else {
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "theme_items")
break; //end of <constants>
break; // End of <theme_items>.
}
} else if (name2 == "constants") {
@ -963,16 +967,18 @@ Error DocData::_load(Ref<XMLParser> parser) {
if (parser->has_attribute("enum")) {
constant2.enumeration = parser->get_attribute_value("enum");
}
if (!parser->is_empty()) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
constant2.description = parser->get_node_data();
}
c.constants.push_back(constant2);
} else {
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "constants")
break; //end of <constants>
break; // End of <constants>.
}
} else {
@ -981,7 +987,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "class")
break; //end of <asset>
break; // End of <class>.
}
}