# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, absolute_import import sphinx_bootstrap_theme import os import toml import csv import sys sys.path.insert(0, os.path.join("@CMAKE_CURRENT_SOURCE_DIR@", "ext")) ROOT = os.path.join("@CMAKE_CURRENT_SOURCE_DIR@", "src") def generate_properties_csv(): for path in ["atom", "residue", "frame"]: data = toml.load(os.path.join(ROOT, "properties/{}.toml".format(path))) output = os.path.join(ROOT, "properties/{}.csv".format(path)) csvfile = open(output, 'w') writer = csv.writer(csvfile) writer.writerow(['Name', 'Type', 'Format', 'Description']) for property, value in data.items(): rows = [] first = True for format, description in value.items(): if format == "type": continue if first: row = (property, value["type"]) first = False else: row = ("", "") row = row + (format, description) rows.append(row) for row in rows: writer.writerow(row) csvfile.close() generate_properties_csv() def version(): with open(os.path.join("@PROJECT_SOURCE_DIR@", "VERSION")) as f: full_version = f.read().split('-') release = full_version[0] version = '.'.join(release.split('.')[0:2]) if len(full_version) > 1: # Developement release release += "-dev" version += "-dev" return (version, release) def setup(app): app.add_css_file("chemfiles.css") # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '3.2' # 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.mathjax', 'breathe', # chemfiles specific extensions, in doc/ext 'htmlhidden', 'chfl_example', 'chfl_selection', ] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = 'Chemfiles' # Get release and version numbers version, release = version() # Breathe projects breathe_projects = { "chemfiles": os.path.join("@CMAKE_CURRENT_BINARY_DIR@", "doxygen", "xml") } breathe_default_project = "chemfiles" # Add any paths that contain templates here, relative to this directory. templates_path = [os.path.join(ROOT, "..", "templates")] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # -- 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 = 'bootstrap' html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() html_theme_options = { 'navbar_site_name': "Navigation", 'navbar_pagenav': False, 'source_link_position': None, 'bootswatch_theme': "flatly", 'bootstrap_version': "3", } html_sidebars = { '**': ['sidebar-toc.html', 'searchbox.html'] } # 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 = [os.path.join(ROOT, ".." , "static", "css", "chemfiles.css")] # Output file base name for HTML help builder. htmlhelp_basename = 'chemfiles' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. 'preamble': ''' \\usepackage{pifont} \\usepackage{newunicodechar} \\newunicodechar{✓}{\\ding{51}} \\newunicodechar{✗}{\\ding{55}} ''', } latex_documents = [ ('index', 'chemfiles.tex', u'Chemfiles Documentation', u'Guillaume Fraux', 'howto'), ] # -- Options for Linkcheck ------------------------------------------------- # do not try to check archive.org, it can timeout a lot linkcheck_ignore = [r'https://web.archive.org/']