# Configuration file for the Sphinx documentation builder.
#
# -- Path setup --------------------------------------------------------------

import sys, os
# sys.path.insert(0, os.path.abspath('.'))
#sys.path.append(os.path.abspath('ext'))
sys.path.append('.')

#---- debug mode ----
# shows/hides the todos
todo_include_todos = False

# -- Project information -----------------------------------------------------

project = 'Rougail'
copyright = '2019-2026, Silique'
author = 'gwen'

# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '1.0'


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

extensions = [
        'sphinx.ext.extlinks', 'sphinx_lesson', 'sphinx.ext.todo',
        'ext.xref', 'ext.extinclude', 'sphinxnotes.strike',
]

#---- disable highlight warnings with yaml new version ----
# Configuration pour les blocs de code
highlight_language = 'yaml'

# Options spécifiques pour YAML
highlight_options = {
    'yaml': {
        'startinline': True
    }
}

suppress_warnings = [
    'misc.highlighting_failure'
]

#---- xref links ----
#import the xref.py extension
xref_links = {"link_name" : ("user text", "url")}

#link_name = "Sphinx External Links"
#user_text = "modified External Links Extension"
#url = "http://www.sphinx-doc.org/en/stable/ext/extlinks.html"
#enables syntax like:
" :xref:`tiramisu` "
links = {
        'tiramisu': ('Tiramisu', 'https://tiramisu.readthedocs.io/en/latest/'),
        'tiramisu library': ('Tiramisu library homepage', 'https://forge.cloud.silique.fr/stove/tiramisu'),
        }
xref_links.update(links)

#---- ext links ----
# **extlinks** 'sphinx.ext.extlinks',
# enables syntax like
" :source:`v1.1_010/firefox/00-proxy.yml` "
extlinks = {'source': ('https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/%s',
                       'source: %s'),
            'tiramisu': ('https://tiramisu.readthedocs.io/en/latest/%s', 'tiramisu: %s'),
            'tutorial': ('https://forge.cloud.silique.fr/stove/rougail-tutorials/%s', 'tutorial %s'),
            }

#---- options for HTML output ----
default_role = "code"
html_theme = "sphinx_rtd_theme"
pygments_style = 'sphinx'
html_short_title = "Rougail"
html_title = "Rougail documentation"
html_show_sourcelink = False
html_show_sphinx = False
html_show_copyright = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
html_static_path = ['_static']
html_css_files = ['terminal.css', 'custom.css']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
#source_suffix = ['.rst', '.md']
source_suffix = '.rst'
#source_suffix = {
#    '.rst': 'restructuredtext',
#    '.txt': 'restructuredtext',
#    '.md': 'markdown',
#}
# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'

# 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 = ['.venv', 'build', '_build', 'Thumbs.db', '.DS_Store']

# ------------------------------------------------------------------------------
## underline role
## sample: Voici du texte :underline:`souligné`.

from docutils import nodes
from docutils.parsers.rst import roles

def underline_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
    node = nodes.inline(rawtext, text, **options)
    node['classes'].append('underline')
    return [node], []

def setup(app):
    app.add_role('underline', underline_role)
    app.add_css_file('css/custom.css')
    
