[Mod] use sphinx again

This commit is contained in:
nanoric 2019-05-29 15:52:54 +08:00
parent e0eb4188d2
commit 98973fde95
8 changed files with 395 additions and 6 deletions

156
docs/_static/custom.css vendored Normal file
View File

@ -0,0 +1,156 @@
@import url("vendor.css");
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
/*padding-top: 50px; */ /* uncomment if navbar should be fixed */
}
body,
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Lato","Helvetica Neue",Helvetica,Arial,sans-serif;
}
h1 {
font-size: 42px;
font-weight: 500;
}
h2 {
font-weight: 300;
font-size: 34px;
}
ul, ol {
margin: 0 0 10px 20px;
padding: 0;
}
code {
padding: 0;
}
/* -- sidebar --------------------------------------------------------------- */
.page-sidebar {
margin-top: 25px;
border: 1px solid #cad7e1;
background-color: #FFF;
}
.search > input[type="text"] {
width: 165px;
}
/* dirty but works ¯\_(ツ)_/¯ */
@media (max-width:1200px) and (min-width:768px) {
.search > input[type="text"] {
width: 100px;
}
}
.page-sidebarwrapper {
padding: 10px;
line-height: 1.3;
}
.page-sidebarwrapper ul li a {
display: block;
padding: 3px 0;
}
a.reference {
border: none;
text-decoration: none;
}
a.reference:hover {
text-decoration: underline;
border: none;
}
a.reference:active {
text-decoration: underline;
border: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
img.screenshot {
width: 100%;
box-shadow: 0 4px 16px rgba(85, 85, 85, 0.8);
border-radius: 6px;
margin: 15px 0;
}
.page-content {
padding-top: 0px;
margin-top: 25px;
margin-bottom: 20px;
}
.paper {
background-color: #FFF;
padding: 20px;
border: 1px solid #cad7e1;
position: relative;
}
.paper:before {
content: "";
position: absolute;
top: -1px;
right: -1px;
border-width: 0 40px 40px 0;
border-style: solid;
border-color: #ccc #F6F9FC;
z-index: 3;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
padding: 20px 0;
background-color: #333333;
}
.copyright,
.made-in,
.powered-by {
margin: 0;
}
pre {
display: block;
margin: 0 0 12px;
line-height: 1.42857;
word-break: break-all;
word-wrap: break-word;
color: #333;
background-color: #f5f5f5;
border: 1px solid #cad7e1;
border-radius: 0;
}

9
docs/_static/vendor.css vendored Normal file

File diff suppressed because one or more lines are too long

BIN
docs/_static/vnpy.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

140
docs/_templates/layout.html vendored Normal file
View File

@ -0,0 +1,140 @@
{% extends 'basic/layout.html' %}
{%- block extrahead %}
{{ super() }}
<link rel="stylesheet" href="{{ pathto('_static/custom.css', 1) }}" type="text/css" />
{% if theme_touch_icon %}
<link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
{% endif %}
{% if theme_canonical_url %}
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
{% endblock %}
{# Disable base theme's top+bottom related navs; we have our own in sidebar #}
{%- block relbar1 %}{% endblock %}
{%- block relbar2 %}{% endblock %}
{# Nav should appear before content, not after #}
{%- block content %}
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topnav-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand topnav" href="https://www.vnpy.com/">vn.py — By Traders, For Traders</a>
</div>
<div class="collapse navbar-collapse" id="topnav-collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="/">主页</a>
</li>
<li>
<a href="/forum/">社区</a>
</li>
<li>
<a href="/docs/">文档</a>
</li>
<li>
<a href="https://www.github.com/vnpy/vnpy" target="_blank">Github</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
{%- macro sidebar() %}
{%- if render_sidebar %}
<div class="page-sidebar" role="navigation" aria-label="main navigation">
<div class="page-sidebarwrapper">
{%- block sidebarlogo %}
{%- if logo %}
<p class="logo">
<a href="{{ pathto(master_doc) }}"><img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/></a>
</p>
{%- endif %}
{%- endblock %}
{%- if sidebars != None %}
{#- new style sidebar: explicitly include/exclude templates #}
{%- for sidebartemplate in sidebars %}
{%- include sidebartemplate %}
{%- endfor %}
{%- endif %}
</div>
</div>
{%- endif %}
{%- endmacro %}
{%- if theme_fixed_sidebar|lower == 'true' %}
<div class="container">
{% if render_sidebar %}
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-3">
{{ sidebar() }}
</div>
{% endif %}
{%- block document %}
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-9 page-content" role="main">
<div class="paper">
{% block body %} {% endblock %}
</div>
</div>
{%- endblock %}
<div class="clearer"></div>
</div>
{%- else %}
{{ super() }}
{%- endif %}
{%- endblock %}
{%- block footer %}
<footer class="flaskbb-footer">
<div class="container">
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<p class="copyright text-muted small pull-left">
© 2015 -
<!--<script type="text/javascript">document.write(new Date().getFullYear());</script>-->
2019
&nbsp;&nbsp;&nbsp;&nbsp;
vn.py Team
</p>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<p class="made-in text-muted small" style="text-align: center">
By Traders, For Traders
</p>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<p class="powered-by text-muted small pull-right">
powered by <a href="https://flaskbb.org">FlaskBB</a>
</p>
</div>
</div>
</div>
</footer>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
{% if theme_analytics_id %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ theme_analytics_id }}']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endif %}
{%- endblock %}

22
docs/_templates/relations.html vendored Normal file
View File

@ -0,0 +1,22 @@
{# Changes to the original: capitalized 'Documentation Overview' #}
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="{{ pathto(master_doc) }}">Documentation Overview</a><ul>
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}">{{ parent.title }}</a><ul>
{%- endfor %}
{%- if prev %}
<li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter')
}}">{{ prev.title }}</a></li>
{%- endif %}
{%- if next %}
<li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter')
}}">{{ next.title }}</a></li>
{%- endif %}
{%- for parent in parents %}
</ul></li>
{%- endfor %}
</ul></li>
</ul>
</div>

13
docs/_templates/searchbox.html vendored Normal file
View File

@ -0,0 +1,13 @@
{# Changes to the original: capitalized 'Quick Search' #}
{%- if pagename != "search" and builder != "singlehtml" %}
<div id="searchbox" style="display: none" role="search">
<h3>{{ _('Quick Search') }}</h3>
<form class="search" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" />
<input type="submit" value="{{ _('Go') }}" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
{%- endif %}

6
docs/_templates/sidebarintro.html vendored Normal file
View File

@ -0,0 +1,6 @@
<h3>Useful Links</h3>
<ul>
<li><a href="https://flaskbb.org">FlaskBB Website</a></li>
<li><a href="https://forums.flaskbb.org">FlaskBB Forums</a></li>
<li><a href="https://github.com/sh4nks/flaskbb">FlaskBB @ GitHub</a></li>
</ul>

View File

@ -24,9 +24,9 @@ copyright = '2019, vn.py Team'
author = 'vn.py Team' author = 'vn.py Team'
# The short X.Y version # The short X.Y version
version = '2.0' version = '2.0.3'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = '2.0-DEV' release = '2.0.3'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
@ -38,7 +38,9 @@ release = '2.0-DEV'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'recommonmark' 'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'recommonmark',
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
@ -72,7 +74,7 @@ locale_dirs = ["locale/"]
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = None pygments_style = 'sphinx'
# -- Options for HTML output ------------------------------------------------- # -- Options for HTML output -------------------------------------------------
@ -85,8 +87,20 @@ html_theme = 'alabaster'
# documentation. # documentation.
# #
html_theme_options = { html_theme_options = {
'logo': 'vnpy.ico',
"base_bg": "inherit", "base_bg": "inherit",
"narrow_sidebar_bg": "inherit", "narrow_sidebar_bg": "inherit",
'github_banner': True,
'github_user': 'vnpy',
'github_repo': 'vnpy',
'github_type': 'star',
'description': (r"<div class='col-md-12'>"
r"<strong>VN.PY</strong>"
r"</div>"
r"<br/>"
r"By Traders, For Traders"),
'fixed_sidebar': True,
'show_related': True
} }
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
@ -102,7 +116,21 @@ html_static_path = ['_static']
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``. # 'searchbox.html']``.
# #
# html_sidebars = {} html_sidebars = {
'index': [
'about.html',
'sidebarintro.html',
'sourcelink.html',
'searchbox.html'
],
'**': [
'about.html',
'localtoc.html',
'relations.html',
'sourcelink.html',
'searchbox.html'
]
}
# -- Options for HTMLHelp output --------------------------------------------- # -- Options for HTMLHelp output ---------------------------------------------
@ -158,6 +186,16 @@ texinfo_documents = [
'Miscellaneous'), 'Miscellaneous'),
] ]
# -- Options for intersphinx output ----------------------------------------------
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'flask': ('http://flask.pocoo.org/docs/latest/', None),
'werkzeug': ('http://werkzeug.pocoo.org/docs/latest/', None),
'click': ('http://click.pocoo.org/', None),
'jinja': ('http://jinja.pocoo.org/docs/latest', None),
'wtforms': ('https://wtforms.readthedocs.io/en/latest', None),
}
# -- Options for Epub output ------------------------------------------------- # -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
@ -171,6 +209,11 @@ epub_title = project
# A unique identification for the text. # A unique identification for the text.
# #
# epub_uid = '' # epub_uid = ''
# A list of files that should not be packed into the epub file. # A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html'] epub_exclude_files = ['search.html']
# -- Options for Autodoc -------------------------------------------------
autodoc_default_options = {
'member-order': 'bysource',
'undoc-members': True,
}