Exemplo n.º 1
0
def setup(sphinx):
    '''
    Sets up the |ose|

    This will:

      * Register various config variables
      * Add the Origen and sphinxbootstrap4 themes
      * Set the theme to 'origen' (overridable by the user later)
      * Configure :recommonmark_home:`recommonmark <>`
  
    Changes to the Sphinx environment here are benign though - that is,
    changes here either have no effect if not used (such as adding paths or adding markdown support)
    or can be overridden in the user's ``conf`` (such as the ``theme``)

  '''
    sphinx.add_config_value("origen_subprojects", {}, '')
    sphinx.add_config_value("origen_no_api", None, 'env')
    sphinx.add_config_value("origen_templates", None, '')
    sphinx.add_config_value("origen_api_module_data_clashes", {}, '')
    sphinx.add_config_value("origen_refs_for", {}, '')
    sphinx.add_config_value("origen_content_header", {}, '')
    sphinx.add_config_value("include_origen_shorthand_defs", True, '')

    sphinx.add_config_value('origen_bypass_rustdoc', False, '')
    sphinx.add_config_value('origen_bypass_subprojects', False, '')
    sphinx.add_config_value('origen_releasing_build', False, '')

    sphinx.connect("config-inited", apply_origen_config)
    sphinx.connect("builder-inited", subprojects.build_subprojects)
    sphinx.config.html_theme_path += [sphinxbootstrap4theme.get_path()]
    sphinx.add_html_theme('origen', str(theme_dir))

    sphinx.add_event("origen-preprocess-docstring")

    for ext in origen.app.compiler.supported_extensions:
        # Register files that will use Origen's compiler to be found by Sphinx.
        # Otherwise, Sphinx will skip these.
        # For example, this will register .rst.mako as a file Sphinx will pickup.
        sphinx.add_source_suffix(f'.rst{ext}', 'restructuredtext')
        sphinx.add_source_suffix(f'.md{ext}', 'markdown')

    # We'll set the theme here to Origen, but the user's config can override in their conf.py
    sphinx.config.html_theme = 'origen'

    # Note: Origen includes the recommonmark module, so even if the user removes it from the extensions list in their own config,
    #  this will still be safe. It'll just have no usage.
    # Setup taken from: https://recommonmark.readthedocs.io/en/latest/auto_structify.html
    # Adding the config here so users get it for free - its not particularly obvious what this does so want to abstract this as much as possible.
    # It can be overridden in the their own 'setup' method as well.
    github_doc_root = 'https://github.com/rtfd/recommonmark/tree/master/doc/'
    sphinx.add_config_value(
        'recommonmark_config', {
            'url_resolver': lambda url: github_doc_root + url,
            'enable_eval_rst:': True,
        }, True)
    sphinx.add_transform(AutoStructify)

    # There a bug floating around in recommonmark that show links generating warning like:
    #   '...\recommonmark\parser.py:75: UserWarning: Container node skipped: type=document'
    # Some Tickets:
    #   * https://github.com/readthedocs/recommonmark/issues/177
    #   * https://github.com/readthedocs/recommonmark/pull/185
    #   * https://github.com/readthedocs/recommonmark/issues/130
    # Looks like fixes may have been merged from the first ticket, but not released.
    # For now, monkeypatching the 'visit_document' definition based on this:
    #   https://github.com/readthedocs/recommonmark/issues/177#issuecomment-555553053
    # which just gets rid of the method body. Haven't noticed anything ill-effects yet.
    setattr(CommonMarkParser, 'visit_document', lambda *args: None)

    sphinx.connect("source-read", templating.insert_header)
    sphinx.connect("source-read", templating.preprocess_src)
Exemplo n.º 2
0
Arquivo: conf.py Projeto: mccue/unfurl
# a list of builtin themes.
html_theme_options = {
    "show_sidebar": True,
    # "navbar_bg_class": 'faded',
    # "navbar_color_class": 'light',
    "sidebar_fixed": False,
    "main_width": "90%",
}

# default theme:
# html_theme = "alabaster"

import sphinxbootstrap4theme

html_theme = "sphinxbootstrap4theme"
html_theme_path = [sphinxbootstrap4theme.get_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_css_files = ["custom.css"]
html_js_files = ["custom.js"]
html_logo = "./unfurl_logo.svg"
html_favicon = "favicon32.png"

# default: {"**":['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
html_sidebars = {"**": ["globaltoc.html"], "index": []}
html_title = "Unfurl Documentation"
# XXX fix search
Exemplo n.º 3
0
project = 'ER Diagram Manual'
copyright = '2016, myasuda'
author = 'myasuda'

version = '0.0.1'
release = '0.0.1'

language = 'ja'

exclude_patterns = []

pygments_style = 'sphinx'

html_theme = 'sphinxbootstrap4theme'
html_theme_path = [sphinxbootstrap4theme.get_path()]
html_theme_options = {
    'sidebar_right': False,
    'navbar_pages_title': 'Menu',
    'navbar_links': [
        ('GitHub', 'https://github.com/myyasuda/sphinx_erdiagram', True)
    ]
}

#html_static_path = ['_static']
htmlhelp_basename = 'ERDiagramManualdoc'

latex_elements = {}
latex_documents = [
    (master_doc, 'ERDiagramManual.tex', 'ER Diagram Manual Documentation',
     'myasuda', 'manual'),