| 1 |
# -*- coding: utf-8 -*- |
| 2 |
import os |
| 3 |
import sys |
| 4 |
|
| 5 |
from docutils import nodes |
| 6 |
|
| 7 |
# Import common docs config. |
| 8 |
this_path = os.path.dirname(__file__) |
| 9 |
sys.path.append(os.path.normpath(os.path.join(this_path, '../'))) |
| 10 |
|
| 11 |
from mongoc_common import * # noqa: E402, F403 |
| 12 |
|
| 13 |
with open(this_path + '/../../../VERSION_CURRENT') as vc: |
| 14 |
release = version = vc.read() |
| 15 |
|
| 16 |
# -- General configuration ------------------------------------------------ |
| 17 |
templates_path = ['_templates'] |
| 18 |
source_suffix = '.rst' |
| 19 |
master_doc = 'index' |
| 20 |
|
| 21 |
# General information about the project. |
| 22 |
project = 'mongoc.org' |
| 23 |
copyright = '2009-present, MongoDB, Inc.' |
| 24 |
author = 'MongoDB, Inc' |
| 25 |
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 26 |
|
| 27 |
# The name of the Pygments (syntax highlighting) style to use. |
| 28 |
pygments_style = 'sphinx' |
| 29 |
|
| 30 |
# If true, `todo` and `todoList` produce output, else they produce nothing. |
| 31 |
todo_include_todos = False |
| 32 |
|
| 33 |
|
| 34 |
# Support :download-link:`bson` or :download-link:`mongoc`. |
| 35 |
def download_link(typ, rawtext, text, lineno, inliner, options={}, content=[]): |
| 36 |
if text == 'mongoc': |
| 37 |
lib = 'mongo-c-driver' |
| 38 |
else: |
| 39 |
raise ValueError('download link must be mongoc, not "%s"' % text) |
| 40 |
|
| 41 |
title = '%s-%s' % (lib, version) |
| 42 |
url = ('https://github.com/mongodb/mongo-c-driver/releases/tag/%(version)s') % {'version': version} |
| 43 |
|
| 44 |
pnode = nodes.reference(title, title, internal=False, refuri=url) |
| 45 |
return [pnode], [] |
| 46 |
|
| 47 |
|
| 48 |
def setup(app): |
| 49 |
mongoc_common_setup(app) # noqa: F405 |
| 50 |
|
| 51 |
app.add_role('download-link', download_link) |
| 52 |
|
| 53 |
|
| 54 |
# -- Options for HTML output ---------------------------------------------- |
| 55 |
|
| 56 |
html_theme = 'furo' |
| 57 |
html_title = html_shorttitle = 'MongoDB C Driver %s' % version |
| 58 |
# html_favicon = None |
| 59 |
html_use_smartypants = False |
| 60 |
html_show_sourcelink = False |
| 61 |
html_use_index = False |
| 62 |
rst_prolog = r""" |
| 63 |
|
| 64 |
.. _mongodb_docs_cdriver: https://www.mongodb.com/docs/languages/c/c-driver/current/ |
| 65 |
|
| 66 |
""" |
| 67 |
|
| 68 |
html_sidebars = {'**': []} |
| 69 |
|
| 70 |
# Note: http://www.sphinx-doc.org/en/1.5.1/config.html#confval-html_copy_source |
| 71 |
# This will degrade the Javascript quicksearch if we ever use it. |
| 72 |
html_copy_source = False |