Add the reporting of the actual documentation in the DocumentationEngine

This commit is contained in:
Alexander Bock
2016-10-26 16:58:53 +02:00
parent db4524d2ac
commit f03073508a
2 changed files with 15 additions and 3 deletions

View File

@@ -83,6 +83,7 @@ std::string generateTextDocumentation(const Documentation& d, int& indentLevel)
result += indentMessage("Key", (p.key == "*") ? p.key : "\"" + p.key + "\"");
result += indentMessage("Optional", (p.optional ? "true" : "false"));
result += indentMessage("Type", p.verifier->type());
result += indentMessage("Documentation", p.documentation);
TableVerifier* tv = dynamic_cast<TableVerifier*>(p.verifier.get());
ReferencingVerifier* rv = dynamic_cast<ReferencingVerifier*>(p.verifier.get());
@@ -134,6 +135,7 @@ std::string generateJsonDocumentation(const Documentation& d) {
result << "\"key\": \"" << p.key << "\",";
result << "\"optional\": " << (p.optional ? "true" : "false") << ",";
result << "\"type\": \"" << p.verifier->type() << "\",";
result << "\"documentation\": \"" << p.documentation << "\",";
TableVerifier* tv = dynamic_cast<TableVerifier*>(p.verifier.get());
ReferencingVerifier* rv = dynamic_cast<ReferencingVerifier*>(p.verifier.get());
@@ -167,6 +169,7 @@ std::string generateJsonDocumentation(const Documentation& d) {
if (&p != &d.entries.back()) {
result << ", ";
}
}
result << ']';
@@ -186,6 +189,7 @@ std::string generateHtmlDocumentation(const Documentation& d) {
<< "\t\t<td></td>\n"
<< "\t\t<td>" << p.key << "</td>\n"
<< "\t\t<td>" << (p.optional ? "Optional" : "Required") << "</td>\n"
<< "\t\t<td>" << p.documentation << "</td>\n"
<< "\t\t<td>" << p.verifier->type() << "</td>\n";
TableVerifier* tv = dynamic_cast<TableVerifier*>(p.verifier.get());
@@ -366,6 +370,13 @@ void DocumentationEngine::writeDocumentation(const std::string& f, const std::st
}
void DocumentationEngine::addDocumentation(Documentation doc) {
for (const DocumentationEntry& e : doc.entries) {
ghoul_assert(
e.documentation.find('"') == std::string::npos,
"Documentation cannot contain \" character"
);
}
if (doc.id.empty()) {
_documentations.push_back(std::move(doc));
}

View File

@@ -42,7 +42,8 @@ Documentation ConfigurationManager::Documentation() {
{
ConfigurationManager::KeyConfigScene,
new StringAnnotationVerifier(
"A valid scene file as described in the Scene documentation"),
"A valid scene file as described in the Scene documentation"
),
"The scene description that is used to populate the application after "
"startup. The scene determines which objects are loaded, the startup "
"time and other scene-specific settings. More information is provided in "
@@ -303,8 +304,8 @@ Documentation ConfigurationManager::Documentation() {
}),
"The method for scaling the onscreen text in the window. As the resolution "
"of the rendering can be different from the size of the window, the onscreen "
"text can either be scaled according to the window size (\"window\"), or the "
"rendering resolution (\"framebuffer\"). This value defaults to \"window\".",
"text can either be scaled according to the window size ('window'), or the "
"rendering resolution ('framebuffer'). This value defaults to 'window'.",
Optional::Yes
},
{