Skip to content

Commit 86609ec

Browse files
committed
feat: baseURL config option
1 parent 186db21 commit 86609ec

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/lib/Gen/adoc/Builder.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
203203
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
204204
if (config_impl)
205205
{
206+
if (key == "baseURL") return (*config_impl)->baseURL;
206207
if (key == "inaccessibleBases") return (*config_impl)->inaccessibleBases;
207208
if (key == "inaccessibleMembers") return (*config_impl)->inaccessibleMembers;
208209
if (key == "anonymousNamespaces") return (*config_impl)->anonymousNamespaces;
@@ -233,6 +234,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
233234
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
234235
if (config_impl)
235236
{
237+
if (!fn("baseURL", (*config_impl)->baseURL)) { return false; };
236238
if (!fn("inaccessibleBases", (*config_impl)->inaccessibleBases)) { return false; };
237239
if (!fn("inaccessibleMembers", (*config_impl)->inaccessibleMembers)) { return false; };
238240
if (!fn("anonymousNamespaces", (*config_impl)->anonymousNamespaces)) { return false; };
@@ -250,7 +252,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
250252
/** Return the number of properties in the object.
251253
*/
252254
std::size_t size() const override {
253-
return 8;
255+
return 9;
254256
};
255257

256258
/** Determine if a key exists.
@@ -263,6 +265,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
263265
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
264266
if (config_impl)
265267
{
268+
if (key == "baseURL") return true;
266269
if (key == "inaccessibleBases") return true;
267270
if (key == "inaccessibleMembers") return true;
268271
if (key == "anonymousNamespaces") return true;

src/lib/Lib/ConfigImpl.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct llvm::yaml::MappingTraits<SettingsImpl>
100100
io.mapOptional("generate", cfg.generate);
101101
io.mapOptional("multipage", cfg.multiPage);
102102
io.mapOptional("source-root", cfg.sourceRoot);
103+
io.mapOptional("base-url", cfg.baseURL);
103104

104105
io.mapOptional("input", cfg.input);
105106

@@ -197,6 +198,12 @@ ConfigImpl(
197198
settings_.sourceRoot = files::makePosixStyle(files::makeDirsy(
198199
files::makeAbsolute(settings_.sourceRoot, settings_.workingDir)));
199200

201+
// Base-URL has to be dirsy with forward slash style
202+
if (!settings_.baseURL.ends_with('/'))
203+
{
204+
settings_.baseURL.push_back('/');
205+
}
206+
200207
// Adjust input files
201208
for(auto& name : inputFileIncludes_)
202209
{

src/lib/Lib/ConfigImpl.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class ConfigImpl
120120
*/
121121
FilterNode symbolFilter;
122122

123+
/** The base URL for the generated documentation.
124+
125+
This is used to generate links to sources
126+
files referenced in the documentation.
127+
*/
128+
std::string baseURL;
123129
};
124130

125131
/// @copydoc Config::settings()

0 commit comments

Comments
 (0)