Merge pull request #19526 from robojumper/fix_tutorials
Add support for tutorial links to makerst.py
This commit is contained in:
@ -817,9 +817,24 @@ Error DocData::_load(Ref<XMLParser> parser) {
|
||||
if (parser->get_node_type() == XMLParser::NODE_TEXT)
|
||||
c.description = parser->get_node_data();
|
||||
} else if (name == "tutorials") {
|
||||
parser->read();
|
||||
if (parser->get_node_type() == XMLParser::NODE_TEXT)
|
||||
c.tutorials = parser->get_node_data();
|
||||
while (parser->read() == OK) {
|
||||
|
||||
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
||||
|
||||
String name = parser->get_node_name();
|
||||
|
||||
if (name == "link") {
|
||||
|
||||
parser->read();
|
||||
if (parser->get_node_type() == XMLParser::NODE_TEXT)
|
||||
c.tutorials.push_back(parser->get_node_data().strip_edges());
|
||||
} else {
|
||||
ERR_EXPLAIN("Invalid tag in doc file: " + name);
|
||||
ERR_FAIL_V(ERR_FILE_CORRUPT);
|
||||
}
|
||||
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials")
|
||||
break; //end of <tutorials>
|
||||
}
|
||||
} else if (name == "demos") {
|
||||
parser->read();
|
||||
if (parser->get_node_type() == XMLParser::NODE_TEXT)
|
||||
@ -994,7 +1009,9 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
|
||||
_write_string(f, 2, c.description.strip_edges().xml_escape());
|
||||
_write_string(f, 1, "</description>");
|
||||
_write_string(f, 1, "<tutorials>");
|
||||
_write_string(f, 2, c.tutorials.strip_edges().xml_escape());
|
||||
for (int i = 0; i < c.tutorials.size(); i++) {
|
||||
_write_string(f, 2, "<link>" + c.tutorials.get(i).xml_escape() + "</link>");
|
||||
}
|
||||
_write_string(f, 1, "</tutorials>");
|
||||
_write_string(f, 1, "<demos>");
|
||||
_write_string(f, 2, c.demos.strip_edges().xml_escape());
|
||||
|
||||
Reference in New Issue
Block a user