From bd331b2451a17eaf5ed8f6fc8aa89f0499031c28 Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Wed, 28 Mar 2018 10:27:51 -0700 Subject: Update OPNFV Sphinx Theme When the theme was initially created I was under the assumption the directory the theme lives under needs to match the name. This does not seem to be the case and in fact seems to cause issues with correctly importing and using the theme. Includes formatting updates to the README and linting. Change-Id: I67c834bfe9dc99252159394ecbf136d9a264e0a8 Signed-off-by: Trevor Bramwell --- opnfv-theme/MANIFEST.in | 2 +- opnfv-theme/README.rst | 20 +++++++------ opnfv-theme/setup.py | 18 +++++------ opnfv-theme/sphinx_opnfv_theme/__init__.py | 3 +- opnfv-theme/sphinx_opnfv_theme/layout.html | 5 ++++ .../sphinx_opnfv_theme/my_custom_sidebar.html | 3 ++ opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html | 5 ---- .../opnfv/my_custom_sidebar.html | 3 -- .../sphinx_opnfv_theme/opnfv/relations.html | 15 ---------- .../sphinx_opnfv_theme/opnfv/static/favicon.ico | Bin 15086 -> 0 bytes .../sphinx_opnfv_theme/opnfv/static/logo.png | Bin 2829 -> 0 bytes .../sphinx_opnfv_theme/opnfv/static/my-styles.css | 33 --------------------- opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf | 7 ----- opnfv-theme/sphinx_opnfv_theme/relations.html | 15 ++++++++++ opnfv-theme/sphinx_opnfv_theme/static/favicon.ico | Bin 0 -> 15086 bytes opnfv-theme/sphinx_opnfv_theme/static/logo.png | Bin 0 -> 2829 bytes .../sphinx_opnfv_theme/static/my-styles.css | 33 +++++++++++++++++++++ opnfv-theme/sphinx_opnfv_theme/theme.conf | 7 +++++ 18 files changed, 86 insertions(+), 83 deletions(-) create mode 100644 opnfv-theme/sphinx_opnfv_theme/layout.html create mode 100644 opnfv-theme/sphinx_opnfv_theme/my_custom_sidebar.html delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html delete mode 100755 opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css delete mode 100644 opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf create mode 100644 opnfv-theme/sphinx_opnfv_theme/relations.html create mode 100755 opnfv-theme/sphinx_opnfv_theme/static/favicon.ico create mode 100644 opnfv-theme/sphinx_opnfv_theme/static/logo.png create mode 100644 opnfv-theme/sphinx_opnfv_theme/static/my-styles.css create mode 100644 opnfv-theme/sphinx_opnfv_theme/theme.conf (limited to 'opnfv-theme') diff --git a/opnfv-theme/MANIFEST.in b/opnfv-theme/MANIFEST.in index a5886cd20..34bc06617 100644 --- a/opnfv-theme/MANIFEST.in +++ b/opnfv-theme/MANIFEST.in @@ -2,6 +2,6 @@ include *.txt include *.rst recursive-include sphinx_opnfv_theme * -recursive-include sphinx_opnfv_theme/opnfv * +recursive-include sphinx_opnfv_theme/static * global-exclude *.pyc diff --git a/opnfv-theme/README.rst b/opnfv-theme/README.rst index 484a7a793..c307768fb 100644 --- a/opnfv-theme/README.rst +++ b/opnfv-theme/README.rst @@ -12,21 +12,23 @@ Here's how to install the theme from PyPI_ To install and configure the theme do the following. -#. Install the theme from pypi:: +#. Install the theme from pypi: - $ pip install sphinx_opnfv_theme + .. code-block:: bash + + $ pip install sphinx_opnfv_theme #. Configure Sphinx to use the theme: -.. code-block:: python + .. code-block:: python - # conf.py - import sphinx_opnfv_theme + # conf.py + import sphinx_opnfv_theme - # ... + # ... - html_theme = 'opnfv' - html_theme_path = sphinx_opnfv_theme.get_html_theme_path() + html_theme = 'opnfv' + html_theme_path = sphinx_opnfv_theme.get_html_theme_path() Customization ------------- @@ -39,7 +41,7 @@ following options for the bootstrap theme:: html_theme_options = { 'bootswatch_theme': 'journal', - 'navbar_sidebarrel': false, + 'navbar_sidebarrel': False, 'navbar_title': '', } diff --git a/opnfv-theme/setup.py b/opnfv-theme/setup.py index 5375c0940..55f55bc92 100644 --- a/opnfv-theme/setup.py +++ b/opnfv-theme/setup.py @@ -2,29 +2,29 @@ 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, + long_description=open('README.rst').read(), url='https://docs.opnfv.org/', author='Trevor Bramwell', author_email='tbramwell@linuxfoundation.org', version=__version__, - entry_points = { + entry_points={ 'sphinx.html_themes': [ 'opnfv = sphinx_opnfv_theme', ] }, packages=find_packages(), - install_requires = [ + install_requires=[ 'sphinx_bootstrap_theme', - 'sphinxcontrib.httpdomain', + 'sphinxcontrib-httpdomain', ], include_package_data=True, - package_data = { - 'sphinx_opnfv_theme': ['opnfv/**',] - }, + package_data={'sphinx_opnfv_theme': [ + 'theme.conf', + 'static/*', + '*.html', + ]}, ) diff --git a/opnfv-theme/sphinx_opnfv_theme/__init__.py b/opnfv-theme/sphinx_opnfv_theme/__init__.py index 007927521..2bf05c3ae 100644 --- a/opnfv-theme/sphinx_opnfv_theme/__init__.py +++ b/opnfv-theme/sphinx_opnfv_theme/__init__.py @@ -2,7 +2,7 @@ from os import path -__version__='0.1.1' +__version__ = '0.2.0' def get_html_theme_path(): @@ -10,6 +10,7 @@ def get_html_theme_path(): 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/layout.html b/opnfv-theme/sphinx_opnfv_theme/layout.html new file mode 100644 index 000000000..ddd674cf1 --- /dev/null +++ b/opnfv-theme/sphinx_opnfv_theme/layout.html @@ -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/my_custom_sidebar.html b/opnfv-theme/sphinx_opnfv_theme/my_custom_sidebar.html new file mode 100644 index 000000000..6b259bc93 --- /dev/null +++ b/opnfv-theme/sphinx_opnfv_theme/my_custom_sidebar.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html b/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html deleted file mode 100644 index ddd674cf1..000000000 --- a/opnfv-theme/sphinx_opnfv_theme/opnfv/layout.html +++ /dev/null @@ -1,5 +0,0 @@ -{# 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 deleted file mode 100644 index 6b259bc93..000000000 --- a/opnfv-theme/sphinx_opnfv_theme/opnfv/my_custom_sidebar.html +++ /dev/null @@ -1,3 +0,0 @@ - \ 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 deleted file mode 100644 index 5bad0b562..000000000 --- a/opnfv-theme/sphinx_opnfv_theme/opnfv/relations.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
- {% if prev %} - Prev Page - {% else %} - - {% endif %} - - {% if next %} - Next Page - {% else %} - - {% endif %} -
-
\ 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 deleted file mode 100755 index bbe55ab40..000000000 Binary files a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/favicon.ico and /dev/null differ diff --git a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png b/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png deleted file mode 100644 index 1519503eb..000000000 Binary files a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/logo.png and /dev/null 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 deleted file mode 100644 index 8feb45bfd..000000000 --- a/opnfv-theme/sphinx_opnfv_theme/opnfv/static/my-styles.css +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index 66424aa1f..000000000 --- a/opnfv-theme/sphinx_opnfv_theme/opnfv/theme.conf +++ /dev/null @@ -1,7 +0,0 @@ -[theme] -inherit = bootstrap -stylesheet = bootstrap-sphinx.css -pygments_style = tango - -# Theme Options exposed by html_theme_options -[options] diff --git a/opnfv-theme/sphinx_opnfv_theme/relations.html b/opnfv-theme/sphinx_opnfv_theme/relations.html new file mode 100644 index 000000000..5bad0b562 --- /dev/null +++ b/opnfv-theme/sphinx_opnfv_theme/relations.html @@ -0,0 +1,15 @@ +
+
+ {% if prev %} + Prev Page + {% else %} + + {% endif %} + + {% if next %} + Next Page + {% else %} + + {% endif %} +
+
\ No newline at end of file diff --git a/opnfv-theme/sphinx_opnfv_theme/static/favicon.ico b/opnfv-theme/sphinx_opnfv_theme/static/favicon.ico new file mode 100755 index 000000000..bbe55ab40 Binary files /dev/null and b/opnfv-theme/sphinx_opnfv_theme/static/favicon.ico differ diff --git a/opnfv-theme/sphinx_opnfv_theme/static/logo.png b/opnfv-theme/sphinx_opnfv_theme/static/logo.png new file mode 100644 index 000000000..1519503eb Binary files /dev/null and b/opnfv-theme/sphinx_opnfv_theme/static/logo.png differ diff --git a/opnfv-theme/sphinx_opnfv_theme/static/my-styles.css b/opnfv-theme/sphinx_opnfv_theme/static/my-styles.css new file mode 100644 index 000000000..8feb45bfd --- /dev/null +++ b/opnfv-theme/sphinx_opnfv_theme/static/my-styles.css @@ -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/theme.conf b/opnfv-theme/sphinx_opnfv_theme/theme.conf new file mode 100644 index 000000000..66424aa1f --- /dev/null +++ b/opnfv-theme/sphinx_opnfv_theme/theme.conf @@ -0,0 +1,7 @@ +[theme] +inherit = bootstrap +stylesheet = bootstrap-sphinx.css +pygments_style = tango + +# Theme Options exposed by html_theme_options +[options] -- cgit 1.2.3-korg