diff --git a/build.sh b/build.sh deleted file mode 100755 index 087af70..0000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -sphinx-build -na rst docs diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..55bd7f5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +git+https://github.com/italia/docs-italia-theme@v1.0-beta diff --git a/rst/conf.py b/rst/conf.py index d7205d8..63121ad 100755 --- a/rst/conf.py +++ b/rst/conf.py @@ -1,21 +1,45 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +import sys, os +docs_italia_theme = __import__("docs-italia-theme") +from recommonmark.transform import AutoStructify +from recommonmark.parser import CommonMarkParser + # -- PROJECT Variables ---------------------------------------------------- -settings_project_name = u"PagoPA Architettura" -settings_copyright_year = '2017' -settings_copyright_name = '' +settings_project_name = 'PagoPA Architettura' +settings_copyright_copyleft = 'AgID - Team Digitale' +settings_editor_name = 'AgID - Team Digitale' settings_doc_version = 'version: latest' settings_doc_release = 'version: latest' -settings_basename = 'cad' -settings_file_name = 'index' +settings_basename = 'pagopa-architettura' +settings_file_name = 'pagopa-architettura' + + +# -- RTD configuration ------------------------------------------------ + +# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +# This is used for linking and such so we link to the thing we're building +rtd_version = os.environ.get('READTHEDOCS_VERSION', 'latest') +if rtd_version not in ['stable', 'latest']: + rtd_version = 'stable' + +rtd_project = os.environ.get('READTHEDOCS_PROJECT', '') + +# 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. +#sys.path.insert(0, os.path.abspath('.')) -import sys -import os +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', @@ -23,13 +47,18 @@ 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', + 'docs-italia-theme', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. -source_suffix = '.rst' +source_parsers = { + '.md': CommonMarkParser, +} + +source_suffix = ['.rst', '.md'] # The encoding of source files. #source_encoding = 'utf-8-sig' @@ -40,7 +69,10 @@ # General information about the project. project = settings_project_name -copyright = settings_copyright_year + ', ' + settings_copyright_name +copyright = settings_copyright_copyleft + +# URL of Discourse instance used by sphinxcontrib.discourse extension +# discourse_url = settings_discourse_url # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -53,7 +85,6 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None language = 'it' # There are two options for replacing |today|: either, you set today to some @@ -64,45 +95,62 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['.DS_Store', ] +exclude_patterns = ['.DS_Store', 'README', 'README.md', '.venv*'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# -- AutoStructify -------------------------------------------------------- +def setup(app): + app.add_config_value('recommonmark_config', { + 'auto_toc_tree_section': 'Contents', + 'enable_eval_rst': True, + 'enable_auto_doc_ref': True + }, True) + app.add_transform(AutoStructify) + + # -- Options for HTML output ---------------------------------------------- -html_theme = 'sphinx_italia_theme' +html_theme = 'docs-italia-theme' -html_theme_path = ["_themes", ] +html_theme_path = [docs_italia_theme.get_html_theme_path()] +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + # This option can be used with docs-italia-theme to customise how the versions "badge" is shown: + # 'False': default (alabaster) badge | 'True': custom (italia) badge + 'custom_versions_badge': 'True', +} # -- ReadTheDoc requirements and local template generation--------------------- # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org on_rtd = os.environ.get('READTHEDOCS', None) == 'True' if not on_rtd: # only import and set the theme if we're building docs locally - html_theme = 'sphinx_italia_theme' - html_theme_path = ["_themes", ] + html_theme = 'docs-italia-theme' + #html_theme_path = ["themes", ] else: # Override default css to get a larger width for ReadTheDoc build html_context = { 'css_files': [ - 'https://media.readthedocs.org/css/sphinx_rtd_theme.css', - 'https://media.readthedocs.org/css/readthedocs-doc-embed.css', '_static/css/theme.css', + '_static/css/badge_only.css', ], } # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +#html_title = settings_project_name # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = "_images/governo.png" +# html_logo = "images/logo.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 @@ -112,8 +160,7 @@ # 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_static_path = ['_themes/sphinx_italia_theme/static'] +html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -151,7 +198,7 @@ #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -html_show_copyright = False +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the @@ -183,12 +230,12 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', settings_file_name + '.tex', settings_project_name, - settings_copyright_year + ', ' + settings_copyright_name, 'manual'), + settings_copyright_copyleft, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -latex_logo = "_images/governo.png" +#latex_logo = "images/..." # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. @@ -213,7 +260,7 @@ # (source start file, name, description, authors, manual section). man_pages = [ ('index', settings_file_name, settings_project_name, - [settings_copyright_name], 1) + [settings_editor_name], 1) ] # If true, show URL addresses after external links. @@ -227,6 +274,8 @@ # dir menu entry, description, category) texinfo_documents = [ ('index', settings_file_name, settings_project_name, - settings_copyright_year + ', ' + settings_copyright_name, settings_project_name, settings_project_name, + settings_copyright_copyleft, settings_project_name, settings_project_name, 'Miscellaneous'), ] + +numfig = True