vtk-m/docs/users-guide/_ext/fullref.py
Kenneth Moreland b80b7e2e71 Add VTK-m User's Guide to source
This is a start of moving the VTK-m User's Guide into the VTK-m source.
This is only the start of the process. There are several goals of this
work.

1. Integrate the documentation into the source code better to better
   keep the code up to date.
2. Move the documentation over to Sphinx so that it can be posted online
   and be more easily linked.
3. Incoporate Doxygen into the guide to keep the documentation
   consistent.
4. Build the user guide examples as part of the VTK-m CI to catch
   compatibility changes quickly.
2023-10-17 11:31:27 -04:00

38 lines
1.4 KiB
Python

##=============================================================================
##
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##
##=============================================================================
import docutils.nodes
import sphinx_tools
def fullref_role(reftype, name, rawtext, text, lineno, inliner, options, content):
return sphinx_tools.role_reparse(
':numref:`%s {number} ({name})<%s>`' % (reftype, text),
lineno, inliner)
def partref_role(name, rawtext, text, lineno, inliner, options = {}, content = []):
return fullref_role(
'Part', name, rawtext, text, lineno, inliner, options, content)
def chapref_role(name, rawtext, text, lineno, inliner, options = {}, content = []):
return fullref_role(
'Chapter', name, rawtext, text, lineno, inliner, options, content)
def secref_role(name, rawtext, text, lineno, inliner, options = {}, content = []):
return fullref_role(
'Section', name, rawtext, text, lineno, inliner, options, content)
def setup(app):
app.add_role('partref', partref_role)
app.add_role('chapref', chapref_role)
app.add_role('secref', secref_role)