Skip to content

Commit

Permalink
Master new template and update files for TB84 and 85 (#43)
Browse files Browse the repository at this point in the history
* new template

* upd files for Tb84 and 85
  • Loading branch information
jobisoft committed Dec 22, 2020
1 parent 0b77872 commit ef5f2b3
Show file tree
Hide file tree
Showing 42 changed files with 8,024 additions and 1,547 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
_build
chrome_settings_overrides.rst
__pycache__
versionwarning-data.json
10 changes: 10 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: conf.py
61 changes: 61 additions & 0 deletions _extensions/apiheader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles


def make_div_node(self, classname, lines):
div = nodes.container()
div['classes'] = [classname]

rst = ViewList()
# Add the content one line at a time.
# Second argument is the filename to report in any warnings
# or errors, third argument is the line number.
for line in lines:
rst.append(line, "make_div.rst", 0)
# Create a node.
node = nodes.section()
node.document = self.state.document
# Parse the rst.
nested_parse_with_titles(self.state, rst, node)

div.extend(node)
return [div]

class ApiHeaderDirective(Directive):

optional_arguments = 1
final_argument_whitespace = False
has_content = True
option_spec = {
"label": directives.unchanged_required,
"annotation": directives.unchanged_required
}

def run(self):
ApiHeaderNode = nodes.container()
ApiHeaderNode['classes'] = ["api-header-node"]

ApiHeaderSection = nodes.container()
ApiHeaderSection['classes'] = ["api-header-section"]
if 'label' in self.options:
ApiHeaderSection.extend(make_div_node(self, "api-header-label", [self.options['label']]))
if 'annotation' in self.options:
ApiHeaderSection.extend(make_div_node(self, "api-header-annotation", [self.options['annotation']]))
ApiHeaderNode.append(ApiHeaderSection)

self.state.nested_parse(self.content, self.content_offset, ApiHeaderNode)

return [ApiHeaderNode]


def setup(app):
app.add_directive("api-header", ApiHeaderDirective)

return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
70 changes: 70 additions & 0 deletions _extensions/apimember.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles


def make_div_node(self, classname, lines):
div = nodes.container()
div['classes'] = [classname]

rst = ViewList()
# Add the content one line at a time.
# Second argument is the filename to report in any warnings
# or errors, third argument is the line number.
for line in lines:
rst.append(line, "make_div.rst", 0)
# Create a node.
node = nodes.section()
node.document = self.state.document
# Parse the rst.
nested_parse_with_titles(self.state, rst, node)

div.extend(node)
return [div]

class ApiMemberDirective(Directive):

optional_arguments = 0
final_argument_whitespace = False
has_content = True
option_spec = {
"type": directives.unchanged,
"name": directives.unchanged,
"annotation": directives.unchanged
}

def run(self):
apiMemberNode = nodes.container()
apiMemberNode['classes'] = ["api-member-node"]

apiMemberDefinition = nodes.container()
apiMemberDefinition['classes'] = ["api-member-definition"]
apiMemberDefinition.extend(make_div_node(self, "api-member-bullet", ['-']))

if 'name' in self.options:
apiMemberDefinition.extend(make_div_node(self, "api-member-name", [self.options['name']]))
if 'type' in self.options:
apiMemberDefinition.extend(make_div_node(self, "api-member-type", [self.options['type']]))
if 'annotation' in self.options:
apiMemberDefinition.extend(make_div_node(self, "api-member-annotation", [self.options['annotation']]))
apiMemberNode.append(apiMemberDefinition)

if len(self.content) > 0:
apiMemberDescription = nodes.container()
apiMemberDescription['classes'] = ["api-member-description"]
self.state.nested_parse(self.content, self.content_offset, apiMemberDescription)
apiMemberNode.append(apiMemberDescription)

return [apiMemberNode]


def setup(app):
app.add_directive("api-member", ApiMemberDirective)

return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
55 changes: 55 additions & 0 deletions _extensions/apisectionannotationhack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles

def make_div_node(self, classname, lines):
div = nodes.container()
div['classes'] = [classname]

rst = ViewList()
# Add the content one line at a time.
# Second argument is the filename to report in any warnings
# or errors, third argument is the line number.
for line in lines:
rst.append(line, "make_div.rst", 0)
# Create a node.
node = nodes.section()
node.document = self.state.document
# Parse the rst.
nested_parse_with_titles(self.state, rst, node)

div.extend(node)
return [div]

def visit_node(self, node):
pass

def depart_node(self, node=None):
self.body.append("</div><div class='api-section-body'>")

class ApiMainSectionAnnotation(nodes.General, nodes.Element):
pass

class ApiMainSectionDirective(Directive):
optional_arguments = 1
final_argument_whitespace = True
has_content = False

def run(self):
node = ApiMainSectionAnnotation()
if self.arguments and len(self.arguments):
node.extend(make_div_node(self, "api-section-annotation", [self.arguments[0]]))
return [node]


def setup(app):
app.add_node(ApiMainSectionAnnotation, html=(visit_node, depart_node))
app.add_directive("api-section-annotation-hack", ApiMainSectionDirective)

return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
167 changes: 167 additions & 0 deletions _static/theme_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,170 @@
}

}
span.permission {
background-color:#e74c3c;
color: #fcfcfc;
/* color:#fff; */
box-sizing:border-box;
white-space:nowrap;
max-width:100%;
border:1px solid #e1e4e5;
font-size:75%;
padding:0 5px;
font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;
overflow-x:auto
}


/* RTD adds extra p */
div.container > p,
div.container > ul {
margin: 0 !important;
}

/* api main sections like Function, Types etc */
.api-main-section h2 {
margin-top:2em;
}
.api-permission-info {
margin-top:2em;
}

/* api sections below the main sections,
/* for example the individual function definitions */
.api-main-section > .section {
background: #e7f2fa;
border-top: 3px solid #6ab0de;
margin-bottom:1ex;
display: inline flex;
align-items: center;
}
.api-main-section > .section > span {
font-size: 80%;
font-weight: bold;
font-style: italic;
padding: 5px;
display: block;
color: #3782bb;
}
#functions > .section > span::after {
content: "func";
/*color: #6ab0de;*/
}
.api-main-section .section h3 {
padding: 6px;
margin:0;
font-size: 90%;
line-height: normal;
}
#events > .section {
/*background: #ffedcc;*/
/*border-top: 3px solid #f0b37e;*/
}
#events > .section > span::after {
content: "event";
/*color: #f0b37e;*/
}
#types > .section {
/*background: #dbfaf4;*/
/*border-top: 3px solid #1abc9c;*/
}
#types > .section > span::after {
content: "type";
/*color: #1abc9c;*/
}
#properties > .section {
border-top: 3px solid #ccc;
background: #f0f0f0;
}
#properties > .section > span::after {
content: "prop";
color: #888;
}

/* api section class embraces only the section title, */
/* the rest of the section is inside the sectionbody */
.api-section-annotation > p {
padding: 6px;
margin:0;
font-size: 80%;
font-style: italic;
}
.api-section-body {
margin-bottom:3em;
margin-left: 1em;
}
.api-section-body a {
font-size: 95%;
font-style: italic;
}

/* styles for the api headers like "Parameters" */
.api-header-node {
margin: 0 0 24px;
}
.api-header-section {
background: #f0f0f0;
margin-bottom:1ex;
display: inline flex;
align-items: center;
border-left: 3px solid #ccc;
}
.api-header-section div {
padding: 6px;
}
.api-header-annotation {
margin-left:2em;
}
.api-header-annotation > p {
font-size: 80%;
font-style: italic;
}

/* member styles, elements below api headers*/
.api-member-definition {
display: flex;
align-items: text-top;
}
.api-member-name, .api-member-type, .api-member-annotation {
margin-right: 0.5ex;
}
.api-member-node {
margin-bottom: 0.5ex;
}
.api-member-description p {
font-size: 95%;
}
.api-member-description {
margin-left: 2em;
margin-bottom:1ex;
}
.api-member-description-only {
margin-bottom:1ex;
margin-left: 1ex;
}
.api-member-description-only > .api-member-node {
margin-left:-1ex;
}
.api-member-annotation > p {
font-size: 80%;
font-style: italic;
}
.api-member-type > p {
font-size: 95%;
font-style: italic;
}


.api-member-inline-changes dl,
.api-member-inline-changes dd,
.api-member-inline-changes dd > p {
margin:0 !important;
padding: 0 !important;
}
.api-member-inline-changes dt {
font-size: 95%;
line-height:24px;
margin:0 !important;
padding: 0 1ex 0 0 !important;
}

0 comments on commit ef5f2b3

Please sign in to comment.