aboutsummaryrefslogtreecommitdiff
path: root/mod/page.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-05-16 16:32:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-05-16 16:32:54 +0300
commitd70fd11d67e584003fabfb3fa86f7acd0533d8ce (patch)
tree36c196608d165a6c492763fb1a40daad665deccf /mod/page.cxx
parent8f9a80a9ac8f353ce2cdafa23f0e5163d30d5800 (diff)
Strip package title from package description on package and version details pages
Diffstat (limited to 'mod/page.cxx')
-rw-r--r--mod/page.cxx19
1 files changed, 18 insertions, 1 deletions
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;
}