aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-03 22:56:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-04 15:24:51 +0300
commit045563bb01a3fb9de9371854cbc16b77860c221b (patch)
tree928225401c145f00d9eb8e5467d92339d63d7d98 /mod
parent05d77beb95f52351c16b2f0af74a0099dd5dba27 (diff)
Add support for topics and keywords package manifest values
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-package-details.cxx2
-rw-r--r--mod/mod-package-version-details.cxx2
-rw-r--r--mod/page.cxx58
-rw-r--r--mod/page.hxx22
4 files changed, 30 insertions, 54 deletions
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx
index 74b3840..fc2e6be 100644
--- a/mod/mod-package-details.cxx
+++ b/mod/mod-package-details.cxx
@@ -222,7 +222,7 @@ handle (request& rq, response& rs)
if (pkg->email)
s << TR_EMAIL (*pkg->email);
- s << TR_TAGS (pkg->tags, root, tenant)
+ s << TR_TOPICS (pkg->topics, root, tenant)
<< ~TBODY
<< ~TABLE;
}
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index d147449..81f18b1 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -263,7 +263,7 @@ handle (request& rq, response& rs)
if (pe && pe != em)
s << TR_EMAIL (*pe, "package-email");
- s << TR_TAGS (pkg->tags, root, tenant)
+ s << TR_TOPICS (pkg->topics, root, tenant)
<< ~TBODY
<< ~TABLE;
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
diff --git a/mod/page.hxx b/mod/page.hxx
index cd2048e..2fc3a0b 100644
--- a/mod/page.hxx
+++ b/mod/page.hxx
@@ -324,31 +324,19 @@ namespace brep
const license_alternatives& licenses_;
};
- // Generate package tags element.
+ // Generate package topics element.
//
- class TR_TAGS
+ class TR_TOPICS
{
public:
- // Display the tag link list.
- //
- TR_TAGS (const strings& ts, const dir_path& r, const string& t)
- : project_ (nullptr), tags_ (ts), root_ (r), tenant_ (t) {}
-
- // As above but prepend the list with a tag link produced from the project
- // name, if it differs from other tags.
- //
- TR_TAGS (const package_name& pr,
- const strings& ts,
- const dir_path& r,
- const string& t)
- : project_ (&pr), tags_ (ts), root_ (r), tenant_ (t) {}
+ TR_TOPICS (const strings& ts, const dir_path& r, const string& t)
+ : topics_ (ts), root_ (r), tenant_ (t) {}
void
operator() (xml::serializer&) const;
private:
- const package_name* project_;
- const strings& tags_;
+ const strings& topics_;
const dir_path& root_;
const string& tenant_;
};