From 5bce530017aa47e7c24103068ed45dc05b40c466 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 13 Dec 2019 11:13:30 +0100 Subject: [PATCH 1/2] Support of autogenerated HTML documentation via Sphinx Signed-off-by: garciadeblas --- .gitignore | 6 +++ Dockerfile | 5 +++ Makefile | 20 +++++++++ _static/style.css | 3 ++ _templates/layout.html | 4 ++ assets/osm_logo.svg | 59 ++++++++++++++++++++++++++ conf.py | 96 ++++++++++++++++++++++++++++++++++++++++++ index.rst | 22 ++++++++++ make.bat | 35 +++++++++++++++ requirements.txt | 4 ++ 10 files changed, 254 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 _static/style.css create mode 100644 _templates/layout.html create mode 100644 assets/osm_logo.svg create mode 100644 conf.py create mode 100644 index.rst create mode 100644 make.bat create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 484eb1a..53ce78e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,9 @@ pythonweb.py # Generated output from examples charms/ .tar.gz + +# Sphinx related files # +######################## +!_templates/*.html +_build + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fad35e9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:alpine3.7 +COPY . /osm-doc +WORKDIR /osm-doc +RUN pip install -r requirements.txt +CMD [ "python", "./my_script.py" ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/_static/style.css b/_static/style.css new file mode 100644 index 0000000..8aa6c28 --- /dev/null +++ b/_static/style.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: 1200px !important; +} diff --git a/_templates/layout.html b/_templates/layout.html new file mode 100644 index 0000000..3e44f4a --- /dev/null +++ b/_templates/layout.html @@ -0,0 +1,4 @@ +{% extends "!layout.html" %} +{% block extrahead %} + +{% endblock %} diff --git a/assets/osm_logo.svg b/assets/osm_logo.svg new file mode 100644 index 0000000..ebe15ef --- /dev/null +++ b/assets/osm_logo.svg @@ -0,0 +1,59 @@ + + + + + MANO-Color + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf.py b/conf.py new file mode 100644 index 0000000..be5da68 --- /dev/null +++ b/conf.py @@ -0,0 +1,96 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Open Source MANO' +copyright = '2019, ETSI OSM' +author = 'ETSI OSM' + +# The full version, including alpha/beta/rc tags +release = '6.0' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.todo', + 'sphinx.ext.viewcode', + 'sphinx.ext.githubpages', + 'recommonmark', +] + +source_suffix = { + '.rst': 'restructuredtext', + '.txt': 'markdown', + '.md': 'markdown', +} + +# The master toctree document. +master_doc = 'index' + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'templates', + 'examples', 'output', 'navigation.md', 'index.md', + 'requirements.txt', 'README.md'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +#html_theme = 'alabaster' +#html_theme = 'pyramid' +#html_theme = 'bizstyle' +html_theme = 'sphinx_rtd_theme' +#html_theme = 'neo_rtd_theme' +#import sphinx_theme +#html_theme_path = [sphinx_theme.get_html_theme_path()] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_theme_options = { + 'canonical_url': 'https://osm.etsi.org/docs', + 'logo_only': True, + 'display_version': True, + 'prev_next_buttons_location': 'bottom', + 'style_external_links': False, + #'style_nav_header_background': 'white', + # Toc options + 'collapse_navigation': True, + 'sticky_navigation': True, + 'navigation_depth': 3, + 'includehidden': True, + 'titles_only': False +} + +#html_logo = 'assets/osm_logo.png' +html_logo = 'assets/osm_logo.svg' + diff --git a/index.rst b/index.rst new file mode 100644 index 0000000..ad6b3c9 --- /dev/null +++ b/index.rst @@ -0,0 +1,22 @@ +.. Open Source MANO VNF Onboarding guide master file. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Open Source MANO's VNF Onboarding guide! +=================================================== + +.. toctree:: + :maxdepth: 2 + :caption: Table of Contents + :name: mastertoc + + 00-introduction + 01-requirements + 02-day0 + 03-day1 + 04-day2 + 05-basic-examples + 06-walkthrough + 07-advanced-charms + 08-references + diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..315fad4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +sphinx +sphinx_rtd_theme +sphinxcontrib-versioning +recommonmark -- GitLab From e177d644a3e9cb44b890dc90d6cbfaa9bfa76d64 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 13 Dec 2019 11:41:59 +0100 Subject: [PATCH 2/2] Added required extension form MD tables with Sphinx Signed-off-by: garciadeblas --- conf.py | 1 + requirements.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/conf.py b/conf.py index be5da68..cecb265 100644 --- a/conf.py +++ b/conf.py @@ -36,6 +36,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.githubpages', 'recommonmark', + 'sphinx_markdown_tables', ] source_suffix = { diff --git a/requirements.txt b/requirements.txt index 315fad4..e5fa376 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ sphinx sphinx_rtd_theme sphinxcontrib-versioning recommonmark +sphinx-markdown-tables -- GitLab