Add new tests for sphinx.ext.autodoc, and sphinx.ext.autodoc embedded reST content. Remove code mixin from tt and address the usage of tt for descclass, descclassname. and the normal tt, which is for inline markup. Clears ambiguity on css rules. Updates the test_py_module with new content, pep257.

This commit is contained in:
Tony Narlock 2013-11-05 08:37:01 +08:00
parent 1adca1bd58
commit 6221b10c89
5 changed files with 5568 additions and 14 deletions

View File

@ -60,6 +60,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

@ -108,12 +108,12 @@
.field-body .field-body
text-align: left text-align: left
padding-left: 0 padding-left: 0
// This is seen in sphinx.ext.autodoc output
dl dl
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: $gray-lighter
color: $gray-dark color: $gray-dark
@ -123,34 +123,61 @@
.headerlink .headerlink
color: $text-color color: $text-color
font-size: 100% !important font-size: 100% !important
.descname, .descclassname, big, em
font-size: 100% !important
line-height: normal
dt:first-child dt:first-child
margin-top: 0 margin-top: 0
dd dd
margin-left: $base-line-height margin-left: $base-line-height
tt // for sphinx.ext.autodoc generated content
&.descname, &.descclassname
background-color: transparent
border: none
padding: 0
font-size: 100% !important
&.descname
font-weight: bold
dl dl dl dl
dt dt
@extend code
display: inline-block display: inline-block
margin-bottom: $base-line-height / 4 margin-bottom: $base-line-height / 4
font-size: 80% font-size: 90%
line-height: normal background: none
border: none
.headerlink .headerlink
color: $text-color color: $text-color
font-size: 100% !important font-size: 100% !important
// reST for ``inline code`` statements
// This does a few things to make inline code easier to read
// Even though the font size of $code-font-family is same as normal font
// it looks huge compared to it, so lets trial with it @ 90%.
tt tt
white-space: nowrap
max-width: 100%
background: $white
border: solid 1px $table-border-color
color: $text-color
font-size: 80%
padding: 0 5px
font-family: $code-font-family font-family: $code-font-family
&.literal overflow-x: auto
@extend code
big, em
font-size: 100% !important
line-height: normal
.xref, a &
font-weight: bold
blockquote blockquote
margin-left: $base-line-height margin-left: $base-line-height
line-height: $base-line-height line-height: $base-line-height
margin-bottom: $base-line-height margin-bottom: $base-line-height
#search-results #search-results
.search li .search li
margin-bottom: $base-line-height margin-bottom: $base-line-height

View File

@ -1 +1,236 @@
*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.font-smooth,.icon:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:fontawesome-webfont;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#fontawesome-webfont") format("svg")}.icon:before{display:inline-block;font-family:fontawesome-webfont;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .icon{display:inline-block;text-decoration:inherit}li .icon{display:inline-block}li .icon-large:before,li .icon-large:before{width:1.875em}ul.icons{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.icons li .icon{width:0.8em}ul.icons li .icon-large:before,ul.icons li .icon-large:before{vertical-align:baseline}.icon-book:before{content:"\f02d"}.icon-caret-down:before{content:"\f0d7"}.icon-caret-up:before{content:"\f0d8"}.icon-caret-left:before{content:"\f0d9"}.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .icon{color:#fcfcfc}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}} /* line 2, /home/tony/workspace/sphinx_rtd_theme/bower_components/neat/app/assets/stylesheets/grid/_grid.scss */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* line 70, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.font-smooth, .icon:before {
-webkit-font-smoothing: antialiased;
}
/* line 124, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.clearfix {
*zoom: 1;
}
/* line 117, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.clearfix:before, .clearfix:after {
display: table;
content: "";
}
/* line 121, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.clearfix:after {
clear: both;
}
@font-face {
font-family: fontawesome-webfont;
font-weight: normal;
font-style: normal;
src: url("../font/fontawesome_webfont.eot");
src: url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"), url("../font/fontawesome_webfont.woff") format("woff"), url("../font/fontawesome_webfont.ttf") format("truetype"), url("../font/fontawesome_webfont.svg#fontawesome-webfont") format("svg");
}
/* line 5, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon:before {
display: inline-block;
font-family: fontawesome-webfont;
font-style: normal;
font-weight: normal;
line-height: 1;
text-decoration: inherit;
}
/* line 14, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
a .icon {
display: inline-block;
text-decoration: inherit;
}
/* line 20, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
li .icon {
display: inline-block;
}
/* line 22, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
li .icon-large:before,
li .icon-large:before {
/* 1.5 increased font size for icon-large * 1.25 width */
width: 1.875em;
}
/* line 27, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
ul.icons {
list-style-type: none;
margin-left: 2em;
text-indent: -0.8em;
}
/* line 32, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
ul.icons li .icon {
width: 0.8em;
}
/* line 34, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
ul.icons li .icon-large:before,
ul.icons li .icon-large:before {
/* 1.5 increased font size for icon-large * 1.25 width */
vertical-align: baseline;
}
/* line 40, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon-book:before {
content: "\f02d";
}
/* line 43, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon-caret-down:before {
content: "\f0d7";
}
/* line 46, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon-caret-up:before {
content: "\f0d8";
}
/* line 49, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon-caret-left:before {
content: "\f0d9";
}
/* line 52, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge_fa.sass */
.icon-caret-right:before {
content: "\f0da";
}
/* line 1, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions {
position: fixed;
bottom: 0;
left: 0;
width: 300px;
color: #fcfcfc;
background: #1f1d1d;
border-top: solid 10px #343131;
font-family: "Lato", "proxima-nova", "Helvetica Neue", Arial, sans-serif;
z-index: 400;
}
/* line 11, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions a {
color: #2980b9;
text-decoration: none;
}
/* line 14, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-badge-small {
display: none;
}
/* line 16, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-current-version {
padding: 12px;
background-color: #272525;
display: block;
text-align: right;
font-size: 90%;
cursor: pointer;
color: #27ae60;
*zoom: 1;
}
/* line 117, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.rst-versions .rst-current-version:before, .rst-versions .rst-current-version:after {
display: table;
content: "";
}
/* line 121, /home/tony/workspace/sphinx_rtd_theme/bower_components/wyrm/sass/wyrm_core/_mixin.sass */
.rst-versions .rst-current-version:after {
clear: both;
}
/* line 25, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-current-version .icon {
color: #fcfcfc;
}
/* line 27, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-current-version .icon-book {
float: left;
}
/* line 29, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-current-version.rst-out-of-date {
background-color: #e74c3c;
color: white;
}
/* line 32, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.shift-up .rst-other-versions {
display: block;
}
/* line 34, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-other-versions {
font-size: 90%;
padding: 12px;
color: gray;
display: none;
}
/* line 39, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-other-versions hr {
display: block;
height: 1px;
border: 0;
margin: 20px 0;
padding: 0;
border-top: solid 1px #413d3d;
}
/* line 46, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-other-versions dd {
display: inline-block;
margin: 0;
}
/* line 49, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions .rst-other-versions dd a {
display: inline-block;
padding: 6px;
color: #fcfcfc;
}
/* line 53, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.rst-badge {
width: auto;
bottom: 20px;
right: 20px;
left: auto;
border: none;
max-width: 300px;
}
/* line 60, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.rst-badge .icon-book {
float: none;
}
/* line 62, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.rst-badge.shift-up .rst-current-version {
text-align: right;
}
/* line 64, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.rst-badge.shift-up .rst-current-version .icon-book {
float: left;
}
/* line 66, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.rst-badge .rst-current-version {
width: auto;
height: 30px;
line-height: 30px;
padding: 0 6px;
display: block;
text-align: center;
}
@media screen and (max-width: 768px) {
/* line 75, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions {
width: 85%;
display: none;
}
/* line 78, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
.rst-versions.shift {
display: block;
}
/* line 80, /home/tony/workspace/sphinx_rtd_theme/sass/_theme_badge.sass */
img {
width: 100%;
height: auto;
}
}

File diff suppressed because one or more lines are too long