From d70fd11d67e584003fabfb3fa86f7acd0533d8ce Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 16 May 2019 16:32:54 +0300 Subject: Strip package title from package description on package and version details pages --- mod/page.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'mod/page.cxx') diff --git a/mod/page.cxx b/mod/page.cxx index 63bb495..228a137 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -933,6 +933,21 @@ namespace brep cmark_parser_finish (parser.get ()), [] (cmark_node* n) {cmark_node_free (n);}); + // Strip the document "title". + // + if (strip_title_) + { + cmark_node* child (cmark_node_first_child (doc.get ())); + + if (child != nullptr && + cmark_node_get_type (child) == CMARK_NODE_HEADING && + cmark_node_get_heading_level (child) == 1) + { + cmark_node_unlink (child); + cmark_node_free (child); + } + } + // Render the AST into an XHTML fragment. // // Note that unlike GitHub we follow the default API behavior and @@ -973,7 +988,9 @@ namespace brep s.resume_indentation (); if (f.truncated) - s << DIV(CLASS="more") << A(HREF=*url_) << "More" << ~A << ~DIV; + s << DIV(CLASS="more") + << "... " << A(HREF=*url_) << "More" << ~A + << ~DIV; s << ~DIV; } -- cgit v1.1