diff --git a/lib/rdoc/generator/template/rails/resources/css/main.css b/lib/rdoc/generator/template/rails/resources/css/main.css
index d1e95bca..66b19f52 100644
--- a/lib/rdoc/generator/template/rails/resources/css/main.css
+++ b/lib/rdoc/generator/template/rails/resources/css/main.css
@@ -26,11 +26,11 @@ body {
@media (prefers-color-scheme: dark) {
:root {
- --text-color: #ddd;
+ --text-color: #dddddd;
--link-color: #ee3f3f;
- --body-bg: #222222;
- --code-bg: #000000;
+ --body-bg: #0c0c0c;
+ --code-bg: #1b1b1b;
--source-code-bg: #000000;
}
}
@@ -69,7 +69,6 @@ a code {
.kind {
font-family: monospace;
- font-weight: bold;
}
.kind::after {
@@ -520,7 +519,6 @@ html {
}
.method__signature {
- font-size: 1.1em;
padding-bottom: var(--space-sm);
border-bottom: 2px solid var(--code-bg);
@@ -529,7 +527,7 @@ html {
}
.method__signature h3 {
- font-size: 1em;
+ font-size: 1rem;
font-weight: normal;
white-space: pre-wrap;
}
diff --git a/lib/sdoc/helpers.rb b/lib/sdoc/helpers.rb
index eda3dac5..44b0f797 100644
--- a/lib/sdoc/helpers.rb
+++ b/lib/sdoc/helpers.rb
@@ -143,12 +143,12 @@ def module_ancestors(rdoc_module)
def method_signature(rdoc_method)
if rdoc_method.call_seq
- rdoc_method.call_seq.split(/\n+/).map do |line|
- # Support specifying a call-seq like `to_s -> string`
- line.split(" -> ").map { |side| "#{h side}
" }.join(" → ")
- end.join("\n")
+ # Support specifying a call-seq like `to_s -> string`
+ rdoc_method.call_seq.gsub(/^\s*([^(\s]+)(.*?)(?: -> (.+))?$/) do
+ "#{h $1}#{h $2}
#{" → #{h $3}
" if $3}"
+ end
else
- "#{h rdoc_method.name}#{h rdoc_method.params}
"
+ "#{h rdoc_method.name}#{h rdoc_method.params}
"
end
end
diff --git a/spec/helpers_spec.rb b/spec/helpers_spec.rb
index 1fb00de7..0f590880 100644
--- a/spec/helpers_spec.rb
+++ b/spec/helpers_spec.rb
@@ -593,7 +593,7 @@ class Foo; include M1; end
module Foo; def bar(qux); end; end
RUBY
- _(@helpers.method_signature(method)).must_equal "bar(qux)
"
+ _(@helpers.method_signature(method)).must_equal "bar(qux)
"
end
it "escapes the method signature" do
@@ -601,7 +601,7 @@ module Foo; def bar(qux); end; end
module Foo; def bar(op = :<, &block); end; end
RUBY
- _(@helpers.method_signature(method)).must_equal "bar(op = :<, &block)
"
+ _(@helpers.method_signature(method)).must_equal "bar(op = :<, &block)
"
end
it "handles :call-seq: documentation" do
@@ -620,13 +620,13 @@ def qux(&block); end
RUBY
_(@helpers.method_signature(mod.find_method("bar", false))).must_equal <<~HTML.chomp
- bar(op = :<)
- bar(&block)
+ bar(op = :<)
+ bar(&block)
HTML
_(@helpers.method_signature(mod.find_method("qux", false))).must_equal <<~HTML.chomp
- qux(&block)
→ self
- qux
→ Enumerator
+ qux(&block)
→ self
+ qux
→ Enumerator
HTML
end
end