mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 01:39:47 -05:00
resurrecting consolidated documentation (#897)
* Resurrecting consolidated documentation, lots to improve still but better then before
This commit is contained in:
committed by
Alexander Bock
parent
1308317b87
commit
1149a61dce
@@ -70,6 +70,14 @@ public:
|
||||
*/
|
||||
void addDocumentation(Documentation documentation);
|
||||
|
||||
/* Adds the \p templates to the list of templates that are written to the
|
||||
* documentation html file.
|
||||
* \param templates Vector of templates to add. Most of the time this list
|
||||
* will just contain one item, but some modules may wish to provide
|
||||
* multiple templates for subtypes, etc
|
||||
*/
|
||||
void addHandlebarTemplates(std::vector<HandlebarTemplate> templates);
|
||||
|
||||
/**
|
||||
* Returns a list of all registered Documentation%s.
|
||||
*
|
||||
@@ -88,11 +96,25 @@ public:
|
||||
*/
|
||||
static DocumentationEngine& ref();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Generates the documentation html file. Generated file will have embeded
|
||||
* in it: HandlebarJS Templates (from _handlebarTemplates) and json (from
|
||||
* \p data) along with the base template and js/css files from the source
|
||||
* directory ${WEB}/documentation
|
||||
* \param templates Vector of templates to add. Most of the time this list
|
||||
* will just contain one item, but some modules may wish to provide
|
||||
* multiple templates for subtypes, etc
|
||||
*/
|
||||
void writeDocumentationHtml(const std::string path, const std::string data);
|
||||
|
||||
std::string generateJson() const override;
|
||||
|
||||
private:
|
||||
|
||||
/// The list of all Documentation%s that are stored by the DocumentationEngine
|
||||
std::vector<Documentation> _documentations;
|
||||
/// The list of templates to render the documentation with.
|
||||
std::vector<HandlebarTemplate> _handlebarTemplates;
|
||||
|
||||
static DocumentationEngine* _instance;
|
||||
};
|
||||
|
||||
@@ -67,20 +67,16 @@ public:
|
||||
* \pre javascriptFilename must not be empty
|
||||
*/
|
||||
DocumentationGenerator(std::string name, std::string jsonName,
|
||||
std::vector<HandlebarTemplate> handlebarTemplates,
|
||||
std::string javascriptFilename);
|
||||
std::vector<HandlebarTemplate> handlebarTemplates);
|
||||
|
||||
/// Default constructor
|
||||
virtual ~DocumentationGenerator() = default;
|
||||
|
||||
/**
|
||||
* Create the documentation into the provided filename. Any existing file will be
|
||||
* silently overwritten. This method will call the generateJson method that can be
|
||||
* used by concrete subclasses to provide the actual data that is provided in the
|
||||
* documentation.
|
||||
* \param filename The filename in which the documentation is written
|
||||
*/
|
||||
void writeDocumentation(const std::string& filename);
|
||||
//getter for handlebar templates
|
||||
std::vector<HandlebarTemplate> templatesToRegister();
|
||||
|
||||
//getter for identifier
|
||||
std::string jsonName();
|
||||
|
||||
/**
|
||||
* This abstract method is used by concrete subclasses to provide the actual data that
|
||||
@@ -96,7 +92,6 @@ private:
|
||||
const std::string _name;
|
||||
const std::string _jsonName;
|
||||
const std::vector<HandlebarTemplate> _handlebarTemplates;
|
||||
const std::string _javascriptFile;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,16 +52,10 @@ struct Configuration {
|
||||
};
|
||||
Logging logging;
|
||||
|
||||
std::string scriptLog = "";
|
||||
std::string scriptLog;
|
||||
|
||||
struct DocumentationInfo {
|
||||
std::string lua = "";
|
||||
std::string property = "";
|
||||
std::string sceneProperty = "";
|
||||
std::string keyboard = "";
|
||||
std::string documentation = "";
|
||||
std::string factory = "";
|
||||
std::string license = "";
|
||||
std::string path;
|
||||
};
|
||||
DocumentationInfo documentation;
|
||||
|
||||
@@ -99,8 +93,8 @@ struct Configuration {
|
||||
bool isActive = false;
|
||||
bool isSynchronous = true;
|
||||
struct IdentifierFilter {
|
||||
std::string type = "";
|
||||
std::string source = "";
|
||||
std::string type;
|
||||
std::string source;
|
||||
unsigned int identifier = 0;
|
||||
};
|
||||
std::vector<IdentifierFilter> identifierFilters;
|
||||
|
||||
@@ -115,6 +115,9 @@ private:
|
||||
bool _hasScheduledAssetLoading = false;
|
||||
std::string _scheduledAssetPathToLoad;
|
||||
|
||||
//grabs json from each module to pass to the documentation engine.
|
||||
std::string _documentationJson;
|
||||
|
||||
ShutdownInformation _shutdown;
|
||||
|
||||
// The first frame might take some more time in the update loop, so we need to know to
|
||||
|
||||
@@ -291,6 +291,9 @@ public:
|
||||
*/
|
||||
void removeTag(const std::string& tag);
|
||||
|
||||
//Generate JSON for documentation
|
||||
std::string generateJson() const override;
|
||||
|
||||
|
||||
protected:
|
||||
/// The unique identifier of this PropertyOwner
|
||||
@@ -301,8 +304,6 @@ protected:
|
||||
std::string _description;
|
||||
|
||||
private:
|
||||
std::string generateJson() const override;
|
||||
|
||||
/// The owner of this PropertyOwner
|
||||
PropertyOwner* _owner = nullptr;
|
||||
/// A list of all registered Property's
|
||||
|
||||
@@ -147,12 +147,12 @@ public:
|
||||
const std::vector<SceneGraphNode*>& allSceneGraphNodes() const;
|
||||
|
||||
/**
|
||||
* Write information about the license information for the scenegraph nodes that are
|
||||
* Generate JSON about the license information for the scenegraph nodes that are
|
||||
* contained in this scene
|
||||
* \param path The file path that will contain the documentation about the licenses
|
||||
* used in this scene
|
||||
*/
|
||||
void writeSceneLicenseDocumentation(const std::string& path) const;
|
||||
std::string generateSceneLicenseDocumentationJson();
|
||||
|
||||
/**
|
||||
* Returns a map from identifier to scene graph node.
|
||||
|
||||
@@ -36,10 +36,9 @@ struct SceneLicense;
|
||||
class SceneLicenseWriter : public DocumentationGenerator {
|
||||
public:
|
||||
SceneLicenseWriter(std::vector<SceneLicense> licenses);
|
||||
|
||||
private:
|
||||
std::string generateJson() const override;
|
||||
|
||||
private:
|
||||
const std::vector<SceneLicense>& _licenses;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user