-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang-doc] Replace HTML generation with Mustache backend #170199
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
base: main
Are you sure you want to change the base?
Conversation
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesRemoves the legacy HTML backend and replaces it with the Mustache backend. Patch is 152.67 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/170199.diff 23 Files Affected:
diff --git a/clang-tools-extra/clang-doc/CMakeLists.txt b/clang-tools-extra/clang-doc/CMakeLists.txt
index 5989e5fe60cf3..7a375d7cd0524 100644
--- a/clang-tools-extra/clang-doc/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/CMakeLists.txt
@@ -16,7 +16,6 @@ add_clang_library(clangDoc STATIC
Representation.cpp
Serialize.cpp
YAMLGenerator.cpp
- HTMLMustacheGenerator.cpp
JSONGenerator.cpp
DEPENDS
diff --git a/clang-tools-extra/clang-doc/Generators.cpp b/clang-tools-extra/clang-doc/Generators.cpp
index 5d76901b95833..d836e195289f6 100644
--- a/clang-tools-extra/clang-doc/Generators.cpp
+++ b/clang-tools-extra/clang-doc/Generators.cpp
@@ -239,8 +239,6 @@ void Generator::addInfoToIndex(Index &Idx, const doc::Info *Info) {
[[maybe_unused]] static int YAMLGeneratorAnchorDest = YAMLGeneratorAnchorSource;
[[maybe_unused]] static int MDGeneratorAnchorDest = MDGeneratorAnchorSource;
[[maybe_unused]] static int HTMLGeneratorAnchorDest = HTMLGeneratorAnchorSource;
-[[maybe_unused]] static int MHTMLGeneratorAnchorDest =
- MHTMLGeneratorAnchorSource;
[[maybe_unused]] static int JSONGeneratorAnchorDest = JSONGeneratorAnchorSource;
} // namespace doc
} // namespace clang
diff --git a/clang-tools-extra/clang-doc/Generators.h b/clang-tools-extra/clang-doc/Generators.h
index 847722646b029..a50f1ac25eda9 100644
--- a/clang-tools-extra/clang-doc/Generators.h
+++ b/clang-tools-extra/clang-doc/Generators.h
@@ -137,7 +137,6 @@ struct MustacheGenerator : public Generator {
extern volatile int YAMLGeneratorAnchorSource;
extern volatile int MDGeneratorAnchorSource;
extern volatile int HTMLGeneratorAnchorSource;
-extern volatile int MHTMLGeneratorAnchorSource;
extern volatile int JSONGeneratorAnchorSource;
} // namespace doc
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 7c8c16b8e8aca..9b8f53e44901f 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -1,1149 +1,173 @@
-//===-- HTMLGenerator.cpp - HTML Generator ----------------------*- C++ -*-===//
+///===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the implementation of the HTMLGenerator class,
+/// which is Clang-Doc generator for HTML using Mustache templates.
+///
+//===----------------------------------------------------------------------===//
#include "Generators.h"
#include "Representation.h"
#include "support/File.h"
-#include "clang/Basic/Version.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSet.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/JSON.h"
+#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
-#include "llvm/Support/raw_ostream.h"
-#include <algorithm>
-#include <optional>
-#include <string>
using namespace llvm;
+using namespace llvm::json;
+using namespace llvm::mustache;
namespace clang {
namespace doc {
-namespace {
-
-class HTMLTag {
-public:
- // Any other tag can be added if required
- enum TagType {
- TAG_A,
- TAG_DIV,
- TAG_FOOTER,
- TAG_H1,
- TAG_H2,
- TAG_H3,
- TAG_HEADER,
- TAG_LI,
- TAG_LINK,
- TAG_MAIN,
- TAG_META,
- TAG_OL,
- TAG_P,
- TAG_SCRIPT,
- TAG_SPAN,
- TAG_TITLE,
- TAG_UL,
- TAG_TABLE,
- TAG_THEAD,
- TAG_TBODY,
- TAG_TR,
- TAG_TD,
- TAG_TH
- };
-
- HTMLTag() = default;
- constexpr HTMLTag(TagType Value) : Value(Value) {}
-
- operator TagType() const { return Value; }
- operator bool() = delete;
-
- bool isSelfClosing() const;
- StringRef toString() const;
-
-private:
- TagType Value;
-};
-
-enum NodeType {
- NODE_TEXT,
- NODE_TAG,
-};
-
-struct HTMLNode {
- HTMLNode(NodeType Type) : Type(Type) {}
- virtual ~HTMLNode() = default;
-
- virtual void render(llvm::raw_ostream &OS, int IndentationLevel) = 0;
- NodeType Type; // Type of node
-};
-
-struct TextNode : public HTMLNode {
- TextNode(const Twine &Text)
- : HTMLNode(NodeType::NODE_TEXT), Text(Text.str()) {}
-
- std::string Text; // Content of node
- void render(llvm::raw_ostream &OS, int IndentationLevel) override;
-};
-
-struct TagNode : public HTMLNode {
- TagNode(HTMLTag Tag) : HTMLNode(NodeType::NODE_TAG), Tag(Tag) {}
- TagNode(HTMLTag Tag, const Twine &Text) : TagNode(Tag) {
- Children.emplace_back(std::make_unique<TextNode>(Text.str()));
- }
-
- HTMLTag Tag; // Name of HTML Tag (p, div, h1)
- std::vector<std::unique_ptr<HTMLNode>> Children; // List of child nodes
- std::vector<std::pair<std::string, std::string>>
- Attributes; // List of key-value attributes for tag
-
- void render(llvm::raw_ostream &OS, int IndentationLevel) override;
-};
-
-struct HTMLFile {
- std::vector<std::unique_ptr<HTMLNode>> Children; // List of child nodes
- void render(llvm::raw_ostream &OS) {
- OS << "<!DOCTYPE html>\n";
- for (const auto &C : Children) {
- C->render(OS, 0);
- OS << "\n";
- }
- }
-};
-
-} // namespace
-
-bool HTMLTag::isSelfClosing() const {
- switch (Value) {
- case HTMLTag::TAG_META:
- case HTMLTag::TAG_LINK:
- return true;
- case HTMLTag::TAG_A:
- case HTMLTag::TAG_DIV:
- case HTMLTag::TAG_FOOTER:
- case HTMLTag::TAG_H1:
- case HTMLTag::TAG_H2:
- case HTMLTag::TAG_H3:
- case HTMLTag::TAG_HEADER:
- case HTMLTag::TAG_LI:
- case HTMLTag::TAG_MAIN:
- case HTMLTag::TAG_OL:
- case HTMLTag::TAG_P:
- case HTMLTag::TAG_SCRIPT:
- case HTMLTag::TAG_SPAN:
- case HTMLTag::TAG_TITLE:
- case HTMLTag::TAG_UL:
- case HTMLTag::TAG_TABLE:
- case HTMLTag::TAG_THEAD:
- case HTMLTag::TAG_TBODY:
- case HTMLTag::TAG_TR:
- case HTMLTag::TAG_TD:
- case HTMLTag::TAG_TH:
- return false;
- }
- llvm_unreachable("Unhandled HTMLTag::TagType");
-}
-
-StringRef HTMLTag::toString() const {
- switch (Value) {
- case HTMLTag::TAG_A:
- return "a";
- case HTMLTag::TAG_DIV:
- return "div";
- case HTMLTag::TAG_FOOTER:
- return "footer";
- case HTMLTag::TAG_H1:
- return "h1";
- case HTMLTag::TAG_H2:
- return "h2";
- case HTMLTag::TAG_H3:
- return "h3";
- case HTMLTag::TAG_HEADER:
- return "header";
- case HTMLTag::TAG_LI:
- return "li";
- case HTMLTag::TAG_LINK:
- return "link";
- case HTMLTag::TAG_MAIN:
- return "main";
- case HTMLTag::TAG_META:
- return "meta";
- case HTMLTag::TAG_OL:
- return "ol";
- case HTMLTag::TAG_P:
- return "p";
- case HTMLTag::TAG_SCRIPT:
- return "script";
- case HTMLTag::TAG_SPAN:
- return "span";
- case HTMLTag::TAG_TITLE:
- return "title";
- case HTMLTag::TAG_UL:
- return "ul";
- case HTMLTag::TAG_TABLE:
- return "table";
- case HTMLTag::TAG_THEAD:
- return "thead";
- case HTMLTag::TAG_TBODY:
- return "tbody";
- case HTMLTag::TAG_TR:
- return "tr";
- case HTMLTag::TAG_TD:
- return "td";
- case HTMLTag::TAG_TH:
- return "th";
- }
- llvm_unreachable("Unhandled HTMLTag::TagType");
-}
-
-void TextNode::render(llvm::raw_ostream &OS, int IndentationLevel) {
- OS.indent(IndentationLevel * 2);
- printHTMLEscaped(Text, OS);
-}
-
-void TagNode::render(llvm::raw_ostream &OS, int IndentationLevel) {
- // Children nodes are rendered in the same line if all of them are text nodes
- bool InlineChildren = true;
- for (const auto &C : Children)
- if (C->Type == NodeType::NODE_TAG) {
- InlineChildren = false;
- break;
- }
- OS.indent(IndentationLevel * 2);
- OS << "<" << Tag.toString();
- for (const auto &A : Attributes)
- OS << " " << A.first << "=\"" << A.second << "\"";
- if (Tag.isSelfClosing()) {
- OS << "/>";
- return;
- }
- OS << ">";
- if (!InlineChildren)
- OS << "\n";
- bool NewLineRendered = true;
- for (const auto &C : Children) {
- int ChildrenIndentation =
- InlineChildren || !NewLineRendered ? 0 : IndentationLevel + 1;
- C->render(OS, ChildrenIndentation);
- if (!InlineChildren && (C == Children.back() ||
- (C->Type != NodeType::NODE_TEXT ||
- (&C + 1)->get()->Type != NodeType::NODE_TEXT))) {
- OS << "\n";
- NewLineRendered = true;
- } else
- NewLineRendered = false;
- }
- if (!InlineChildren)
- OS.indent(IndentationLevel * 2);
- OS << "</" << Tag.toString() << ">";
-}
-
-template <typename Derived, typename Base,
- typename = std::enable_if<std::is_base_of<Derived, Base>::value>>
-static void appendVector(std::vector<Derived> &&New,
- std::vector<Base> &Original) {
- std::move(New.begin(), New.end(), std::back_inserter(Original));
-}
-
-// HTML generation
-
-static std::vector<std::unique_ptr<TagNode>>
-genStylesheetsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
- std::vector<std::unique_ptr<TagNode>> Out;
- for (const auto &FilePath : CDCtx.UserStylesheets) {
- auto LinkNode = std::make_unique<TagNode>(HTMLTag::TAG_LINK);
- LinkNode->Attributes.emplace_back("rel", "stylesheet");
- SmallString<128> StylesheetPath = computeRelativePath("", InfoPath);
- llvm::sys::path::append(StylesheetPath,
- llvm::sys::path::filename(FilePath));
- // Paths in HTML must be in posix-style
- llvm::sys::path::native(StylesheetPath, llvm::sys::path::Style::posix);
- LinkNode->Attributes.emplace_back("href", std::string(StylesheetPath));
- Out.emplace_back(std::move(LinkNode));
- }
- return Out;
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genJsScriptsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
- std::vector<std::unique_ptr<TagNode>> Out;
-
- // index_json.js is part of every generated HTML file
- SmallString<128> IndexJSONPath = computeRelativePath("", InfoPath);
- auto IndexJSONNode = std::make_unique<TagNode>(HTMLTag::TAG_SCRIPT);
- llvm::sys::path::append(IndexJSONPath, "index_json.js");
- llvm::sys::path::native(IndexJSONPath, llvm::sys::path::Style::posix);
- IndexJSONNode->Attributes.emplace_back("src", std::string(IndexJSONPath));
- Out.emplace_back(std::move(IndexJSONNode));
-
- for (const auto &FilePath : CDCtx.JsScripts) {
- SmallString<128> ScriptPath = computeRelativePath("", InfoPath);
- auto ScriptNode = std::make_unique<TagNode>(HTMLTag::TAG_SCRIPT);
- llvm::sys::path::append(ScriptPath, llvm::sys::path::filename(FilePath));
- // Paths in HTML must be in posix-style
- llvm::sys::path::native(ScriptPath, llvm::sys::path::Style::posix);
- ScriptNode->Attributes.emplace_back("src", std::string(ScriptPath));
- Out.emplace_back(std::move(ScriptNode));
- }
- return Out;
-}
-
-static std::unique_ptr<TagNode> genLink(const Twine &Text, const Twine &Link) {
- auto LinkNode = std::make_unique<TagNode>(HTMLTag::TAG_A, Text);
- LinkNode->Attributes.emplace_back("href", Link.str());
- return LinkNode;
-}
-
-static std::unique_ptr<HTMLNode>
-genReference(const Reference &Type, StringRef CurrentDirectory,
- std::optional<StringRef> JumpToSection = std::nullopt) {
- if (Type.Path.empty()) {
- if (!JumpToSection)
- return std::make_unique<TextNode>(Type.Name);
- return genLink(Type.Name, "#" + *JumpToSection);
- }
- llvm::SmallString<64> Path = Type.getRelativeFilePath(CurrentDirectory);
- llvm::sys::path::append(Path, Type.getFileBaseName() + ".html");
-
- // Paths in HTML must be in posix-style
- llvm::sys::path::native(Path, llvm::sys::path::Style::posix);
- if (JumpToSection)
- Path += ("#" + *JumpToSection).str();
- return genLink(Type.Name, Path);
-}
-
-static std::vector<std::unique_ptr<HTMLNode>>
-genReferenceList(const llvm::SmallVectorImpl<Reference> &Refs,
- const StringRef &CurrentDirectory) {
- std::vector<std::unique_ptr<HTMLNode>> Out;
- for (const auto &R : Refs) {
- if (&R != Refs.begin())
- Out.emplace_back(std::make_unique<TextNode>(", "));
- Out.emplace_back(genReference(R, CurrentDirectory));
- }
- return Out;
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genHTML(const EnumInfo &I, const ClangDocContext &CDCtx);
-static std::vector<std::unique_ptr<TagNode>>
-genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
- StringRef ParentInfoDir);
-static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C);
-
-static std::vector<std::unique_ptr<TagNode>>
-genEnumsBlock(const std::vector<EnumInfo> &Enums,
- const ClangDocContext &CDCtx) {
- if (Enums.empty())
- return {};
-
- std::vector<std::unique_ptr<TagNode>> Out;
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Enums"));
- Out.back()->Attributes.emplace_back("id", "Enums");
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_DIV));
- auto &DivBody = Out.back();
- for (const auto &E : Enums) {
- std::vector<std::unique_ptr<TagNode>> Nodes = genHTML(E, CDCtx);
- appendVector(std::move(Nodes), DivBody->Children);
- }
- return Out;
-}
-
-static std::unique_ptr<TagNode>
-genEnumMembersBlock(const llvm::SmallVector<EnumValueInfo, 4> &Members) {
- if (Members.empty())
- return nullptr;
-
- auto List = std::make_unique<TagNode>(HTMLTag::TAG_TBODY);
-
- for (const auto &M : Members) {
- auto TRNode = std::make_unique<TagNode>(HTMLTag::TAG_TR);
- TRNode->Children.emplace_back(
- std::make_unique<TagNode>(HTMLTag::TAG_TD, M.Name));
- // Use user supplied value if it exists, otherwise use the value
- if (!M.ValueExpr.empty()) {
- TRNode->Children.emplace_back(
- std::make_unique<TagNode>(HTMLTag::TAG_TD, M.ValueExpr));
- } else {
- TRNode->Children.emplace_back(
- std::make_unique<TagNode>(HTMLTag::TAG_TD, M.Value));
- }
- if (!M.Description.empty()) {
- auto TD = std::make_unique<TagNode>(HTMLTag::TAG_TD);
- TD->Children.emplace_back(genHTML(M.Description));
- TRNode->Children.emplace_back(std::move(TD));
- }
- List->Children.emplace_back(std::move(TRNode));
- }
- return List;
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genFunctionsBlock(const std::vector<FunctionInfo> &Functions,
- const ClangDocContext &CDCtx, StringRef ParentInfoDir) {
- if (Functions.empty())
- return {};
-
- std::vector<std::unique_ptr<TagNode>> Out;
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Functions"));
- Out.back()->Attributes.emplace_back("id", "Functions");
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_DIV));
- auto &DivBody = Out.back();
- for (const auto &F : Functions) {
- std::vector<std::unique_ptr<TagNode>> Nodes =
- genHTML(F, CDCtx, ParentInfoDir);
- appendVector(std::move(Nodes), DivBody->Children);
- }
- return Out;
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genRecordMembersBlock(const llvm::SmallVector<MemberTypeInfo, 4> &Members,
- StringRef ParentInfoDir) {
- if (Members.empty())
- return {};
-
- std::vector<std::unique_ptr<TagNode>> Out;
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Members"));
- Out.back()->Attributes.emplace_back("id", "Members");
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_UL));
- auto &ULBody = Out.back();
- for (const auto &M : Members) {
- StringRef Access = getAccessSpelling(M.Access);
- auto LIBody = std::make_unique<TagNode>(HTMLTag::TAG_LI);
- auto MemberDecl = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
- if (!Access.empty())
- MemberDecl->Children.emplace_back(
- std::make_unique<TextNode>(Access + " "));
- if (M.IsStatic)
- MemberDecl->Children.emplace_back(std::make_unique<TextNode>("static "));
- MemberDecl->Children.emplace_back(genReference(M.Type, ParentInfoDir));
- MemberDecl->Children.emplace_back(std::make_unique<TextNode>(" " + M.Name));
- if (!M.Description.empty())
- LIBody->Children.emplace_back(genHTML(M.Description));
- LIBody->Children.emplace_back(std::move(MemberDecl));
- ULBody->Children.emplace_back(std::move(LIBody));
- }
- return Out;
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genReferencesBlock(const std::vector<Reference> &References,
- llvm::StringRef Title, StringRef ParentPath) {
- if (References.empty())
- return {};
-
- std::vector<std::unique_ptr<TagNode>> Out;
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, Title));
- Out.back()->Attributes.emplace_back("id", std::string(Title));
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_UL));
- auto &ULBody = Out.back();
- for (const auto &R : References) {
- auto LiNode = std::make_unique<TagNode>(HTMLTag::TAG_LI);
- LiNode->Children.emplace_back(genReference(R, ParentPath));
- ULBody->Children.emplace_back(std::move(LiNode));
- }
- return Out;
-}
-static std::unique_ptr<TagNode> writeSourceFileRef(const ClangDocContext &CDCtx,
- const Location &L) {
-
- if (!L.IsFileInRootDir && !CDCtx.RepositoryUrl)
- return std::make_unique<TagNode>(
- HTMLTag::TAG_P, "Defined at line " + std::to_string(L.StartLineNumber) +
- " of file " + L.Filename);
-
- SmallString<128> FileURL(CDCtx.RepositoryUrl.value_or(""));
- llvm::sys::path::append(
- FileURL, llvm::sys::path::Style::posix,
- // If we're on Windows, the file name will be in the wrong format, and
- // append won't convert the full path being appended to the correct
- // format, so we need to do that here.
- llvm::sys::path::convert_to_slash(
- L.Filename,
- // The style here is the current style of the path, not the one we're
- // targeting. If the string is already in the posix style, it will do
- // nothing.
- llvm::sys::path::Style::windows));
- auto Node = std::make_unique<TagNode>(HTMLTag::TAG_P);
- Node->Children.emplace_back(std::make_unique<TextNode>("Defined at line "));
- auto LocNumberNode = std::make_unique<TagNode>(
- HTMLTag::TAG_A, std::to_string(L.StartLineNumber));
- // The links to a specific line in the source code use the github /
- // googlesource notation so it won't work for all hosting pages.
- LocNumberNode->Attributes.emplace_back(
- "href",
- formatv("{0}#{1}{2}", FileURL, CDCtx.RepositoryLinePrefix.value_or(""),
- L.StartLineNumber));
- Node->Children.emplace_back(std::move(LocNumberNode));
- Node->Children.emplace_back(std::make_unique<TextNode>(" of file "));
- auto LocFileNode = std::make_unique<TagNode>(
- HTMLTag::TAG_A, llvm::sys::path::filename(FileURL));
- LocFileNode->Attributes.emplace_back("href", std::string(FileURL));
- Node->Children.emplace_back(std::move(LocFileNode));
- return Node;
-}
-
-static void maybeWriteSourceFileRef(std::vector<std::unique_ptr<TagNode>> &Out,
- const ClangDocContext &CDCtx,
- const std::optional<Location> &DefLoc) {
- if (DefLoc)
- Out.emplace_back(writeSourceFileRef(CDCtx, *DefLoc));
-}
-
-static std::vector<std::unique_ptr<TagNode>>
-genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList);
-
-// Generates a list of child nodes for the HTML head tag
-// It contains a meta node, link nodes to import CSS files, and script nodes to
-// import JS files
-static std::vector<std::unique_ptr<TagNode>>
-genFileHeadNodes(StringRef Title, StringRef InfoPath,
- const ClangDocContext &CDCtx) {
- std::vector<std::unique_ptr<TagNode>> Out;
- auto MetaNode = std::make_unique<TagNode>(HTMLTag::TAG_META);
- MetaNode->Attributes.emplace_back("charset", "utf-8");
- Out.emplace_back(std::move(MetaNode));
- Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_TITLE, Title));
- std::vector<std::unique_ptr<TagNode>> StylesheetsNodes =
- genStylesheetsHTML(InfoPath, CDCtx);
- appendVector(std::move(StylesheetsNodes), Out);
- std::vector<std::unique_ptr<TagNode>> JsNodes =
- genJsScriptsHTML(InfoPath, CDCtx);
- appendVector(std::move(JsNodes), Out);
- return Out;
-}
-
-// Generates a header HTML node that can be used for any file
-// It contains the project name
-static std::unique_p...
[truncated]
|
ilovepi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is mostly OK. It would have been nice to stage this transition a bit more, e.g. by leaving the mustache test tags as they were, and then renaming them as a follow up, or just consolidating them under a single FileCheck tag when they are equivalent, like the assets.cpp test.
| // HTML-INDEX: <td>'C'</td> | ||
| // HTML-INDEX: </tr> | ||
| // HTML-INDEX: </tbody> | ||
| // HTML-INDEX: </table> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: EOF
| EXPECT_THAT_ERROR(G->createResources(CDCtx), Failed()) | ||
| << "Empty UserStylesheets or JsScripts should fail!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the only thing we unit test now? I recall the issues with the assets. Is it feasible to test any of the core functionality via some simple template we can provide as part of the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we created all the files in memory we could, but this backend writes JSON to disk and expects to read them from that directory. You cant decouple that behavior right now, so we'd run into the same problem as before.
I know clang-tidy does some VFS stuff in their unit tests, but there would be need to be some options in clang-doc to intercept file creation and point it to a stream or virtual file.
a79ef37 to
631b7f8
Compare
4014a14 to
11036c3
Compare
631b7f8 to
ea8fa8f
Compare
11036c3 to
d56b271
Compare
ea8fa8f to
ddd8862
Compare
d56b271 to
c9281da
Compare
ddd8862 to
00d3f98
Compare

Removes the legacy HTML backend and replaces it with the Mustache backend.