-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-doc] Implement setupTemplateValue for HTMLMustacheGenerator #138064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-clang-tools-extra Author: Paul Kirth (ilovepi) ChangesThis patch implements the business logic for setupTemplateValue, which Co-authored-by: Peter Chou <[email protected]> Full diff: https://github.com/llvm/llvm-project/pull/138064.diff 1 Files Affected:
diff --git a/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp b/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
index 29392f8bf17b9..1f0a88c269cfa 100644
--- a/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
@@ -406,7 +406,27 @@ static json::Value extractValue(const RecordInfo &I,
static void setupTemplateValue(const ClangDocContext &CDCtx, json::Value &V,
Info *I) {
+ V.getAsObject()->insert({"ProjectName", CDCtx.ProjectName});
+ json::Value StylesheetArr = Array();
+ auto InfoPath = I->getRelativeFilePath("");
+ SmallString<128> RelativePath = computeRelativePath("", InfoPath);
+ for (const auto &FilePath : CDCtx.UserStylesheets) {
+ SmallString<128> StylesheetPath = RelativePath;
+ sys::path::append(StylesheetPath, sys::path::filename(FilePath));
+ sys::path::native(StylesheetPath, sys::path::Style::posix);
+ StylesheetArr.getAsArray()->emplace_back(StylesheetPath);
+ }
+ V.getAsObject()->insert({"Stylesheets", StylesheetArr});
+
+ json::Value ScriptArr = Array();
+ for (auto Script : CDCtx.JsScripts) {
+ SmallString<128> JsPath = RelativePath;
+ sys::path::append(JsPath, sys::path::filename(Script));
+ ScriptArr.getAsArray()->emplace_back(JsPath);
+ }
+ V.getAsObject()->insert({"Scripts", ScriptArr});
}
+
Error MustacheHTMLGenerator::generateDocForInfo(Info *I, raw_ostream &OS,
const ClangDocContext &CDCtx) {
switch (I->IT) {
|
5af67bc to
888f545
Compare
6f9a69e to
6d7732b
Compare
888f545 to
e215c97
Compare
e215c97 to
d832772
Compare
6d7732b to
5c5d241
Compare
d832772 to
e66d950
Compare
5c5d241 to
ba1e65a
Compare
e66d950 to
8a5872d
Compare
ba1e65a to
51e8a50
Compare
8a5872d to
0e2e6ad
Compare
51e8a50 to
775f79d
Compare
0e2e6ad to
ac8c55e
Compare
174283d to
bda0fff
Compare
1566219 to
0e6ab7d
Compare
0e6ab7d to
c7f6fb8
Compare
fa0b1fb to
ef64af7
Compare
fa76fb7 to
d0754f4
Compare
6e5e448 to
d3bedfc
Compare
d0754f4 to
8e0b4fc
Compare
d3bedfc to
973b240
Compare
8e0b4fc to
51bd30a
Compare
973b240 to
603c1b6
Compare
c97f7af to
6880c2f
Compare
603c1b6 to
5e56a52
Compare
6880c2f to
afa7c63
Compare
5e56a52 to
c93706d
Compare
afa7c63 to
03f3e44
Compare
c93706d to
011f297
Compare
03f3e44 to
0c7122c
Compare
This patch implements the business logic for setupTemplateValue, which was split from #133161. The implementation configures the relative path relationships between the various HTML components, and prepares them prior to their use in the generator. The tests here are disabled by default until we can use lit tests via tool support, since we cannot read files in the unit tests. Co-authored-by: Peter Chou <[email protected]>
011f297 to
72da18f
Compare

This patch implements the business logic for setupTemplateValue, which
was split from #133161. The implementation configures the relative path
relationships between the various HTML components, and prepares them
prior to their use in the generator.
Co-authored-by: Peter Chou [email protected]