From 98b59cf2a387e469851eee137cc6310cfc4b2a6d Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 11 Jun 2018 13:35:44 +0200 Subject: Add support for tutorial links to makerst.py Also change the structure to make use of individual tags --- editor/doc/doc_data.cpp | 25 +++++++++++++++++++++---- editor/doc/doc_data.h | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'editor/doc') diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index c992ac5f16..8a009cb82e 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -810,9 +810,24 @@ Error DocData::_load(Ref 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 + } } else if (name == "demos") { parser->read(); if (parser->get_node_type() == XMLParser::NODE_TEXT) @@ -987,7 +1002,9 @@ Error DocData::save_classes(const String &p_default_path, const Map"); _write_string(f, 1, ""); - _write_string(f, 2, c.tutorials.strip_edges().xml_escape()); + for (int i = 0; i < c.tutorials.size(); i++) { + _write_string(f, 2, "" + c.tutorials.get(i).xml_escape() + ""); + } _write_string(f, 1, ""); _write_string(f, 1, ""); _write_string(f, 2, c.demos.strip_edges().xml_escape()); diff --git a/editor/doc/doc_data.h b/editor/doc/doc_data.h index 0461133f9f..c7b70b5fb9 100644 --- a/editor/doc/doc_data.h +++ b/editor/doc/doc_data.h @@ -85,7 +85,7 @@ public: String category; String brief_description; String description; - String tutorials; + Vector tutorials; String demos; Vector methods; Vector signals; -- cgit v1.2.3