diff --git a/src/lib/Gen/adoc/Builder.cpp b/src/lib/Gen/adoc/Builder.cpp index f544b0de8..acd06f17c 100644 --- a/src/lib/Gen/adoc/Builder.cpp +++ b/src/lib/Gen/adoc/Builder.cpp @@ -203,6 +203,7 @@ class ConfigObjectImpl : public dom::ObjectImpl auto* config_impl = dynamic_cast(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; @@ -233,6 +234,7 @@ class ConfigObjectImpl : public dom::ObjectImpl auto* config_impl = dynamic_cast(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; }; @@ -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. @@ -263,6 +265,7 @@ class ConfigObjectImpl : public dom::ObjectImpl auto* config_impl = dynamic_cast(config_); if (config_impl) { + if (key == "baseURL") return true; if (key == "inaccessibleBases") return true; if (key == "inaccessibleMembers") return true; if (key == "anonymousNamespaces") return true; diff --git a/src/lib/Lib/ConfigImpl.cpp b/src/lib/Lib/ConfigImpl.cpp index 997ce20b2..516927229 100644 --- a/src/lib/Lib/ConfigImpl.cpp +++ b/src/lib/Lib/ConfigImpl.cpp @@ -100,6 +100,7 @@ struct llvm::yaml::MappingTraits 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); @@ -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_) { diff --git a/src/lib/Lib/ConfigImpl.hpp b/src/lib/Lib/ConfigImpl.hpp index 9d2e23c85..538187309 100644 --- a/src/lib/Lib/ConfigImpl.hpp +++ b/src/lib/Lib/ConfigImpl.hpp @@ -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()