Skip to content

Commit 3be9da8

Browse files
author
Andres Sevillano
committed
CSS center
1 parent 8820935 commit 3be9da8

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

include/boilerplateCodeDoc.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ namespace boilerplateCodeDoc {
9494
struct JsonSchema2HTML final: public JsonSchemaFilter {
9595

9696
///@brief Default CSS id
97-
static constexpr const char* const CSS_ID {"boilerplate"};
97+
static constexpr const char* const CSS_CLASS {"boilerplate"};
9898

9999
///@brief Default HTML head+body header
100100
static constexpr const char* const HEADER {R"(
@@ -110,8 +110,10 @@ namespace boilerplateCodeDoc {
110110
padding: 5px;
111111
text-align: left;
112112
}
113-
table#boilerplate {
114-
width: 100%;
113+
table.boilerplate {
114+
width: 90%;
115+
margin-left: auto;
116+
margin-right: auto;
115117
}
116118
th {
117119
background-color: #f1f1c1;
@@ -148,14 +150,14 @@ namespace boilerplateCodeDoc {
148150
)"};
149151

150152
///@brief simplest constructor
151-
JsonSchema2HTML(std::string header_ = HEADER, std::string footer_ = FOOTER, std::string css_id_ = CSS_ID) :
152-
JsonSchemaFilter(header_, footer_), css_id{std::move(css_id_)} {}
153+
JsonSchema2HTML(std::string header_ = HEADER, std::string footer_ = FOOTER, std::string css_class_ = CSS_CLASS) :
154+
JsonSchemaFilter(header_, footer_), css_class{std::move(css_class_)} {}
153155

154156
///@brief filter to apply
155157
bool operator()(const JsonSchema& jsonSchema) override;
156158

157-
///@brief css id to be added to generated tables
158-
std::string css_id {};
159+
///@brief css class to be added to generated tables
160+
std::string css_class {};
159161
};
160162

161163
} // namespace

src/boilerplateCodeDoc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static void SetProperties(const rapidjson::Document& document, std::string eleme
331331
/****************************************************************************************/
332332
/****************************************************************************************/
333333

334-
static lambda_t html = [](const Properties& properties, std::string& filtered, std::string& css_id)
334+
static lambda_t html = [](const Properties& properties, std::string& filtered, std::string& css_class)
335335
{
336336
if(properties.size() > 0) {
337337

@@ -345,7 +345,7 @@ static lambda_t html = [](const Properties& properties, std::string& filtered, s
345345
if(not parentTitle.empty() || not bookmark_target.empty()) {
346346
filtered += "<h3 id=\"" + bookmark_target + "\">" + parentTitle + "</h3>\n";
347347
}
348-
filtered += "<table id=\"" + css_id + "\">\n";
348+
filtered += "<table class=\"" + css_class + "\">\n";
349349
filtered += "<tr><th>Field<th>Scope</th><th>Type</th><th>Description</th><th>Info</th></tr>\n";
350350

351351
// body
@@ -388,7 +388,7 @@ bool boilerplateCodeDoc::JsonSchema2HTML::operator()(const boilerplateCodeDoc::J
388388
//std::string element {"#/properties/imp/items/properties/native"};
389389
std::string element {"#"};
390390
filtered = header;
391-
SetProperties(document, element, filtered, html, css_id);
391+
SetProperties(document, element, filtered, html, css_class);
392392
filtered += footer;
393393

394394
error = boilerplateCodeDoc::ParseErrorCode::OK;

0 commit comments

Comments
 (0)