From 3c2ad0acf62373ab39b95299ed1e8d8c0773abee 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 b54265717c..5b89dbaaf3 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 97d175dddc..170863d091 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