Added include diagram hyperlink generation
This commit is contained in:
@@ -64,7 +64,8 @@ public:
|
||||
void generate_notes(
|
||||
std::ostream &ostr, const model::element &element) const;
|
||||
|
||||
void generate_link(std::ostream &ostr, const model::element &e) const;
|
||||
template <typename E>
|
||||
void generate_link(std::ostream &ostr, const E &e) const;
|
||||
|
||||
protected:
|
||||
const inja::json &context() const;
|
||||
@@ -114,9 +115,9 @@ inja::json generator<C, D>::element_context(const E &e) const
|
||||
|
||||
if (!e.file().empty()) {
|
||||
std::filesystem::path file{e.file()};
|
||||
std::string relative_path = std::filesystem::relative(file);
|
||||
std::string relative_path = file.string();
|
||||
|
||||
if (ctx.template contains("git"))
|
||||
if (file.is_absolute() && ctx.template contains("git"))
|
||||
relative_path =
|
||||
std::filesystem::relative(file, ctx["git"]["toplevel"]);
|
||||
|
||||
@@ -200,8 +201,8 @@ void generator<C, D>::generate_notes(
|
||||
}
|
||||
|
||||
template <typename C, typename D>
|
||||
void generator<C, D>::generate_link(
|
||||
std::ostream &ostr, const model::element &e) const
|
||||
template <typename E>
|
||||
void generator<C, D>::generate_link(std::ostream &ostr, const E &e) const
|
||||
{
|
||||
if (e.file().empty())
|
||||
return;
|
||||
|
||||
@@ -73,6 +73,5 @@ public:
|
||||
private:
|
||||
namespace_ ns_;
|
||||
namespace_ using_namespace_;
|
||||
// type_safe::optional<source_location> location_;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "common/model/diagram_element.h"
|
||||
#include "common/model/nested_trait.h"
|
||||
#include "common/model/path.h"
|
||||
#include "common/model/source_location.h"
|
||||
#include "common/model/stylable_element.h"
|
||||
#include "util/util.h"
|
||||
|
||||
@@ -43,6 +44,7 @@ using filesystem_path = common::model::path<fs_path_sep>;
|
||||
class source_file
|
||||
: public common::model::diagram_element,
|
||||
public common::model::stylable_element,
|
||||
public source_location,
|
||||
public common::model::nested_trait<common::model::source_file,
|
||||
filesystem_path> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user