summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-11-01 07:58:27 +0100
committerGitHub <noreply@github.com>2017-11-01 07:58:27 +0100
commitf8ed1144dfb0497d7b6f7b8254cf509596682a9f (patch)
treefd3549fc53848ff2cda8d44ab007aa7fa85509b4 /editor
parent7a5594bdb79f0859ce67166b7fb6ed89098e5bcc (diff)
parent0804dd53364107001f31948a9ec9fe331bc92a4a (diff)
Merge pull request #12025 from leezh/dedent
Added String::dedent() to remove text indentation
Diffstat (limited to 'editor')
-rw-r--r--editor/doc/doc_data.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index d35dc53ae1..057b2d827d 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -615,6 +615,11 @@ void DocData::generate(bool p_basic_types) {
}
}
+static String _format_description(const String &string) {
+
+ return string.dedent().strip_edges().replace("\n", "\n\n");
+}
+
static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &methods) {
String section = parser->get_node_name();
@@ -661,7 +666,7 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
- method.description = parser->get_node_data().strip_edges();
+ method.description = _format_description(parser->get_node_data());
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == element)
@@ -776,12 +781,12 @@ Error DocData::_load(Ref<XMLParser> parser) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
- c.brief_description = parser->get_node_data().strip_edges();
+ c.brief_description = _format_description(parser->get_node_data());
} else if (name == "description") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
- c.description = parser->get_node_data().strip_edges();
+ c.description = _format_description(parser->get_node_data());
} else if (name == "tutorials") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
@@ -823,7 +828,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
prop.enumeration = parser->get_attribute_value("enum");
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
- prop.description = parser->get_node_data().strip_edges();
+ prop.description = _format_description(parser->get_node_data());
c.properties.push_back(prop);
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);