From 045563bb01a3fb9de9371854cbc16b77860c221b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 3 Jun 2019 22:56:45 +0300 Subject: Add support for topics and keywords package manifest values --- mod/page.cxx | 58 +++++++++++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) (limited to 'mod/page.cxx') diff --git a/mod/page.cxx b/mod/page.cxx index 706d052..1061788 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -373,47 +373,35 @@ namespace brep } } - // TR_TAGS + // TR_TOPICS // - void TR_TAGS:: + void TR_TOPICS:: operator() (serializer& s) const { - if (!tags_.empty () || project_) - { - s << TR(CLASS="tags") - << TH << "tags" << ~TH - << TD - << SPAN(CLASS="value"); - - auto print = [&s, this] (const string& t) - { - s << A - << HREF - << tenant_dir (root_, tenant_) << "?packages=" - << 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 << " "; + // Omit the element if there are no topics. + // + if (topics_.empty ()) + return; - print (t); - } + s << TR(CLASS="topics") + << TH << "topics" << ~TH + << TD + << SPAN(CLASS="value"); - s << ~SPAN - << ~TD - << ~TR; + for (const string& t: topics_) + { + s << A + << HREF + << tenant_dir (root_, tenant_) << "?packages=" + << mime_url_encode (t) + << ~HREF + << t + << ~A; } + + s << ~SPAN + << ~TD + << ~TR; } // TR_DEPENDS -- cgit v1.1