Skip to content

Commit eb464a3

Browse files
committed
refactor(Generator): build member function
1 parent 6639b8d commit eb464a3

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

include/mrdocs/Generator.hpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class MRDOCS_VISIBLE
9999
@param corpus The symbols to emit. The
100100
generator may modify the contents of
101101
the object before returning.
102-
103-
@param config The configuration to use.
104102
*/
105103
MRDOCS_DECL
106104
virtual
@@ -109,6 +107,22 @@ class MRDOCS_VISIBLE
109107
std::string_view outputPath,
110108
Corpus const& corpus) const;
111109

110+
/** Build reference documentation for the corpus.
111+
112+
This function invokes the generator to emit
113+
the documentation using the corpus configuration
114+
options to determine the output location.
115+
116+
@return The error, if any occurred.
117+
118+
@param corpus The symbols to emit. The
119+
generator may modify the contents of
120+
the object before returning.
121+
*/
122+
MRDOCS_DECL
123+
Error
124+
build(Corpus const& corpus) const;
125+
112126
/** Build reference documentation for the corpus.
113127
114128
This function invokes the generator to emit

src/lib/Support/Generator.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ build(
5454
return buildOne(fileName.str(), corpus);
5555
}
5656

57+
Error
58+
Generator::
59+
build(Corpus const& corpus) const
60+
{
61+
std::string absOutput = files::normalizePath(
62+
files::makeAbsolute(
63+
corpus.config->output,
64+
corpus.config->configDir));
65+
return build(absOutput, corpus);
66+
}
67+
5768
Error
5869
Generator::
5970
buildOne(

src/tool/GenerateAction.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,8 @@ DoGenerateAction(
200200
// --------------------------------------------------------------
201201
// Normalize outputPath path
202202
MRDOCS_CHECK(settings.output, "The output path argument is missing");
203-
std::string absOutput = files::normalizePath(
204-
files::makeAbsolute(
205-
settings.output,
206-
(*config)->configDir));
207203
report::info("Generating docs\n");
208-
MRDOCS_TRY(generator.build(absOutput, *corpus));
204+
MRDOCS_TRY(generator.build(*corpus));
209205

210206
// --------------------------------------------------------------
211207
//

0 commit comments

Comments
 (0)