ruby/rdoc-pr1531-fix-mutilple-document-installation.patch
Jarek Prokop 916dd3e4c2 Fix rdoc error when installing multiple document kinds.
Sourced from Fedora: https://src.fedoraproject.org/rpms/rubygem-rdoc/pull-request/3
and deleted the portion of the patch that edited the rdoc's tests, because the upstream
Ruby tar does not contain tests for rdoc.

Fixes case where installling multiple documents: `gem install -V hocon --document=ri,rdoc`
can result in an exception:
~~~
$ gem install -V hocon --document=ri,rdoc
....
....
Successfully installed hocon-1.4.0
Parsing documentation for hocon-1.4.0
Parsing sources...
100% [88/88]  lib/hocon/version.rb
Installing ri documentation for hocon-1.4.0
Installing aliki documentation for hocon-1.4.0
ERROR:  While executing gem ... (NoMethodError)
    undefined method 'empty?' for an instance of RDoc::Markup::Paragraph

    return '' unless first_comment && !first_comment.empty?
                                                    ^^^^^^^
<...snip...>
~~~
See: https://github.com/ruby/rdoc/issues/1530
2026-01-07 18:55:55 +01:00

28 lines
1.1 KiB
Diff

From 994ee4c17fb8c217ab0335df55620c6bdb5d5cbe Mon Sep 17 00:00:00 2001
From: tompng <tomoyapenguin@gmail.com>
Date: Fri, 26 Dec 2025 04:57:12 +0900
Subject: [PATCH] Fix comment_location for merged ClassModule
---
lib/rdoc/code_object/class_module.rb | 7 ++++++-
test/rdoc/code_object/class_module_test.rb | 6 ++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/rdoc/code_object/class_module.rb b/lib/rdoc/code_object/class_module.rb
index b6bed352a2..d7ee36f950 100644
--- a/lib/rdoc/code_object/class_module.rb
+++ b/lib/rdoc/code_object/class_module.rb
@@ -477,7 +477,12 @@ def merge(class_module)
document = document.merge other_document
@comment = RDoc::Comment.from_document(document)
- @comment_location = document
+
+ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document)
+ document.parts.map { |doc| [doc, doc.file] }
+ else
+ [[document, document.file]]
+ end
end
cm = class_module