mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 1.0
This commit is contained in:
commit
763789463d
2
CHANGES
2
CHANGES
@ -71,6 +71,8 @@ Release 1.1 (in development)
|
|||||||
Release 1.0.7 (in development)
|
Release 1.0.7 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* #571: Implement ``~`` cross-reference prefix for the C domain.
|
||||||
|
|
||||||
* Fix regression of LaTeX output with the fix of #556.
|
* Fix regression of LaTeX output with the fix of #556.
|
||||||
|
|
||||||
* #568: Fix lookup of class attribute documentation on descriptors
|
* #568: Fix lookup of class attribute documentation on descriptors
|
||||||
|
@ -308,6 +308,8 @@ single word, like this::
|
|||||||
:param integer limit: maximum number of stack frames to show
|
:param integer limit: maximum number of stack frames to show
|
||||||
|
|
||||||
|
|
||||||
|
.. _python-roles:
|
||||||
|
|
||||||
Cross-referencing Python objects
|
Cross-referencing Python objects
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -438,6 +440,8 @@ The C domain (name **c**) is suited for documentation of C API.
|
|||||||
.. c:var:: PyObject* PyClass_Type
|
.. c:var:: PyObject* PyClass_Type
|
||||||
|
|
||||||
|
|
||||||
|
.. _c-roles:
|
||||||
|
|
||||||
Cross-referencing C constructs
|
Cross-referencing C constructs
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -522,6 +526,9 @@ The following directives are available:
|
|||||||
|
|
||||||
Select the current C++ namespace for the following objects.
|
Select the current C++ namespace for the following objects.
|
||||||
|
|
||||||
|
|
||||||
|
.. _cpp-roles:
|
||||||
|
|
||||||
These roles link to the given object types:
|
These roles link to the given object types:
|
||||||
|
|
||||||
.. rst:role:: cpp:class
|
.. rst:role:: cpp:class
|
||||||
@ -689,6 +696,8 @@ The JavaScript domain (name **js**) provides the following directives:
|
|||||||
|
|
||||||
Describes the attribute *name* of *object*.
|
Describes the attribute *name* of *object*.
|
||||||
|
|
||||||
|
.. _js-roles:
|
||||||
|
|
||||||
These roles are provided to refer to the described objects:
|
These roles are provided to refer to the described objects:
|
||||||
|
|
||||||
.. rst:role:: js:func
|
.. rst:role:: js:func
|
||||||
@ -740,6 +749,8 @@ The reStructuredText domain (name **rst**) provides the following directives:
|
|||||||
|
|
||||||
Foo description.
|
Foo description.
|
||||||
|
|
||||||
|
.. _rst-roles:
|
||||||
|
|
||||||
These roles are provided to refer to the described objects:
|
These roles are provided to refer to the described objects:
|
||||||
|
|
||||||
.. rst:role:: rst:dir
|
.. rst:role:: rst:dir
|
||||||
|
@ -44,6 +44,18 @@ more versatile:
|
|||||||
tool-tip on mouse-hover) will always be the full target name.
|
tool-tip on mouse-hover) will always be the full target name.
|
||||||
|
|
||||||
|
|
||||||
|
Cross-referencing objects
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
These roles are described with their respective domains:
|
||||||
|
|
||||||
|
* :ref:`Python <python-roles>`
|
||||||
|
* :ref:`C <c-roles>`
|
||||||
|
* :ref:`C++ <cpp-roles>`
|
||||||
|
* :ref:`JavaScript <js-roles>`
|
||||||
|
* :ref:`ReST <rst-roles>`
|
||||||
|
|
||||||
|
|
||||||
.. _ref-role:
|
.. _ref-role:
|
||||||
|
|
||||||
Cross-referencing arbitrary locations
|
Cross-referencing arbitrary locations
|
||||||
|
@ -99,13 +99,20 @@ class CObject(ObjectDescription):
|
|||||||
m = c_funcptr_name_re.match(name)
|
m = c_funcptr_name_re.match(name)
|
||||||
if m:
|
if m:
|
||||||
name = m.group(1)
|
name = m.group(1)
|
||||||
|
|
||||||
|
typename = self.env.temp_data.get('c:type')
|
||||||
|
if self.name == 'c:member' and typename:
|
||||||
|
fullname = typename + '.' + name
|
||||||
|
else:
|
||||||
|
fullname = name
|
||||||
|
|
||||||
if not arglist:
|
if not arglist:
|
||||||
if self.objtype == 'function':
|
if self.objtype == 'function':
|
||||||
# for functions, add an empty parameter list
|
# for functions, add an empty parameter list
|
||||||
signode += addnodes.desc_parameterlist()
|
signode += addnodes.desc_parameterlist()
|
||||||
if const:
|
if const:
|
||||||
signode += addnodes.desc_addname(const, const)
|
signode += addnodes.desc_addname(const, const)
|
||||||
return name
|
return fullname
|
||||||
|
|
||||||
paramlist = addnodes.desc_parameterlist()
|
paramlist = addnodes.desc_parameterlist()
|
||||||
arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
|
arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
|
||||||
@ -127,7 +134,7 @@ class CObject(ObjectDescription):
|
|||||||
signode += paramlist
|
signode += paramlist
|
||||||
if const:
|
if const:
|
||||||
signode += addnodes.desc_addname(const, const)
|
signode += addnodes.desc_addname(const, const)
|
||||||
return name
|
return fullname
|
||||||
|
|
||||||
def get_index_text(self, name):
|
def get_index_text(self, name):
|
||||||
if self.objtype == 'function':
|
if self.objtype == 'function':
|
||||||
@ -163,6 +170,31 @@ class CObject(ObjectDescription):
|
|||||||
if indextext:
|
if indextext:
|
||||||
self.indexnode['entries'].append(('single', indextext, name, name))
|
self.indexnode['entries'].append(('single', indextext, name, name))
|
||||||
|
|
||||||
|
def before_content(self):
|
||||||
|
self.typename_set = False
|
||||||
|
if self.name == 'c:type':
|
||||||
|
if self.names:
|
||||||
|
self.env.temp_data['c:type'] = self.names[0]
|
||||||
|
self.typename_set = True
|
||||||
|
|
||||||
|
def after_content(self):
|
||||||
|
if self.typename_set:
|
||||||
|
self.env.temp_data['c:type'] = None
|
||||||
|
|
||||||
|
|
||||||
|
class CXRefRole(XRefRole):
|
||||||
|
def process_link(self, env, refnode, has_explicit_title, title, target):
|
||||||
|
if not has_explicit_title:
|
||||||
|
target = target.lstrip('~') # only has a meaning for the title
|
||||||
|
# if the first character is a tilde, don't display the module/class
|
||||||
|
# parts of the contents
|
||||||
|
if title[0:1] == '~':
|
||||||
|
title = title[1:]
|
||||||
|
dot = title.rfind('.')
|
||||||
|
if dot != -1:
|
||||||
|
title = title[dot+1:]
|
||||||
|
return title, target
|
||||||
|
|
||||||
|
|
||||||
class CDomain(Domain):
|
class CDomain(Domain):
|
||||||
"""C language domain."""
|
"""C language domain."""
|
||||||
@ -184,11 +216,11 @@ class CDomain(Domain):
|
|||||||
'var': CObject,
|
'var': CObject,
|
||||||
}
|
}
|
||||||
roles = {
|
roles = {
|
||||||
'func' : XRefRole(fix_parens=True),
|
'func' : CXRefRole(fix_parens=True),
|
||||||
'member': XRefRole(),
|
'member': CXRefRole(),
|
||||||
'macro': XRefRole(),
|
'macro': CXRefRole(),
|
||||||
'data': XRefRole(),
|
'data': CXRefRole(),
|
||||||
'type': XRefRole(),
|
'type': CXRefRole(),
|
||||||
}
|
}
|
||||||
initial_data = {
|
initial_data = {
|
||||||
'objects': {}, # fullname -> docname, objtype
|
'objects': {}, # fullname -> docname, objtype
|
||||||
|
@ -138,15 +138,11 @@
|
|||||||
|
|
||||||
% Play with vspace to be able to keep the indentation.
|
% Play with vspace to be able to keep the indentation.
|
||||||
\newlength\distancetoright
|
\newlength\distancetoright
|
||||||
\newlength\leftsidespace
|
|
||||||
\def\mycolorbox#1{%
|
\def\mycolorbox#1{%
|
||||||
\setlength\leftsidespace{\@totalleftmargin}%
|
|
||||||
\setlength\distancetoright{\linewidth}%
|
\setlength\distancetoright{\linewidth}%
|
||||||
\advance\distancetoright -\@totalleftmargin %
|
\advance\distancetoright -\@totalleftmargin %
|
||||||
\noindent\hspace*{\@totalleftmargin}%
|
|
||||||
\fcolorbox{VerbatimBorderColor}{VerbatimColor}{%
|
\fcolorbox{VerbatimBorderColor}{VerbatimColor}{%
|
||||||
\begin{minipage}{\distancetoright}%
|
\begin{minipage}{\distancetoright}%
|
||||||
\noindent\hspace*{-\leftsidespace}%
|
|
||||||
#1
|
#1
|
||||||
\end{minipage}%
|
\end{minipage}%
|
||||||
}%
|
}%
|
||||||
@ -480,4 +476,4 @@
|
|||||||
\raggedright
|
\raggedright
|
||||||
}
|
}
|
||||||
{\endlist}
|
{\endlist}
|
||||||
}{}
|
}{}
|
||||||
|
Loading…
Reference in New Issue
Block a user