From 4b3764662142cdd2577f95c5645fa7291b8dcbb3 Mon Sep 17 00:00:00 2001 From: nick evans Date: Fri, 14 Oct 2022 18:26:46 -0400 Subject: [PATCH] Fix section comments in darkfish This is almost certainly the wrong way to do this. But the lack of section comments has been bugging me for years, and this was my first attempt at figuring out why it is broken. Maybe someone else can fix it The Right Way, or give me some advice on how to do so myself... --- lib/rdoc/context/section.rb | 2 +- lib/rdoc/generator/markup.rb | 2 +- lib/rdoc/generator/template/darkfish/class.rhtml | 2 +- lib/rdoc/text.rb | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb index c316efe99f..7eb8a753c7 100644 --- a/lib/rdoc/context/section.rb +++ b/lib/rdoc/context/section.rb @@ -177,7 +177,7 @@ def marshal_load array # Parses +comment_location+ into an RDoc::Markup::Document composed of # multiple RDoc::Markup::Documents with their file set. - def parse + def parse _comment_location case @comments when String then super diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb index 41e132450d..06d6958207 100644 --- a/lib/rdoc/generator/markup.rb +++ b/lib/rdoc/generator/markup.rb @@ -25,7 +25,7 @@ def as_href(from_path) # Handy wrapper for marking up this object's comment def description - markup @comment + markup @comment || @comments&.first end ## diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml index 5d7b6a1b80..ba883e6ddc 100644 --- a/lib/rdoc/generator/template/darkfish/class.rhtml +++ b/lib/rdoc/generator/template/darkfish/class.rhtml @@ -38,7 +38,7 @@ <%- end -%> - <%- if section.comment then -%> + <%- if section.comment || section.comments.any? then -%>
<%= section.description %>
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 0bc4aba428..085249eb42 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -95,6 +95,7 @@ def flush_left text # Requires the including class to implement #formatter def markup text + @store ||= @parent&.store if @store.rdoc.options locale = @store.rdoc.options.locale else