summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-02-14 14:18:53 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-02-15 00:03:31 +0100
commitb68dd2e1894450dd69ffddf05a45c40e6c01a36a (patch)
treea08d5005f4b46dfa2fe9180250541eb6851ee905 /editor
parent6e73aa0497b9cfc1c28863e655991106e677e69c (diff)
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the class reference. The schema is referenced locally so validation can still work offline. Each class XML's schema conformance is also checked on GitHub Actions.
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_tools.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index 749ab7e2f6..36ae19cb23 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -1356,7 +1356,12 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
header += " inherits=\"" + c.inherits + "\"";
}
header += String(" version=\"") + VERSION_BRANCH + "\"";
- header += ">";
+ // Reference the XML schema so editors can provide error checking.
+ // Modules are nested deep, so change the path to reference the same schema everywhere.
+ const String schema_path = save_path.find("modules/") != -1 ? "../../../doc/class.xsd" : "../class.xsd";
+ header += vformat(
+ R"( xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="%s">)",
+ schema_path);
_write_string(f, 0, header);
_write_string(f, 1, "<brief_description>");