diff options
author | Stan Lo <[email protected]> | 2024-10-11 00:09:40 +0800 |
---|---|---|
committer | git <[email protected]> | 2024-10-10 16:09:44 +0000 |
commit | a778562f33783ac4cad56a1cc94f17a5051d8c42 (patch) | |
tree | 066c334f53384d099fa0a0798549149c8bbb0ba0 /lib/rdoc/generator | |
parent | 9df86a86af00cbf4baee42ba22ddf754fc6324d4 (diff) |
[ruby/rdoc] Make methods and attributes linkable
(https://github.com/ruby/rdoc/pull/1189)
* Use the same color for both class/module and method highlight
* Make methods and attributes linkable
https://github.com/ruby/rdoc/commit/7757fd9fe4
Diffstat (limited to 'lib/rdoc/generator')
-rw-r--r-- | lib/rdoc/generator/template/darkfish/class.rhtml | 24 | ||||
-rw-r--r-- | lib/rdoc/generator/template/darkfish/css/rdoc.css | 15 |
2 files changed, 29 insertions, 10 deletions
diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml index 26652cada9..afac0c44cd 100644 --- a/lib/rdoc/generator/template/darkfish/class.rhtml +++ b/lib/rdoc/generator/template/darkfish/class.rhtml @@ -72,8 +72,10 @@ <%- attributes.each do |attrib| -%> <div id="<%= attrib.aref %>" class="method-detail"> <div class="method-heading attribute-method-heading"> - <span class="method-name"><%= h attrib.name %></span><span - class="attribute-access-type">[<%= attrib.rw %>]</span> + <a href="#<%= attrib.aref %>" title="Link to this attribute"> + <span class="method-name"><%= h attrib.name %></span> + <span class="attribute-access-type">[<%= attrib.rw %>]</span> + </a> </div> <div class="method-description"> @@ -103,21 +105,27 @@ <%- if (call_seq = method.call_seq) then -%> <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%> <div class="method-heading"> - <span class="method-callseq"> - <%= h(call_seq.strip. + <a href="#<%= method.aref %>" title="Link to this method"> + <span class="method-callseq"> + <%= h(call_seq.strip. gsub( /^\w+\./m, '')). gsub(/(.*)[-=]>/, '\1→') %> - </span> + </span> + </a> </div> <%- end -%> <%- elsif method.has_call_seq? then -%> <div class="method-heading"> - <span class="method-name"><%= h method.name %></span> + <a href="#<%= method.aref %>" title="Link to this method"> + <span class="method-name"><%= h method.name %></span> + </a> </div> <%- else -%> <div class="method-heading"> - <span class="method-name"><%= h method.name %></span> - <span class="method-args"><%= h method.param_seq %></span> + <a href="#<%= method.aref %>" title="Link to this method"> + <span class="method-name"><%= h method.name %></span> + <span class="method-args"><%= h method.param_seq %></span> + </a> </div> <%- end -%> </div> diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css index 8b7662c645..12212a341e 100644 --- a/lib/rdoc/generator/template/darkfish/css/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css @@ -84,7 +84,7 @@ h4:target, h5:target, h6:target { margin-left: -10px; - border-left: 10px solid #f1edba; + border-left: 10px solid var(--source-code-background-color); } /* 4. Links */ @@ -631,6 +631,18 @@ main .method-heading { color: var(--text-color); } +main .method-heading::after { + content: 'ΒΆ'; + position: absolute; + visibility: hidden; + color: var(--secondary-color); + font-size: 0.5em; +} + +main .method-heading:hover::after { + visibility: visible; +} + main .method-controls { line-height: 20px; float: right; @@ -663,7 +675,6 @@ main #attribute-method-details .method-detail:hover { } main .attribute-access-type { text-transform: uppercase; - padding: 0 1em; } /* @end */ |