docs/conf.py
branchmercurial-4.2
changeset 3001 67b59d1657cf
parent 2964 9aec8fec2bf8
child 4901 ce163aaeba37
equal deleted inserted replaced
2808:f47ed78ab17b 3001:67b59d1657cf
     1 # Add any Sphinx extension module names here, as strings. They can be extensions
     1 # Add any Sphinx extension module names here, as strings. They can be extensions
     2 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
     2 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
     3 extensions = []
     3 from mercurial import demandimport
       
     4 demandimport.disable()
       
     5 from docutils import nodes
       
     6 from docutils.parsers.rst import Directive
       
     7 from mercurial import ui
       
     8 from mercurial import extensions as hgext
       
     9 from mercurial import commands
       
    10 import os
       
    11 
       
    12 extensions = ["sphinx.ext.graphviz"]
       
    13 
     4 # autoclass_content = 'both'
    14 # autoclass_content = 'both'
     5 # Add any paths that contain templates here, relative to this directory.
    15 # Add any paths that contain templates here, relative to this directory.
     6 # templates_path = []
    16 # templates_path = []
     7 
    17 
     8 # The suffix of source filenames.
    18 # The suffix of source filenames.
   120 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
   130 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
   121 # html_file_suffix = '.html'
   131 # html_file_suffix = '.html'
   122 
   132 
   123 # Output file base name for HTML help builder.
   133 # Output file base name for HTML help builder.
   124 # htmlhelp_basename = ''
   134 # htmlhelp_basename = ''
       
   135 
       
   136 graphviz_output_format = "svg"
       
   137 
       
   138 class hghelpdirective(Directive):
       
   139     has_content = True
       
   140 
       
   141     def run(self):
       
   142         u = ui.ui()
       
   143         if not hasattr(u, 'disablepager'):
       
   144             return []
       
   145         u.disablepager()
       
   146         u.setconfig(
       
   147             'extensions', 'evolve',
       
   148             os.path.join(
       
   149                 os.path.abspath(os.path.dirname(__file__)),
       
   150                 os.pardir, 'hgext3rd', 'evolve'))
       
   151         hgext.loadall(u)
       
   152         u.pushbuffer()
       
   153         commands.help_(u, self.content[0])
       
   154         return [
       
   155             nodes.literal_block(text=u.popbuffer())]
       
   156 
       
   157 
       
   158 def setup(app):
       
   159     app.add_directive('hghelp', hghelpdirective)