Belle II Software  release-05-02-19
basf2ext Namespace Reference

Classes

class  ModuleListDirective
 
class  RenderDocstring
 
class  VariableListDirective
 

Functions

def parse_with_titles (state, content)
 
def html_page_context (app, pagename, templatename, context, doctree)
 
def jira_issue_role (role, rawtext, text, lineno, inliner, options={}, content=[])
 
def setup (app)
 

Detailed Description

This module is a Sphinx Extension for the Belle~II Software:

* add a domain "b2" for modules and variables.
  Modules can be documented using the ``.. b2:module::` directive and variables
  using the ``.. b2:variable::` directive. They can be cross referenced with
  :b2:mod: and :b2:var: respectively
* add an index for basf2 modules
* add a directive to automatically document basf2 modules similar to autodoc

    .. b2-modules::
        :package: framework
        :modules: EventInfoSetter, EventInfoPrinter
        :library: libcore.so
        :regex-filter: Event.*

* add directive to automatically document basf2 variables

    .. b2-variables::
        :group: Kinematics
        :variables: x, y, z
        :regex-filter: .*

Function Documentation

◆ html_page_context()

def basf2ext.html_page_context (   app,
  pagename,
  templatename,
  context,
  doctree 
)
Provide Link to Stash Repository, see https://mg.pov.lt/blog/sphinx-edit-on-github.html

this goes in conjunction with
site_scons/sphinx/_sphinxtemplates/sourcelink.html and adds a link to our
git repository instead to the local source link

Definition at line 237 of file basf2ext.py.

237 def html_page_context(app, pagename, templatename, context, doctree):
238  """Provide Link to Stash Repository, see https://mg.pov.lt/blog/sphinx-edit-on-github.html
239 
240  this goes in conjunction with
241  site_scons/sphinx/_sphinxtemplates/sourcelink.html and adds a link to our
242  git repository instead to the local source link
243  """
244 
245  if templatename != 'page.html' or not doctree:
246  return
247 
248  path = os.path.relpath(doctree.get('source'), app.builder.srcdir)
249  repository = app.config.basf2_repository
250  if not repository:
251  return
252 
253  commit = app.config.basf2_commitid
254  context["source_url"] = f"{repository}/browse/{path}"
255  if commit:
256  context["source_url"] += "?at=" + commit
257 
258 

◆ parse_with_titles()

def basf2ext.parse_with_titles (   state,
  content 
)
Shortcut function to parse a reStructuredText fragment into docutils nodes

Definition at line 40 of file basf2ext.py.