From 0ebdc6a8f9bd26d73687adc654120751f928188c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 19 Aug 2015 11:20:45 +0200 Subject: XHTML generation revision --- brep/package-search.cxx | 69 ++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) (limited to 'brep') diff --git a/brep/package-search.cxx b/brep/package-search.cxx index 3317d43..455778b 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -58,7 +58,7 @@ namespace brep throw invalid_request (400, e.what ()); } - // @@ Would be nice to have a manipulator identing string properly + // @@ Would be nice to have a manipulator indenting string properly // according to the most nested element identation. // const char* ident ("\n "); @@ -68,11 +68,11 @@ namespace brep s << HTML << HEAD << TITLE << title << ~TITLE - << STYLE(TYPE="text/css") << ident + << CSS_STYLE << ident << ".package {margin: 0 0 0.5em;}" << ident << ".name a {text-decoration: none;}" << ident << ".summary {font-size: small;}" - << ~STYLE + << ~CSS_STYLE << ~HEAD << BODY; @@ -93,59 +93,52 @@ namespace brep for (const auto& p: r) { - s << DIV(CLASS="package") - << DIV(CLASS="name") - << A - << HREF - << "/go/" << mime_url_encode (p.name); + s << DIV(CLASS="package") + << DIV(CLASS="name") + << A + << HREF << "/go/" << mime_url_encode (p.name); // Propagate search criteria to the package version search url. // if (!q.empty ()) - s << "?" << q; - - s << ~HREF - << p.name - << ~A - << ~DIV - << DIV(CLASS="summary") - << p.summary - << ~DIV - << ~DIV; + s << "?" << q; + + s << ~HREF + << p.name + << ~A + << ~DIV + << DIV(CLASS="summary") + << p.summary + << ~DIV + << ~DIV; } t.commit (); if (pr.page () || r.size () == options_->results_on_page ()) { - s << DIV; + s << DIV; if (pr.page ()) - { - s << A - << HREF << "/?p=" << pr.page () - 1 - << (q.empty () ? "" : "&" + q) - << ~HREF - << "Previous" - << ~A - << " "; - } + s << A + << HREF << "/?p=" << pr.page () - 1 << (q.empty () ? "" : "&" + q) + << ~HREF + << "Previous" + << ~A + << " "; // @@ Not ideal as can produce link to an empty page, but easy to fix // and most likelly will be replaced with something more meaningful // based on knowing the total number of matched packages. // if (r.size () == options_->results_on_page ()) - { - s << A - << HREF << "/?p=" << pr.page () + 1 - << (q.empty () ? "" : "&" + q) - << ~HREF - << "Next" - << ~A; - } - - s << ~DIV; + s << A + << HREF << "/?p=" << pr.page () + 1 << (q.empty () ? "" : "&" + q) + << ~HREF + << "Next" + << ~A; + + s << ~DIV; } s << ~BODY -- cgit v1.1