mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 02:29:49 -06:00
Remove handlebars and refactor
This commit is contained in:
@@ -71,14 +71,6 @@ 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.
|
||||
*
|
||||
@@ -97,17 +89,6 @@ public:
|
||||
*/
|
||||
static DocumentationEngine& ref();
|
||||
|
||||
/**
|
||||
* 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 path The path to add
|
||||
* \param data The JSON data that is written to the documentation
|
||||
*/
|
||||
void writeDocumentationHtml(const std::string& path, std::string data);
|
||||
|
||||
std::string generateJson() const override;
|
||||
|
||||
nlohmann::json generateJsonJson() const;
|
||||
@@ -116,12 +97,9 @@ 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;
|
||||
};
|
||||
|
||||
} // namespace openspace::documentation
|
||||
|
||||
#define DocEng (openspace::documentation::DocumentationEngine::ref())
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef __OPENSPACE_CORE___DOCUMENTATIONGENERATOR___H__
|
||||
#define __OPENSPACE_CORE___DOCUMENTATIONGENERATOR___H__
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -46,35 +47,24 @@ namespace openspace {
|
||||
*/
|
||||
class DocumentationGenerator {
|
||||
public:
|
||||
/// This struct contains a single Handlebar template, with the name and the filename
|
||||
struct HandlebarTemplate {
|
||||
std::string name; ///< The name of the Handlebar template defined in #filename
|
||||
std::string filename; ///< The filename referenced in the #name
|
||||
};
|
||||
|
||||
static const std::string NameTag;
|
||||
static const std::string DataTag;
|
||||
/**
|
||||
* The constructor that is used to set the member variables later used in the
|
||||
* writeDocumentation method.
|
||||
*
|
||||
* \param name The name of the written documentation
|
||||
* \param jsonName The variable name of the value generated by the generateJson
|
||||
* \param handlebarTemplates A list of Handlebar templates that is added to the
|
||||
* documentation file
|
||||
*
|
||||
* \pre name must not be empty
|
||||
* \pre jsonName must not be empty
|
||||
* \pre Each handlebarTemplates' `name` must not be empty
|
||||
* \pre javascriptFilename must not be empty
|
||||
*/
|
||||
DocumentationGenerator(std::string name, std::string jsonName,
|
||||
std::vector<HandlebarTemplate> handlebarTemplates);
|
||||
DocumentationGenerator(std::string name, std::string jsonName);
|
||||
|
||||
/// Default constructor
|
||||
virtual ~DocumentationGenerator() = default;
|
||||
|
||||
//getter for handlebar templates
|
||||
std::vector<HandlebarTemplate> templatesToRegister();
|
||||
|
||||
//getter for identifier
|
||||
std::string jsonName();
|
||||
|
||||
@@ -89,10 +79,10 @@ public:
|
||||
*/
|
||||
virtual std::string generateJson() const = 0;
|
||||
|
||||
void sortJson(nlohmann::json& json) const;
|
||||
private:
|
||||
const std::string _name;
|
||||
const std::string _jsonName;
|
||||
const std::vector<HandlebarTemplate> _handlebarTemplates;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user