Skip to content

Commit 88d7c91

Browse files
committed
Use RTD theme as a plugin
1 parent 69d2198 commit 88d7c91

23 files changed

+6
-3262
lines changed

_build/.requirements.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
alabaster==0.7.10
2-
Babel==2.4.0
31
docutils==0.13.1
4-
imagesize==0.7.1
5-
Jinja2==2.10.1
6-
MarkupSafe==1.0
72
Pygments==2.2.0
8-
pytz==2017.2
9-
requests==2.20.0
10-
six==1.10.0
11-
snowballstemmer==1.2.1
123
sphinx==1.8.5
13-
git+https://github.com/fabpot/[email protected]#egg_name=sphinx-php
144
sphinxcontrib-phpdomain==0.6.3
5+
git+https://github.com/fabpot/[email protected]#egg_name=sphinx-php
156
jsx-lexer===0.0.8
7+
sphinx_rtd_theme==0.5.0
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,7 @@
1-
from sphinx.highlighting import lexers, PygmentsBridge
21
from pygments.style import Style
3-
from pygments.formatters import HtmlFormatter
42
from pygments.token import Keyword, Name, Comment, String, Error, \
53
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
64

7-
from sphinx.writers.html import HTMLTranslator
8-
from docutils import nodes
9-
from sphinx.locale import admonitionlabels, lazy_gettext
10-
11-
customadmonitionlabels = admonitionlabels
12-
l_ = lazy_gettext
13-
customadmonitionlabels['best-practice'] = l_('Best Practice')
14-
15-
def _getType(path):
16-
return path[:path.find('/')]
17-
18-
def _isIndex(path):
19-
return 'index' in path
20-
21-
class SensioHTMLTranslator(HTMLTranslator):
22-
def __init__(self, builder, *args, **kwds):
23-
HTMLTranslator.__init__(self, builder, *args, **kwds)
24-
builder.templates.environment.filters['get_type'] = _getType
25-
builder.templates.environment.tests['index'] = _isIndex
26-
self.highlightlinenothreshold = 0
27-
28-
def visit_literal(self, node):
29-
self.body.append(self.starttag(node, 'code', '', CLASS='docutils literal notranslate'))
30-
31-
def depart_literal(self, node):
32-
self.body.append('</code>')
33-
34-
def visit_admonition(self, node, name=''):
35-
self.body.append(self.starttag(node, 'div', CLASS=('admonition-wrapper')))
36-
self.body.append('<div class="admonition ' + name + '">')
37-
if name and name != 'seealso':
38-
node.insert(0, nodes.title(name, customadmonitionlabels[name]))
39-
self.set_first_last(node)
40-
41-
def depart_admonition(self, node=None):
42-
self.body.append('</div></div>\n')
43-
44-
def visit_sidebar(self, node):
45-
self.body.append(self.starttag(node, 'div', CLASS=('admonition-wrapper')))
46-
self.body.append('<div class="admonition admonition-sidebar">')
47-
self.set_first_last(node)
48-
self.in_sidebar = 1
49-
50-
def depart_sidebar(self, node):
51-
self.body.append('</div></div>\n')
52-
self.in_sidebar = None
53-
54-
# overriden to add a new highlight div around each block
55-
def visit_literal_block(self, node):
56-
if node.rawsource != node.astext():
57-
# most probably a parsed-literal block -- don't highlight
58-
return BaseTranslator.visit_literal_block(self, node)
59-
lang = self.highlightlang
60-
linenos = node.rawsource.count('\n') >= \
61-
self.highlightlinenothreshold - 1
62-
highlight_args = node.get('highlight_args', {})
63-
if node.has_key('language'):
64-
# code-block directives
65-
lang = node['language']
66-
highlight_args['force'] = True
67-
if node.has_key('linenos'):
68-
linenos = node['linenos']
69-
def warner(msg):
70-
self.builder.warn(msg, (self.builder.current_docname, node.line))
71-
highlighted = self.highlighter.highlight_block(
72-
node.rawsource, lang, warn=warner, linenos=linenos,
73-
**highlight_args)
74-
starttag = self.starttag(node, 'div', suffix='',
75-
CLASS='highlight-%s' % lang)
76-
self.body.append('<div class="literal-block">' + starttag + highlighted + '</div></div>\n')
77-
raise nodes.SkipNode
78-
795
class SensioStyle(Style):
806
background_color = "#000000"
817
default_style = ""
@@ -158,8 +84,3 @@ class SensioStyle(Style):
15884
Generic.Subheading: "bold #800080", # class: 'gu'
15985
Generic.Traceback: "bold #a40000", # class: 'gt'
16086
}
161-
162-
def setup(app):
163-
app.set_translator('html', SensioHTMLTranslator)
164-
165-
return {'parallel_read_safe': True}

_build/_themes/sphinx_rtd_theme/__init__.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

_build/_themes/sphinx_rtd_theme/breadcrumbs.html

Lines changed: 0 additions & 82 deletions
This file was deleted.

_build/_themes/sphinx_rtd_theme/footer.html

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)