aboutsummaryrefslogtreecommitdiff
path: root/mod/page.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-11 15:51:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-11 16:51:21 +0300
commit6a41864fdb57c75be3db87b357063b0c828dbc18 (patch)
treeb2f9a56555cd7b642529842013528c95072cd606 /mod/page.cxx
parent21033565488f6c63b4c40962cccfdc8b6ca32b2a (diff)
Add support for package project manifest value
Diffstat (limited to 'mod/page.cxx')
-rw-r--r--mod/page.cxx43
1 files changed, 37 insertions, 6 deletions
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 <ios> // hex, uppercase, right
#include <sstream>
#include <iomanip> // setw(), setfill()
-#include <algorithm> // min()
+#include <algorithm> // min(), find()
#include <libstudxml/serializer.hxx>
@@ -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