adf860ea40
- Provides a toplevel documentation structure using Sphinx - Adds a `doc-html` target to the main Makefile - Converts existing documentation to RST format - Add some new documentation / tutorials - Links the developer manual and OCaml documentation - Synchronized documentation on Gitlab pages This patch is co-authored by: - Benjamin Canou <benjamin@canou.fr> - Bruno Bernardo <bernardobruno@gmail.com> - Pietro Abate <pietro.abate@inria.fr>
17 lines
606 B
Python
17 lines
606 B
Python
from docutils import nodes
|
|
import os
|
|
import os.path
|
|
|
|
def setup(app):
|
|
app.add_role('package', package_role)
|
|
|
|
def package_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
|
rel_lvl = inliner.document.current_source.replace(os.getcwd(),'').count('/')
|
|
if not os.path.exists('_build/api/odoc/'+text):
|
|
raise ValueError('opam package ' + text + ' does not exist in the odoc')
|
|
url = "api/api-inline.html#" + text + '/index.html'
|
|
for i in range(1,rel_lvl):
|
|
url = '../' + url
|
|
node = nodes.reference(rawtext, text, refuri=url, **options)
|
|
return [node], []
|