Skip to content

Commit

Permalink
handlebars generator descriptions in derived classes
Browse files Browse the repository at this point in the history
#refactor
  • Loading branch information
alandefreitas committed Jan 15, 2025
1 parent df7ed7d commit 4031c9f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 40 deletions.
5 changes: 0 additions & 5 deletions src/lib/Gen/adoc/AdocGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
namespace clang::mrdocs {
namespace adoc {

AdocGenerator::
AdocGenerator()
: hbs::HandlebarsGenerator("Asciidoc", "adoc")
{}

std::string
AdocGenerator::
toString(hbs::HandlebarsCorpus const& c, doc::Node const& I) const
Expand Down
19 changes: 18 additions & 1 deletion src/lib/Gen/adoc/AdocGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@ class AdocGenerator
: public hbs::HandlebarsGenerator
{
public:
AdocGenerator();
std::string_view
id() const noexcept override
{
return "adoc";
}

std::string_view
fileExtension() const noexcept override
{
return "adoc";
}


std::string_view
displayName() const noexcept override
{
return "Asciidoc";
}

std::string
toString(
Expand Down
28 changes: 0 additions & 28 deletions src/lib/Gen/hbs/HandlebarsGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,7 @@ namespace hbs {
class HandlebarsGenerator
: public Generator
{
std::string displayName_;
std::string fileExtension_;

public:
HandlebarsGenerator(
std::string_view displayName,
std::string_view fileExtension)
: displayName_(displayName)
, fileExtension_(fileExtension)
{}

std::string_view
id() const noexcept override
{
return fileExtension_;
}

std::string_view
displayName() const noexcept override
{
return displayName_;
}

std::string_view
fileExtension() const noexcept override
{
return fileExtension_;
}

Expected<void>
build(
std::string_view outputPath,
Expand Down
5 changes: 0 additions & 5 deletions src/lib/Gen/html/HTMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ namespace clang {
namespace mrdocs {
namespace html {

HTMLGenerator::
HTMLGenerator()
: hbs::HandlebarsGenerator("HTML", "html")
{}

std::string
HTMLGenerator::
toString(hbs::HandlebarsCorpus const& c, doc::Node const& I) const
Expand Down
18 changes: 17 additions & 1 deletion src/lib/Gen/html/HTMLGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,23 @@ class HTMLGenerator
: public hbs::HandlebarsGenerator
{
public:
HTMLGenerator();
std::string_view
id() const noexcept override
{
return "html";
}

std::string_view
fileExtension() const noexcept override
{
return "html";
}

std::string_view
displayName() const noexcept override
{
return "HTML";
}

std::string
toString(
Expand Down

0 comments on commit 4031c9f

Please sign in to comment.