Skip to content

Commit

Permalink
CSS font fixes + TOC, autoclass examples in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Oct 1, 2019
1 parent f5dae94 commit f86dfd7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
8 changes: 7 additions & 1 deletion demo/source/basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ Basic Specification

Paragraphs contain text and may contain inline markup: *emphasis*, **strong emphasis**, `interpreted text`, ``inline literals``, standalone hyperlinks (http://www.python.org), external hyperlinks (Python_), internal cross-references (example_), footnote references ([1]_), citation references ([CIT2002]_), substitution references (|example|), and _`inline internal targets`.


Table of contents
-----------------

.. contents::

.. |example| replace:: foo **bar**


List
-------
----

Bullet lists:
```````````````
Expand Down
14 changes: 9 additions & 5 deletions demo/source/domain.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
domain
Domain
======


python
Python
------

.. py:module:: foo
Expand All @@ -12,10 +12,14 @@ python
My spam

autofunction
------------

autodoc
-------
.. autofunction:: sphinx_press_theme.add_toctree_data

.. autofunction:: io.open
autoclass
---------

.. autoclass:: sphinx.environment.collectors.EnvironmentCollector
:members:

1 change: 1 addition & 0 deletions demo/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Showcase of Sphinx features using **Press** theme.
admonition
domain
extensions

22 changes: 14 additions & 8 deletions sphinx_press_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class SimpleTocTreeCollector(EnvironmentCollector):
Executed once per document/page, at sphinx's "read" phase.
Saved data example:
{
'sections': [{'title': 'Demo', 'href': '#demo'}],
'toctrees': [<toctree: >]
}
>>> {
>>> 'sections': [{'title': 'Demo', 'href': '#demo'}],
>>> 'toctrees': [<toctree: >]
>>> }
"""
def enable(self, app):
super().enable(app)
Expand Down Expand Up @@ -65,16 +65,22 @@ def process_doc(self, app, doctree):


def add_toctree_data(app, pagename, templatename, context, doctree):
"""create toctree_data, used to build sidebar navigation
"""Create toctree_data, used to build sidebar navigation
:context dict:
:doctree docutils.nodes.document:
:param pagename: The name of the page
:type pagename: str
:param templatename: The name of the templatename
:type templatename: str
:param context: The context
:type context: dict
:param doctree: A doctree
:type doctree: docutils.nodes.document
Add to `toctree_data` to `context` that will be available on templates.
Although data is "global", it is called once per page because current
page is "highlighted", and some part of TOC might be collapsed.
:return: None
"""
# print(f"---------- Context\n{pagename}\n-------------\n")

Expand Down
7 changes: 4 additions & 3 deletions sphinx_press_theme/static/sphinx_press_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

/* FONTS FOR THE CODE - will fall back to monospace if unavailable */

@import url('https://fontlibrary.org/face/roboto-mono');
@import url('https://fontlibrary.org/face/inconsolata');

Expand All @@ -23,7 +24,7 @@
}

.sig-param {
font-family: 'Roboto Mono';
font-family: 'RobotoMonoRegular', 'Roboto Mono', 'Inconsolata', monospace;
margin-left: 0.3em;
}

Expand Down Expand Up @@ -81,12 +82,12 @@ dl.method, dl.function {
/* THE SECTION BELOW CHANGES CODE FONTS FOR BETTER 80-CHARS READABILITY */
/* Code will be displayed as Roboto, or Inconsolata if screen is small */
code, pre {
font-family: 'Roboto Mono', 'Inconsolata', monospace;
font-family: 'RobotoMonoRegular', 'Roboto Mono', 'Inconsolata', monospace;
}

@media (max-width: 1200px) {
code, pre {
font-family: 'Inconsolata', 'Roboto Mono', monospace;
font-family: 'InconsolataRegular', 'Inconsolata', 'RobotoMonoRegular', 'Roboto Mono', monospace;
}
pre {
font-size: 0.95em;
Expand Down

0 comments on commit f86dfd7

Please sign in to comment.