diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-06-03 22:56:45 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-06-04 15:24:51 +0300 |
commit | 045563bb01a3fb9de9371854cbc16b77860c221b (patch) | |
tree | 928225401c145f00d9eb8e5467d92339d63d7d98 /mod/page.cxx | |
parent | 05d77beb95f52351c16b2f0af74a0099dd5dba27 (diff) |
Add support for topics and keywords package manifest values
Diffstat (limited to 'mod/page.cxx')
-rw-r--r-- | mod/page.cxx | 58 |
1 files changed, 23 insertions, 35 deletions
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 |