Skip to content

Commit

Permalink
feat: baseURL config option
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Dec 1, 2023
1 parent 186db21 commit 86609ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/Gen/adoc/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
if (config_impl)
{
if (key == "baseURL") return (*config_impl)->baseURL;
if (key == "inaccessibleBases") return (*config_impl)->inaccessibleBases;
if (key == "inaccessibleMembers") return (*config_impl)->inaccessibleMembers;
if (key == "anonymousNamespaces") return (*config_impl)->anonymousNamespaces;
Expand Down Expand Up @@ -233,6 +234,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
if (config_impl)
{
if (!fn("baseURL", (*config_impl)->baseURL)) { return false; };
if (!fn("inaccessibleBases", (*config_impl)->inaccessibleBases)) { return false; };
if (!fn("inaccessibleMembers", (*config_impl)->inaccessibleMembers)) { return false; };
if (!fn("anonymousNamespaces", (*config_impl)->anonymousNamespaces)) { return false; };
Expand All @@ -250,7 +252,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
/** Return the number of properties in the object.
*/
std::size_t size() const override {
return 8;
return 9;
};

/** Determine if a key exists.
Expand All @@ -263,6 +265,7 @@ class ConfigObjectImpl : public dom::ObjectImpl
auto* config_impl = dynamic_cast<ConfigImpl const*>(config_);
if (config_impl)
{
if (key == "baseURL") return true;
if (key == "inaccessibleBases") return true;
if (key == "inaccessibleMembers") return true;
if (key == "anonymousNamespaces") return true;
Expand Down
7 changes: 7 additions & 0 deletions src/lib/Lib/ConfigImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct llvm::yaml::MappingTraits<SettingsImpl>
io.mapOptional("generate", cfg.generate);
io.mapOptional("multipage", cfg.multiPage);
io.mapOptional("source-root", cfg.sourceRoot);
io.mapOptional("base-url", cfg.baseURL);

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

Expand Down Expand Up @@ -197,6 +198,12 @@ ConfigImpl(
settings_.sourceRoot = files::makePosixStyle(files::makeDirsy(
files::makeAbsolute(settings_.sourceRoot, settings_.workingDir)));

// Base-URL has to be dirsy with forward slash style
if (!settings_.baseURL.ends_with('/'))
{
settings_.baseURL.push_back('/');
}

// Adjust input files
for(auto& name : inputFileIncludes_)
{
Expand Down
6 changes: 6 additions & 0 deletions src/lib/Lib/ConfigImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ class ConfigImpl
*/
FilterNode symbolFilter;

/** The base URL for the generated documentation.
This is used to generate links to sources
files referenced in the documentation.
*/
std::string baseURL;
};

/// @copydoc Config::settings()
Expand Down

0 comments on commit 86609ec

Please sign in to comment.