Skip to content

Commit 4031c9f

Browse files
committed
handlebars generator descriptions in derived classes
#refactor
1 parent df7ed7d commit 4031c9f

File tree

5 files changed

+35
-40
lines changed

5 files changed

+35
-40
lines changed

src/lib/Gen/adoc/AdocGenerator.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
namespace clang::mrdocs {
1818
namespace adoc {
1919

20-
AdocGenerator::
21-
AdocGenerator()
22-
: hbs::HandlebarsGenerator("Asciidoc", "adoc")
23-
{}
24-
2520
std::string
2621
AdocGenerator::
2722
toString(hbs::HandlebarsCorpus const& c, doc::Node const& I) const

src/lib/Gen/adoc/AdocGenerator.hpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,24 @@ class AdocGenerator
2525
: public hbs::HandlebarsGenerator
2626
{
2727
public:
28-
AdocGenerator();
28+
std::string_view
29+
id() const noexcept override
30+
{
31+
return "adoc";
32+
}
33+
34+
std::string_view
35+
fileExtension() const noexcept override
36+
{
37+
return "adoc";
38+
}
39+
40+
41+
std::string_view
42+
displayName() const noexcept override
43+
{
44+
return "Asciidoc";
45+
}
2946

3047
std::string
3148
toString(

src/lib/Gen/hbs/HandlebarsGenerator.hpp

-28
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,7 @@ namespace hbs {
2828
class HandlebarsGenerator
2929
: public Generator
3030
{
31-
std::string displayName_;
32-
std::string fileExtension_;
33-
3431
public:
35-
HandlebarsGenerator(
36-
std::string_view displayName,
37-
std::string_view fileExtension)
38-
: displayName_(displayName)
39-
, fileExtension_(fileExtension)
40-
{}
41-
42-
std::string_view
43-
id() const noexcept override
44-
{
45-
return fileExtension_;
46-
}
47-
48-
std::string_view
49-
displayName() const noexcept override
50-
{
51-
return displayName_;
52-
}
53-
54-
std::string_view
55-
fileExtension() const noexcept override
56-
{
57-
return fileExtension_;
58-
}
59-
6032
Expected<void>
6133
build(
6234
std::string_view outputPath,

src/lib/Gen/html/HTMLGenerator.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ namespace clang {
1717
namespace mrdocs {
1818
namespace html {
1919

20-
HTMLGenerator::
21-
HTMLGenerator()
22-
: hbs::HandlebarsGenerator("HTML", "html")
23-
{}
24-
2520
std::string
2621
HTMLGenerator::
2722
toString(hbs::HandlebarsCorpus const& c, doc::Node const& I) const

src/lib/Gen/html/HTMLGenerator.hpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,23 @@ class HTMLGenerator
2525
: public hbs::HandlebarsGenerator
2626
{
2727
public:
28-
HTMLGenerator();
28+
std::string_view
29+
id() const noexcept override
30+
{
31+
return "html";
32+
}
33+
34+
std::string_view
35+
fileExtension() const noexcept override
36+
{
37+
return "html";
38+
}
39+
40+
std::string_view
41+
displayName() const noexcept override
42+
{
43+
return "HTML";
44+
}
2945

3046
std::string
3147
toString(

0 commit comments

Comments
 (0)