[clang-tools-extra] [clang-doc] Add helpers for Template config (PR #138062)
Daniel Thornburgh via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 14:13:38 PDT 2025
================
@@ -74,7 +75,51 @@ static std::unique_ptr<MustacheTemplateFile> NamespaceTemplate = nullptr;
static std::unique_ptr<MustacheTemplateFile> RecordTemplate = nullptr;
+static Error
+setupTemplate(std::unique_ptr<MustacheTemplateFile> &Template,
+ StringRef TemplatePath,
+ std::vector<std::pair<StringRef, StringRef>> Partials) {
+ auto T = MustacheTemplateFile::createMustacheFile(TemplatePath);
+ if (Error Err = T.takeError())
+ return Err;
+ Template = std::move(T.get());
+ for (const auto [Name, FileName] : Partials) {
+ if (auto Err = Template->registerPartialFile(Name, FileName))
+ return Err;
+ }
+ return Error::success();
+}
+
static Error setupTemplateFiles(const clang::doc::ClangDocContext &CDCtx) {
+ // Template files need to use the native path when they're opened,
+ // but have to be used in Posix style when used in HTML.
----------------
mysterymath wrote:
nit: POSIX
https://github.com/llvm/llvm-project/pull/138062
More information about the cfe-commits
mailing list