From 6a41864fdb57c75be3db87b357063b0c828dbc18 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 11 Jul 2018 15:51:59 +0300 Subject: Add support for package project manifest value --- mod/page.cxx | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'mod/page.cxx') diff --git a/mod/page.cxx b/mod/page.cxx index 614bf79..3a6e989 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -8,7 +8,7 @@ #include // hex, uppercase, right #include #include // setw(), setfill() -#include // min() +#include // min(), find() #include @@ -238,6 +238,26 @@ namespace brep << ~TR; } + // TR_PROJECT + // + void TR_PROJECT:: + operator() (serializer& s) const + { + s << TR(CLASS="project") + << TH << "project" << ~TH + << TD + << SPAN(CLASS="value") + << A + << HREF + << root_ << "?q=" << mime_url_encode (project_.string ()) + << ~HREF + << project_ + << ~A + << ~SPAN + << ~TD + << ~TR; + } + // TR_SUMMARY // void TR_SUMMARY:: @@ -318,21 +338,32 @@ namespace brep void TR_TAGS:: operator() (serializer& s) const { - if (!tags_.empty ()) + if (!tags_.empty () || project_) { s << TR(CLASS="tags") << TH << "tags" << ~TH << TD << SPAN(CLASS="value"); - for (const auto& t: tags_) + auto print = [&s, this] (const string& t) { - if (&t != &tags_[0]) - s << " "; - s << A << HREF << root_ << "?q=" << mime_url_encode (t) << ~HREF << t << ~A; + }; + + bool pt (project_ != nullptr && + find (tags_.begin (), tags_.end (), *project_) == tags_.end ()); + + if (pt) + print (project_->string ()); + + for (const string& t: tags_) + { + if (&t != &tags_[0] || pt) + s << " "; + + print (t); } s << ~SPAN -- cgit v1.1