Merge branch 'tony-linkcolors-autodoc'

Conflicts:
	sphinx_rtd_theme/static/css/theme.css
This commit is contained in:
Dave Snider 2013-11-04 22:53:05 -08:00
commit e49c76e568
6 changed files with 161 additions and 59 deletions

View File

@ -73,6 +73,27 @@ The first hexagram is made up of six unbroken lines. These unbroken lines stand
The power represented by the hexagram is to be interpreted in a dual sense in terms of its action on the universe and of its action on the world of men. In relation to the universe, the hexagram expresses the strong, creative action of the Deity. In relation to the human world, it denotes the creative action of the holy man or sage, of the ruler or leader of men, who through his power awakens and develops their higher nature. The power represented by the hexagram is to be interpreted in a dual sense in terms of its action on the universe and of its action on the world of men. In relation to the universe, the hexagram expresses the strong, creative action of the Deity. In relation to the human world, it denotes the creative action of the holy man or sage, of the ruler or leader of men, who through his power awakens and develops their higher nature.
Inline code and references
==========================
`reStructuredText`_ is a markup language. It can use roles and
declarations to turn reST into HTML.
In reST, ``*hello world*`` becomes ``<em>hello world</em>``. This is
because a library called `Docutils`_ was able to parse the reST and use a
``Writer`` to output it that way.
If I type ````an inline literal```` it will wrap it in ``<tt>``. You can
see more details on the `Inline Markup`_ on the Docutils homepage.
Also with ``sphinx.ext.autodoc``, which I use in the demo, I can link to
:class:`test_py_module.test.Foo`. It will link you right my code
documentation for it.
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
.. _Docutils: http://docutils.sourceforge.net/
.. _Inline Markup: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup
Citation Citation
======== ========

View File

@ -1,7 +1,31 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Test Module for sphinx_rtd_theme."""
class Foo: class Foo:
"""Docstring for class Foo."""
r"""Docstring for class Foo.
This text tests for the formatting of docstrings generated from output
``sphinx.ext.autodoc``. Which contain reST, but sphinx nests it in the
``<dl>``, and ``<dt>`` tags. Also, ``<tt>`` is used for class, method names
and etc, but those will *always* have the ``.descname`` or
``.descclassname`` class.
Normal ``<tt>`` (like the <tt> I just wrote here) needs to be shown with
the same style as anything else with ````this type of markup````.
It's common for programmers to give a code example inside of their
docstring::
from test_py_module import Foo
myclass = Foo()
myclass.dothismethod('with this argument')
myclass.flush()
print(myclass)
"""
#: Doc comment for class attribute Foo.bar. #: Doc comment for class attribute Foo.bar.
#: It can have multiple lines. #: It can have multiple lines.

View File

@ -221,8 +221,27 @@ footer
color: $gray-light color: $gray-light
p p
margin-bottom: $base-line-height / 2 margin-bottom: $base-line-height / 2
.rst-footer-buttons .rst-footer-buttons
+clearfix +clearfix
#search-results
.search li
margin-bottom: $base-line-height
border-bottom: solid 1px $table_border_color
padding-bottom: $base-line-height
.search li:first-child
border-top: solid 1px $table_border_color
padding-top: $base-line-height
.search li a
font-size: 120%
margin-bottom: $base-line-height / 2
display: inline-block
.context
color: $text-medium
font-size: 90%
+media($tablet) +media($tablet)
.wy-body-for-nav .wy-body-for-nav
background: $section-background-color background: $section-background-color

View File

@ -1,10 +1,36 @@
// -------------------------------------------------------------------------------------------------------------------
// 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 .rst-content
// sometimes people provide sizing in their rst, while will break the responsive layout // Sphinx by default applies HxW style attributes to images. This fixes that oversite.
img img
max-width: 100% max-width: 100%
height: auto !important height: auto !important
// Usually it's a good idea to give images some space.
.section > img .section > img
margin-bottom: $base-line-height margin-bottom: $base-line-height
// 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
// These are the various note pullouts that sphinx applies
.note, .attention, .caution, .danger, .error, .hint, .important, .tip, .warning .note, .attention, .caution, .danger, .error, .hint, .important, .tip, .warning
@extend .wy-alert @extend .wy-alert
p.last, p.first p.last, p.first
@ -27,6 +53,8 @@
@extend .wy-plain-list-disc @extend .wy-plain-list-disc
.section ol, ol.simple, ol.arabic .section ol, ol.simple, ol.arabic
@extend .wy-plain-list-decimal @extend .wy-plain-list-decimal
// Generics handling of headings and toc stuff.
.topic-title .topic-title
font-weight: bold font-weight: bold
margin-bottom: $base-line-height / 2 margin-bottom: $base-line-height / 2
@ -38,6 +66,8 @@
.align-left .align-left
float: left float: left
margin: 0px $base-line-height $base-line-height 0px margin: 0px $base-line-height $base-line-height 0px
// 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 h1, h2, h3, h4, h5, h6, dl dt
.headerlink .headerlink
display: none display: none
@ -52,6 +82,7 @@
&:hover .headerlink &:hover .headerlink
display: inline-block display: inline-block
// Sidebar content. You'll see at the bottom of this file I change it in mobile.
.sidebar .sidebar
float: right float: right
width: 40% width: 40%
@ -60,6 +91,7 @@
padding: $base-line-height padding: $base-line-height
background: $table-stripe-color background: $table-stripe-color
border: solid 1px $table-border-color border: solid 1px $table-border-color
// Sidebar content is usually less relevant, so adjust the margins and sizes.
p, ul, dl p, ul, dl
font-size: 90% font-size: 90%
.last .last
@ -74,12 +106,13 @@
margin-bottom: $base-line-height margin-bottom: $base-line-height
font-size: 100% font-size: 100%
table.docutils // These are the little citation links [1] that show up within paragraphs.
@extend .wy-table .footnote-reference, .citation-reference
@extend .wy-table-bordered-all vertical-align: super
&:not(.field-list) font-size: 90%
@extend .wy-table-striped
// 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 table.docutils.citation, table.docutils.footnote
background: none background: none
border: none border: none
@ -92,11 +125,12 @@
padding-left: 0 padding-left: 0
padding-right: 0 padding-right: 0
vertical-align: top vertical-align: top
table.docutils
.footnote-reference, .citation-reference @extend .wy-table
vertical-align: super @extend .wy-table-bordered-all
font-size: 90% &:not(.field-list)
@extend .wy-table-striped
// This table is what gets spit out for auto-generated API stuff. I style it smaller bits of padding.
table.docutils.field-list table.docutils.field-list
@extend .wy-table @extend .wy-table
border: none border: none
@ -108,65 +142,69 @@
.field-body .field-body
text-align: left text-align: left
padding-left: 0 padding-left: 0
// These are the "literals" that get spit out when you mark stuff as ``code`` as your write.
tt
@extend code
color: $black
big, em
font-size: 100% !important
line-height: normal
.xref, a &
font-weight: bold
// 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 dl
// This would be the equivilant of a .. class::
dt dt
@extend code
display: inline-block display: inline-block
margin: $base-line-height / 4 0 margin: $base-line-height / 4 0
font-size: 80% font-size: 90%
line-height: normal line-height: normal
background: $gray-lighter background: lighten($blue, 50%)
color: $gray-dark color: $blue
border: none border-top: solid 3px lighten($blue, 20%)
border-left: solid 3px $gray-light
padding: $base-line-height / 4 padding: $base-line-height / 4
&:before
color: lighten($blue, 20%)
.headerlink .headerlink
color: $text-color color: $text-color
font-size: 100% !important font-size: 100% !important
.descname, .descclassname, big, em // 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: $text-medium
.headerlink
color: $text-color
font-size: 100% !important font-size: 100% !important
line-height: normal // This is the description for the class/method.
dt:first-child
margin-top: 0
dd dd
margin-left: $base-line-height margin-left: $base-line-height
// Most of the content within these dls are one liners, so I halve the normal margins.
dl dl p, table, ul, ol
dt margin-bottom: $base-line-height / 2 !important
@extend code dt:first-child
display: inline-block margin-top: 0
margin-bottom: $base-line-height / 4 // Since dts get the callout style, we treat this less as callouts.
font-size: 80% tt
line-height: normal font-weight: bold
.headerlink &.descname, &.descclassname
color: $text-color background-color: transparent
border: none
padding: 0
font-size: 100% !important font-size: 100% !important
tt &.descname
font-family: $code-font-family font-weight: bold
&.literal
@extend code
blockquote
margin-left: $base-line-height
line-height: $base-line-height
margin-bottom: $base-line-height
#search-results
.search li
margin-bottom: $base-line-height
border-bottom: solid 1px $table_border_color
padding-bottom: $base-line-height
.search li:first-child
border-top: solid 1px $table_border_color
padding-top: $base-line-height
.search li a
font-size: 120%
margin-bottom: $base-line-height / 2
display: inline-block
.context
color: $text-medium
font-size: 90%
// Mobile specific
+media($mobile) +media($mobile)
.rst-content .rst-content
.sidebar .sidebar

View File

@ -23,7 +23,7 @@
{% endif %} {% endif %}
{# CSS #} {# CSS #}
<link href='http://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
{# JS #} {# JS #}
{% if not embedded %} {% if not embedded %}

File diff suppressed because one or more lines are too long