Skip to content

Commit 94c9f43

Browse files
authored
Create conf.py
1 parent d50c45d commit 94c9f43

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

docs/conf.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
import re
18+
import sys
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = 'haskell-language-server'
23+
24+
# We want to take some of the metadata from the Cabal file, especially the version.
25+
# (otherwise it's very easy to forget to update it!)
26+
release = None
27+
copyright = None
28+
author = None
29+
versionPattern = re.compile("^version:\s*([\d.]+)")
30+
copyrightPattern = re.compile("^copyright:\s*(.+)")
31+
authorPattern = re.compile("^author:\s*(.+)")
32+
for i, line in enumerate(open('../haskell-language-server.cabal')):
33+
versionMatch = re.search(versionPattern, line)
34+
if versionMatch:
35+
release = versionMatch.group(1)
36+
copyrightMatch = re.search(copyrightPattern, line)
37+
if copyrightMatch:
38+
copyright = copyrightMatch.group(1)
39+
authorMatch = re.search(authorPattern, line)
40+
if authorMatch:
41+
author = authorMatch.group(1)
42+
43+
if not release:
44+
print("Couldn't find version")
45+
sys.exit()
46+
if not copyright:
47+
print("Couldn't find copyright")
48+
sys.exit()
49+
if not author:
50+
print("Couldn't find author")
51+
sys.exit()
52+
53+
# -- General configuration ---------------------------------------------------
54+
55+
# Add any Sphinx extension module names here, as strings. They can be
56+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
57+
# ones.
58+
extensions = [
59+
'myst_parser',
60+
'sphinx_rtd_theme',
61+
'sphinx.ext.autosectionlabel'
62+
]
63+
64+
# Add any paths that contain templates here, relative to this directory.
65+
templates_path = ['_templates']
66+
67+
# List of patterns, relative to source directory, that match files and
68+
# directories to ignore when looking for source files.
69+
# This pattern also affects html_static_path and html_extra_path.
70+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
71+
72+
73+
# -- Options for HTML output -------------------------------------------------
74+
75+
# The theme to use for HTML and HTML Help pages. See the documentation for
76+
# a list of builtin themes.
77+
#
78+
html_theme = 'sphinx_rtd_theme'
79+
# html_logo = ''
80+
# html_favicon = ''
81+
82+
# Add any paths that contain custom static files (such as style sheets) here,
83+
# relative to this directory. They are copied after the builtin static files,
84+
# so a file named "default.css" will overwrite the builtin "default.css".
85+
html_static_path = ['_static']
86+
87+
# Enable linking to an anchor of a relative page
88+
# See https://github.com/executablebooks/MyST-Parser/issues/443
89+
myst_heading_anchors = 3
90+
91+
# -- Custom Document processing ----------------------------------------------
92+
93+
def setup(app):
94+
app.add_css_file("theme_overrides.css")

0 commit comments

Comments
 (0)