Skip to content

Commit 4a1b77a

Browse files
Style main #content element
1 parent 7d0f901 commit 4a1b77a

File tree

6 files changed

+107
-111
lines changed

6 files changed

+107
-111
lines changed

lib/rdoc/generator/template/rails/_context.rhtml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<% unless context.requires.empty? %>
1313
<!-- File only: requires -->
14-
<div class="sectiontitle">Required Files</div>
14+
<div class="content__divider">Required Files</div>
1515
<ul>
1616
<% context.requires.each do |req| %>
1717
<li><%= full_name req.name %></li>
@@ -23,7 +23,7 @@
2323
<% sections = context.sections.select { |s| s.title }.sort_by{ |s| s.title.to_s } %>
2424
<% unless sections.empty? then %>
2525
<!-- Sections -->
26-
<div class="sectiontitle">Sections</div>
26+
<div class="content__divider">Sections</div>
2727
<ul>
2828
<% sections.each do |section| %>
2929
<li><%= link_to h(section.title), "##{section.aref}" %></li>
@@ -33,7 +33,7 @@
3333

3434
<% unless context.method_list.empty? %>
3535
<!-- Method ref -->
36-
<div class="sectiontitle">Methods</div>
36+
<div class="content__divider">Methods</div>
3737
<dl class="methods">
3838
<% group_by_first_letter(context.method_list).each do |letter, methods| %>
3939
<dt><%= letter %></dt>
@@ -53,7 +53,7 @@
5353

5454
<% unless context.includes.empty? %>
5555
<!-- Includes -->
56-
<div class="sectiontitle">Included Modules</div>
56+
<div class="content__divider">Included Modules</div>
5757
<ul>
5858
<% context.includes.each do |inc| %>
5959
<li>
@@ -72,7 +72,7 @@
7272
<% context.each_section do |section, constants, attributes| %>
7373

7474
<% if section.title then %>
75-
<div class="contenttitle" id="<%= h section.aref %>">
75+
<div class="content__section-title" id="<%= h section.aref %>">
7676
<%= h section.title %>
7777
</div>
7878
<% end %>
@@ -85,7 +85,7 @@
8585

8686
<% unless constants.empty? %>
8787
<!-- Section constants -->
88-
<h2 class="sectiontitle">Constants</h2>
88+
<h2 class="content__divider">Constants</h2>
8989
<table border='0' cellpadding='5'>
9090
<% constants.each do |const| %>
9191
<tr valign='top'>
@@ -106,7 +106,7 @@
106106

107107
<% unless attributes.empty? %>
108108
<!-- Section attributes -->
109-
<h2 class="sectiontitle">Attributes</h2>
109+
<h2 class="content__divider">Attributes</h2>
110110
<table border='0' cellpadding='5'>
111111
<% attributes.each do |attrib| %>
112112
<tr valign='top'>
@@ -128,7 +128,7 @@
128128
visibilities.each do |visibility, methods|
129129
next if methods.empty?
130130
%>
131-
<h2 class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</h2>
131+
<h2 class="content__divider"><%= visibility.to_s.capitalize %> <%= type %> methods</h2>
132132
<% methods.each do |method| %>
133133
<div class="method">
134134
<h3 class="title method-title" id="<%= method.aref %>">
@@ -186,7 +186,7 @@
186186

187187
<% unless context.classes_and_modules.empty? %>
188188
<!-- Namespace -->
189-
<div class="sectiontitle">Namespace</div>
189+
<div class="content__divider">Namespace</div>
190190
<ul>
191191
<% (context.modules.sort + context.classes.sort).each do |mod| %>
192192
<li>

lib/rdoc/generator/template/rails/class.rhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<%= include_template '_context.rhtml', {:context => klass} %>
3232

33-
<div class="sectiontitle">Definition files</div>
33+
<div class="content__divider">Definition files</div>
3434
<%= more_less_ul klass.in_files.map { |file| link_to file }, 5..9 %>
3535
</main>
3636
</body>

lib/rdoc/generator/template/rails/resources/css/main.css

Lines changed: 85 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
:root {
44
--line-height: 1.5;
5+
--space: calc(var(--line-height) * 0.50 * 1rem);
6+
--space-sm: calc(var(--space) / 2);
7+
--space-lg: calc(var(--space) * 2);
8+
--space-xl: calc(var(--space) * 4);
59

610
--text-color: #3b3b3b;
711
--link-color: #cc0000;
812
--link-hover-color: #990000;
913
--icon-color: #777777;
10-
--border-color: color-mix(in srgb, currentColor 25%, transparent);
1114

1215
--body-bg: #fff;
1316
--code-bg: #eee;
@@ -59,40 +62,27 @@ a:hover {
5962
display: none;
6063
}
6164

62-
p {
63-
margin-bottom: 1em;
64-
}
65-
6665
h1 {
6766
font-size: 2.1em;
6867
font-weight: normal;
6968
line-height: 1.2em;
70-
margin: 1.4em 0 0.7em 0;
7169
}
7270

7371
h2 {
7472
font-size: 1.6em;
75-
margin: 1.8em 0 0.8em 0;
7673
font-weight: normal;
7774
line-height: 1.2em;
7875
}
7976

8077
h3 {
8178
font-size: 1.4em;
82-
margin: 1.4em 0 0.7em 0;
8379
font-weight: normal;
8480
}
8581

8682
h4 {
87-
margin: 1.4em 0 0.5em 0;
8883
font-size: 1em;
8984
}
9085

91-
table
92-
{
93-
margin-bottom: 1em;
94-
}
95-
9686
td, th
9787
{
9888
padding: 0 0.7em 0.3em 0;
@@ -111,57 +101,23 @@ th
111101

112102
dt
113103
{
114-
margin-bottom: 0.3em;
115104
font-weight: bold;
116105
}
117106

118-
dd
119-
{
120-
margin-left: 2em;
121-
margin-bottom: 1em;
122-
}
123-
124-
dd p
125-
{
126-
margin-top: 0.6em;
127-
}
128-
129-
li
130-
{
131-
margin: 0 0 0.5em 2em;
132-
}
133-
134-
ul li
135-
{
136-
list-style: disc;
137-
}
138-
139-
ol li
140-
{
141-
list-style: decimal;
142-
}
143-
144-
pre
145-
{
146-
margin-bottom: 1em;
147-
}
148-
149107
.methods dt
150108
{
151109
width: 1em;
152110
font-size: 1.5em;
153111
color:#AAA;
154112
position: absolute;
155113
font-weight: normal;
156-
margin: 0;
157114
}
158115

159116
.methods dd
160117
{
161-
margin-left: 2.5em;
118+
margin-top: var(--space);
162119
min-height: 1.8em;
163120
-height: 1.8em;
164-
padding-bottom: 0.8em;
165121
}
166122

167123

@@ -173,35 +129,6 @@ pre
173129
display: inline;
174130
}
175131

176-
#content {
177-
padding: 1em;
178-
}
179-
180-
@media (min-width: 600px) {
181-
#content {
182-
padding: 2em 3.5em;
183-
}
184-
}
185-
186-
.sectiontitle {
187-
margin-top: 2em;
188-
margin-bottom: 1.3em;
189-
margin-left: -1.2em;
190-
font-size: 1.2em;
191-
padding: 0 0 0.25em 0;
192-
font-weight: bold;
193-
border-bottom: 1px solid var(--border-color);
194-
}
195-
196-
.contenttitle {
197-
margin-top: 4em;
198-
margin-bottom: 1.3em;
199-
margin-left: -0.9em;
200-
font-size: 1.6em;
201-
padding: 0 0 0.25em 0;
202-
font-weight: bold;
203-
}
204-
205132
.attr-rw {
206133
padding-right: 1em;
207134
text-align: center;
@@ -390,19 +317,6 @@ a.back-to-top.show {
390317
visibility: visible;
391318
}
392319

393-
.content__full-name {
394-
font-family: monospace;
395-
font-size: 1.4rem;
396-
line-height: 1.4;
397-
margin-top: 0;
398-
margin-left: 1em;
399-
text-indent: -1em;
400-
}
401-
402-
.content__full-name .qualifier {
403-
font-weight: bold;
404-
}
405-
406320

407321
/*
408322
* Navigation panel
@@ -534,7 +448,7 @@ html {
534448

535449
.panel__tray {
536450
min-height: 100dvh;
537-
border-right: 1px solid var(--border-color);
451+
border-right: 1px solid color-mix(in srgb, currentColor 25%, transparent);
538452
}
539453

540454
.panel__tree .tree {
@@ -543,17 +457,94 @@ html {
543457
}
544458

545459

460+
/*
461+
* Main content
462+
*/
463+
464+
#content {
465+
padding: 1em;
466+
}
467+
468+
@media (min-width: 600px) {
469+
#content {
470+
padding: var(--space-lg) var(--space-xl);
471+
}
472+
}
473+
474+
:where(#content) *,
475+
:where(#content) :is(br, wbr) {
476+
margin: 0;
477+
}
478+
479+
:where(#content) * + * {
480+
margin-top: var(--space);
481+
}
482+
483+
:where(#content) :is(ol, ul, dd) {
484+
padding: 0 0 0 1.25em;
485+
}
486+
487+
:where(#content) * + :is(li, dd) {
488+
margin-top: var(--space-sm);
489+
}
490+
491+
:where(#content) code {
492+
font-style: normal;
493+
}
494+
495+
.content__full-name {
496+
font-family: monospace;
497+
font-size: 1.4em;
498+
line-height: 1.25;
499+
padding: 0.125em 0;
500+
501+
margin-left: 1em;
502+
text-indent: -1em;
503+
}
504+
505+
.content__full-name .qualifier {
506+
font-weight: bold;
507+
}
508+
509+
.content__section-title {
510+
margin: var(--space-xl) 0 0 0;
511+
512+
font-size: 1.6em;
513+
font-weight: bold;
514+
}
515+
516+
.content__divider {
517+
margin: var(--space-xl) 0 0 0;
518+
519+
font-size: 1.4em;
520+
font-weight: bold;
521+
font-variant: small-caps;
522+
text-transform: capitalize;
523+
524+
border-bottom: 1px solid;
525+
}
526+
527+
.content__section-title + .content__divider {
528+
margin-top: var(--space);
529+
}
530+
531+
546532
/*
547533
* More-Less widget
548534
*/
549535

550536
details.more-less {
537+
margin-top: var(--space-sm);
551538
position: relative;
552539
}
553540

541+
details.more-less > ul {
542+
margin-top: 0;
543+
}
544+
554545
details.more-less summary {
555546
position: absolute;
556-
padding-left: 1em;
547+
padding-left: 0.25em;
557548
font-weight: bold;
558549
color: var(--icon-color);
559550
}
@@ -576,7 +567,7 @@ details.more-less summary::before {
576567
}
577568

578569
details.more-less[open] summary {
579-
top: calc(100% + 0.5em);
570+
top: calc(100% + var(--space-sm));
580571
}
581572

582573
details.more-less[open] summary::before {

0 commit comments

Comments
 (0)