File: _theme_rst.sass

package info (click to toggle)
sphinx-rtd-theme 0.4.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,340 kB
  • sloc: python: 277; makefile: 51
file content (415 lines) | stat: -rw-r--r-- 13,362 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
// -------------------------------------------------------------------------------------------------------------------
// CONTRIBUTORS, PLEASE READ THIS!
// -------------------------------------------------------------------------------------------------------------------
// Couple things...
//    1. Lots of this @extends from wyrm_core/_type.sass (http://www.github.com/snide/wyrm/.
//        * Try not to replace any @extends code. It's pretty generic stuff meant to work together.
//        * That said, know that I'm very unlikely to accept PRs from wyrm just to change style here.
//    2. I plan to remove the !importants in here. Part of it is due to lazyness, part to sphinx's fondness for nesting.
//    3. Try to use variables from wyrm_core/wy_variables.sass. Notable are...
//        * $base-line-height // All margins, padding and line-height should use this in .25 increments.
//        * $text-color, $text-light, $text-dark...etc
//        * $base-font-family, $custom-font-family, $code-font-family
//    4. If you have changes for mobile/tablet, put them at the bottom of the sass file.
// --------------------------------------------------------------------------------------------------------------------

.rst-content
  // Sphinx by default applies HxW style attributes to images. This fixes that oversite.
  img
    max-width: 100%
    height: auto

  div.figure
    margin-bottom: $base-line-height
    p.caption
      font-style: italic
    p:last-child.caption
      margin-bottom: 0px

  div.figure.align-center
    text-align: center

  // Usually it's a good idea to give images some space.
  .section > img,   .section > a > img
    margin-bottom: $base-line-height

  // normalize browser styling
  abbr[title]
    text-decoration: none

  // Style external links
  &.style-external-links a.reference.external:after
    font-family: FontAwesome
    content: "\f08e"
    color: $text-light
    vertical-align: super
    font-size: 60%
    margin: 0 0.2em

  // For the most part, its safe to assume that sphinx wants you to use a blockquote as an indent. It gets
  // used in many different ways, so don't assume you can apply some fancy style, just leave it be.
  blockquote
    margin-left: $base-line-height
    line-height: $base-line-height
    margin-bottom: $base-line-height

  pre.literal-block
    white-space: pre
    margin: 0
    padding: $base-line-height / 2 $base-line-height / 2
    font-family: $code-font-family
    display: block
    overflow: auto
  pre.literal-block, div[class^='highlight']
    border: 1px solid $table-border-color
    overflow-x: auto
    // 1px hack otherwise border won't show. lame
    margin: 1px 0 $base-line-height 0
    div[class^='highlight']
      padding: 0px
      border: none
      margin: 0
  // Needs 100% width for line highlighting to work properly
  div[class^='highlight'] td.code
    width: 100%
  .linenodiv pre
    border-right: solid 1px lighten($table-border-color, 2%)
    margin: 0
    padding: $base-line-height / 2 $base-line-height / 2
    font-family: $code-font-family
    user-select: none
    pointer-events: none
  div[class^='highlight'] pre
    white-space: pre
    margin: 0
    padding: $base-line-height / 2 $base-line-height / 2
    display: block
    overflow: auto
    & .hll
      // Line emphasis spans full width
      display: block
      margin: 0 -1 * $base-line-height / 2
      padding: 0 $base-line-height / 2
  pre.literal-block, div[class^='highlight'] pre, .linenodiv pre
    font-family: $code-font-family
    font-size: 12px
    line-height: 1.4

  .code-block-caption
    font-style: italic
    font-size: 85%
    line-height: 1
    padding: 1em 0
    text-align: center

  @media print
    .codeblock, div[class^='highlight'], div[class^='highlight'] pre
      white-space: pre-wrap

  // These are the various note pullouts that sphinx applies
  .note, .attention, .caution, .danger, .error, .hint, .important, .tip, .warning, .seealso, .admonition-todo, .admonition
    @extend .wy-alert
    .last
      margin-bottom: 0
  .admonition-title
    @extend .wy-alert-title
    @extend .fa
    @extend .fa-exclamation-circle
    &:before
      margin-right: 4px
  .note, .seealso
    @extend .wy-alert.wy-alert-info
  .hint, .tip, .important
    @extend .wy-alert.wy-alert-success
  .error, .danger
    @extend .wy-alert.wy-alert-danger
  .warning, .caution, .attention, .admonition-todo
    @extend .wy-alert.wy-alert-warning
  // Some people put tables in notes. Let's give them very basic support.
  .admonition table
    border-color: rgba(0,0,0,.1)
    td, th
      background: transparent !important
      border-color: rgba(0,0,0,.1) !important
  .section ul, .toctree-wrapper ul
    @extend .wy-plain-list-disc
  .section ol.loweralpha, .section ol.loweralpha li
    list-style: lower-alpha
  .section ol.upperalpha, .section ol.upperalpha li
    list-style: upper-alpha
  .section ol, ol.arabic
    @extend .wy-plain-list-decimal
  .section ol p, .section ul p
    margin-bottom: $base-line-height / 2
    &:last-child
      margin-bottom: $base-line-height
  .line-block
    margin-left: 0px
    margin-bottom: $base-line-height
    line-height: $base-line-height
  .line-block .line-block
    margin-left: $base-line-height
    margin-bottom: 0px

  // Generics handling of headings and toc stuff.
  .topic-title
    font-weight: bold
    margin-bottom: $base-line-height / 2
  .toc-backref
    color: $text-color
  .align-right
    float: right
    margin: 0px 0px $base-line-height $base-line-height
  .align-left
    float: left
    margin: 0px $base-line-height $base-line-height 0px
  .align-center
    margin: auto
    // Do not override display:table for tables
    &:not(table)
      display: block
  .toctree-wrapper p.caption
    @extend h2

  // This is the #href that shows up on hover. Sphinx's is terrible so I hack it away.
  h1, h2, h3, h4, h5, h6, dl dt, p.caption, table > caption, .code-block-caption
    .headerlink
      visibility: hidden
      font-size: 14px
      @extend .fa
      &:after
        content: "\f0c1"
        font-family: FontAwesome
    &:hover .headerlink:after
      visibility: visible

  table > caption .headerlink:after
    font-size: 12px

  .centered
    text-align: center

  // Sidebar content. You'll see at the bottom of this file I change it in mobile.
  .sidebar
    float: right
    width: 40%
    display: block
    margin: 0 0 $base-line-height $base-line-height
    padding: $base-line-height
    background: $sidebar-background-color
    border: solid 1px $sidebar-border-color
    // Sidebar content is usually less relevant, so adjust the margins and sizes.
    p, ul, dl
      font-size: 90%
    .last
      margin-bottom: 0
    .sidebar-title
      display: block
      font-family: $custom-font-family
      font-weight: bold
      background: $table-border-color
      padding: $base-line-height / 4 $base-line-height / 2
      margin: -$base-line-height
      margin-bottom: $base-line-height
      font-size: 100%
  // Sphinx can highlight searched text with ?highlighted=searchterm
  .highlighted
    background: $highlight-color
    display: inline-block
    font-weight: bold
    padding: 0 $base-line-height / 4

  // These are the little citation links [1] that show up within paragraphs.
  .footnote-reference, .citation-reference
    vertical-align: baseline
    position: relative
    top: -0.4em
    line-height: 0
    font-size: 90%

  // Tables! Sphinx LOVES TABLES. Most of wyrm assumes you're only going to use a table as a table
  // so I have to write a bunch of unique stuff for Sphinx to style them up differently like it's 2003.
  table.docutils.citation, table.docutils.footnote
    background: none
    border: none
    color: $text-medium
    td, tr
      border: none
      background-color: transparent !important
      white-space: normal
    td.label
      padding-left: 0
      padding-right: 0
      vertical-align: top
    code
      color: $gray
  // Remove the large vertical space between citations and footnotes
  .wy-table-responsive.citation, .wy-table-responsive.footnote
    margin-bottom: 0
  // Re-add vertical space to element directly following citation and footnotes,
  // if the following element is of a different type
  .wy-table-responsive.citation + :not(.citation),
  .wy-table-responsive.footnote + :not(.footnote)
    margin-top: $base-line-height
  // Re-add vertical space after citation and footnotes if it is the last child of a parent
  .wy-table-responsive.citation:last-child, .wy-table-responsive.footnote:last-child
    margin-bottom: $base-line-height
  table.docutils
    @extend .wy-table
    @extend .wy-table-bordered-all
    th
      border-color: $table-border-color
    &:not(.field-list)
      @extend .wy-table-striped
    // Remove bottom margin for the last element (and it's last child)
    td .last, td .last :last-child
      margin-bottom: 0
  // This table is what gets spit out for auto-generated API stuff. I style it smaller bits of padding.
  table.field-list
    @extend .wy-table
    border: none
    td
      border: none
      p
        font-size: inherit
        line-height: inherit
    td > strong
      display: inline-block
    .field-name
      padding-right: 10px
      text-align: left
      white-space: nowrap
    .field-body
      text-align: left

  // These are the "literals" that get spit out when you mark stuff as ``code`` as your write.
  tt, code
    @extend code
    color: $black
    font-family: $code-font-family
    padding: 2px 5px
    big, em
      font-size: 100% !important
      line-height: normal

    &.literal
      color: $text-code-color
    &.xref, a &
      font-weight: bold
      color: $text-codexref-color
  pre, kbd, samp
    font-family: $code-font-family
  // If the literal is inside an a tag, let's color it like a link
  a tt, a code
    color: $link-color
  dl
    margin-bottom: $base-line-height
    dt
      font-weight: bold
      margin-bottom: $base-line-height / 2
    // Most of the content within these dls are one liners, so I halve the normal margins.
    p, table, ul, ol
      margin-bottom: $base-line-height / 2 !important
    // rST seems to want dds to be treated as the browser would, indented.
    dd
      margin: 0  0 $base-line-height / 2 $base-line-height
      line-height: $base-line-height
  // This is what Sphinx spits out for it's autodocs. Depending upon what language the person is referencing
  // these things usually have a class of "method" or "class" or something similar, but really who knows.
  // Sphinx doesn't give me a generic class on these, so unfortunately I have to apply it to the root dl.
  // This makes me terribly unhappy and makes this code very nesty. Unfortunately I've seen hand-written docs
  // that output similar, but not quite the same nesting so this is really the best we can do.
  dl:not(.docutils)
    margin-bottom: $base-line-height
    // This would be the equivilant of a .. class::
    dt
      display: table
      margin: $base-line-height / 4 0
      font-size: 90%
      line-height: normal
      background: lighten($class-color, 50%)
      color: $class-color
      border-top: solid 3px lighten($class-color, 20%)
      padding: $base-line-height / 4
      position: relative
      &:before
        color: lighten($class-color, 20%)
      .headerlink
        color: $text-color
        font-size: 100% !important
    // And this would be the .. method::
    dl dt
      margin-bottom: $base-line-height / 4
      border: none
      border-left: solid 3px hsl(0,0%,80%)
      background: hsl(0,0%,94%)
      color: $method-color
      .headerlink
        color: $headerlink-color
        font-size: 100% !important
    dt:first-child
      margin-top: 0
    // Since dts get the callout style, we treat this less as callouts.
    tt, code
      font-weight: bold
      &.descname, &.descclassname
        background-color: transparent
        border: none
        padding: 0
        font-size: 100% !important
      &.descname
        font-weight: bold
    // This is for more advanced parameter control
    .optional
      display: inline-block
      padding: 0 4px
      color: $black
      font-weight: bold
    .property
      display: inline-block
      padding-right: 8px
  // Doc links to sourcecode
  .viewcode-link, .viewcode-back
    display: inline-block
    color: $text-viewcode-color
    font-size: 80%
    padding-left: $base-line-height
  .viewcode-back
    display: block
    float: right
  p.rubric
    margin-bottom: 12px
    font-weight: bold
  //Download link
  code.download
    background: inherit
    padding: inherit
    font-weight: normal
    font-family: inherit
    font-size: inherit
    color: inherit
    border: inherit
    white-space: inherit
    span:first-child
      -webkit-font-smoothing: subpixel-antialiased
      @extend .fa
      @extend .fa-download
      &:before
        margin-right: 4px
  .guilabel
    border: 1px solid lighten($guilabel-color, 25%)
    background: lighten($guilabel-color, 50%)
    font-size: 80%
    font-weight: 700
    border-radius: $base-line-height / 6
    padding: $base-line-height / 10 $base-line-height / 4
    margin: auto $base-line-height / 12
  .versionmodified
    font-style: italic


// Mobile specific
+media($mobile)
  .rst-content
    .sidebar
      width: 100%