Added support for iterating over diagram elements from inja templates (fixes #54)
This commit is contained in:
@@ -74,6 +74,8 @@ public:
|
||||
virtual bool should_include(
|
||||
const namespace_ &ns, const std::string &name) const;
|
||||
|
||||
virtual inja::json context() const = 0;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
std::unique_ptr<diagram_filter> filter_;
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
|
||||
std::string name() const { return name_; }
|
||||
|
||||
virtual std::string type_name() const { return "__undefined__"; };
|
||||
|
||||
virtual std::string full_name(bool /*relative*/) const { return name(); }
|
||||
|
||||
std::vector<relationship> &relationships();
|
||||
|
||||
@@ -40,6 +40,7 @@ inja::json element::context() const
|
||||
{
|
||||
inja::json ctx;
|
||||
ctx["name"] = name();
|
||||
ctx["type"] = type_name();
|
||||
ctx["alias"] = alias();
|
||||
ctx["full_name"] = full_name(false);
|
||||
ctx["namespace"] = get_namespace().to_string();
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
return dynamic_cast<nested_trait<T, Path> &>(parent.value())
|
||||
.template add_element<V>(std::move(p));
|
||||
else {
|
||||
spdlog::error("No parent element found at: {}", path.to_string());
|
||||
spdlog::info("No parent element found at: {}", path.to_string());
|
||||
throw std::runtime_error(
|
||||
"No parent element found for " + path.to_string());
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
package &operator=(const package &) = delete;
|
||||
package &operator=(package &&) = delete;
|
||||
|
||||
std::string type_name() const override { return "package"; }
|
||||
|
||||
std::string full_name(bool relative) const override;
|
||||
|
||||
bool is_deprecated() const;
|
||||
|
||||
Reference in New Issue
Block a user