OPNFV Sphinx Theme 07/51507/2
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 2 Feb 2018 20:16:52 +0000 (12:16 -0800)
committerRyota MIBU <r-mibu@cq.jp.nec.com>
Tue, 6 Feb 2018 01:42:15 +0000 (10:42 +0900)
This is a standalone theme for OPNFV docs based on the Sphinx Bootstrap
Theme used in opnfvdocs.

Change-Id: Ie145c0dc9c1e4c1ed0d8d72d687524b4ef5883de
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
12 files changed:
opnfv-theme/.gitignore [new file with mode: 0644]
opnfv-theme/MANIFEST.in [new file with mode: 0644]
opnfv-theme/README.rst [new file with mode: 0644]
opnfv-theme/setup.py [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/__init__.py [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico [new file with mode: 0755]
opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css [new file with mode: 0644]
opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf [new file with mode: 0644]

diff --git a/opnfv-theme/.gitignore b/opnfv-theme/.gitignore
new file mode 100644 (file)
index 0000000..83b2238
--- /dev/null
@@ -0,0 +1,5 @@
+/dist
+/build
+*.egg-info
+*.pyc
+__pycache__
diff --git a/opnfv-theme/MANIFEST.in b/opnfv-theme/MANIFEST.in
new file mode 100644 (file)
index 0000000..a5886cd
--- /dev/null
@@ -0,0 +1,7 @@
+include *.txt
+include *.rst
+
+recursive-include sphinx_opnfv_theme *
+recursive-include sphinx_opnfv_theme/opnfv *
+
+global-exclude *.pyc
diff --git a/opnfv-theme/README.rst b/opnfv-theme/README.rst
new file mode 100644 (file)
index 0000000..484a7a7
--- /dev/null
@@ -0,0 +1,48 @@
+OPNFV Documentation Theme
+=========================
+
+This theme is used for all OPNFV documentation and is released seperatly
+from the documentation itself. It's and extention of the `Sphinx
+Bootstrap Theme`_
+
+Installation
+------------
+
+Here's how to install the theme from PyPI_
+
+To install and configure the theme do the following.
+
+#. Install the theme from pypi::
+
+   $ pip install sphinx_opnfv_theme
+
+#. Configure Sphinx to use the theme:
+
+.. code-block:: python
+
+   # conf.py
+   import sphinx_opnfv_theme
+
+   # ...
+
+   html_theme = 'opnfv'
+   html_theme_path = sphinx_opnfv_theme.get_html_theme_path()
+
+Customization
+-------------
+
+There are no customization specific to this theme yet, but all
+all customizations_ Sphinx Bootstrap Theme are supported.
+
+If you'd like your documentation to match OPNFV's style configure the
+following options for the bootstrap theme::
+
+  html_theme_options = {
+    'bootswatch_theme': 'journal',
+    'navbar_sidebarrel': false,
+    'navbar_title': '',
+  }
+
+.. _Sphinx Bootstrap Theme: https://github.com/ryan-roemer/sphinx-bootstrap-theme
+.. _Pypi: http://pypi.python.org/pypi/sphinx-opnfv-theme/
+.. _customizations: https://github.com/ryan-roemer/sphinx-bootstrap-theme#customization
diff --git a/opnfv-theme/setup.py b/opnfv-theme/setup.py
new file mode 100644 (file)
index 0000000..5375c09
--- /dev/null
@@ -0,0 +1,30 @@
+from setuptools import setup, find_packages
+
+from sphinx_opnfv_theme import __version__
+
+with open('README.rst') as f:
+    readme_text = f.read()
+
+setup(
+    name='sphinx_opnfv_theme',
+    description="OPNFV Theme for Sphinx",
+    long_description=readme_text,
+    url='https://docs.opnfv.org/',
+    author='Trevor Bramwell',
+    author_email='tbramwell@linuxfoundation.org',
+    version=__version__,
+    entry_points = {
+        'sphinx.html_themes': [
+            'opnfv = sphinx_opnfv_theme',
+        ]
+    },
+    packages=find_packages(),
+    install_requires = [
+        'sphinx_bootstrap_theme',
+        'sphinxcontrib.httpdomain',
+    ],
+    include_package_data=True,
+    package_data = {
+        'sphinx_opnfv_theme': ['opnfv/**',]
+    },
+)
diff --git a/opnfv-theme/sphinx_opnfv_theme/__init__.py b/opnfv-theme/sphinx_opnfv_theme/__init__.py
new file mode 100644 (file)
index 0000000..0079275
--- /dev/null
@@ -0,0 +1,15 @@
+"""OPNFV Sphinx Theme"""
+
+from os import path
+
+__version__='0.1.1'
+
+
+def get_html_theme_path():
+    """Return list of HTML theme paths."""
+    local_path = path.abspath(path.dirname(__file__))
+    return [local_path]
+
+def setup(app):
+    """Required by Sphinx to create the theme."""
+    app.add_html_theme('opnfv', path.abspath(path.dirname(__file__)))
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html b/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html
new file mode 100644 (file)
index 0000000..ddd674c
--- /dev/null
@@ -0,0 +1,5 @@
+{# Import the theme's layout. #}
+{% extends "bootstrap/layout.html" %}
+
+{# Custom CSS overrides #}
+{% set css_files = css_files + ['_static/my-styles.css'] %}
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html b/opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html
new file mode 100644 (file)
index 0000000..6b259bc
--- /dev/null
@@ -0,0 +1,3 @@
+<ul class="globaltoc">
+{{ toctree(maxdepth=theme_globaltoc_depth|toint, collapse=False,includehidden=theme_globaltoc_includehidden|tobool) }}
+</ul>
\ No newline at end of file
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html b/opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html
new file mode 100644 (file)
index 0000000..5bad0b5
--- /dev/null
@@ -0,0 +1,15 @@
+<center>
+<div class="btn-group" role="group" aria-label="...">
+    {% if prev %}
+    <a class="btn btn-default" href="{{ prev.link|e }}">Prev Page</a>
+    {% else %}
+    <button type="button" class="btn btn-default disabled">Prev Page</button>
+    {% endif %}
+
+    {% if next %}
+    <a class="btn btn-default" href="{{ next.link|e }}">Next Page</a>
+    {% else %}
+    <button type="button" class="btn btn-default disabled">Next Page</button>
+    {% endif %}
+</div>
+</center>
\ No newline at end of file
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico
new file mode 100755 (executable)
index 0000000..bbe55ab
Binary files /dev/null and b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico differ
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png
new file mode 100644 (file)
index 0000000..1519503
Binary files /dev/null and b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png differ
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css
new file mode 100644 (file)
index 0000000..8feb45b
--- /dev/null
@@ -0,0 +1,33 @@
+body {
+       font-family: Helvetica, sans-serif;
+       font-size: 16px;
+}
+
+body a {
+       color: #27CCC0;
+}
+
+body a:hover {
+       color: #676767;
+}
+
+.navbar-brand img {
+       height: 200%;
+       margin-top: -5%;
+}
+
+.navbar, h1, h2, h3, h4, h5, h6 {
+       font-family: Helvetica, sans-serif;
+}
+
+.navbar-text{
+       color: #676767;
+}
+
+.navbar-form.navbar-right{
+       padding: 0;
+}
+
+.navbar-form .form-control{
+       width: 150px;
+}
diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf b/opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf
new file mode 100644 (file)
index 0000000..66424aa
--- /dev/null
@@ -0,0 +1,7 @@
+[theme]
+inherit = bootstrap
+stylesheet = bootstrap-sphinx.css
+pygments_style = tango
+
+# Theme Options exposed by html_theme_options
+[options]