Skip to content

Commit 41f3662

Browse files
committed
remove the custom functions from the sphinx config, since rtd does not support them
1 parent 5bd7338 commit 41f3662

File tree

2 files changed

+1
-93
lines changed

2 files changed

+1
-93
lines changed

docs/en/history.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ Release History
55
dev
66

77
- Fix problem with space in WORKON_HOME path (:bbissue:`79`).
8-
- Add bitbucket directives to the local sphinx config file to avoid
9-
the extra build dependency and to try the doc build on readthedocs,
10-
again.
118

129
2.6.3
1310

docs/sphinx/conf.py

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
import sys, os
1515

16-
building_web = int(os.environ.get('BUILDING_WEB', '0'))
17-
1816
# If extensions (or modules to document with autodoc) are in another directory,
1917
# add these directories to sys.path here. If the directory is relative to the
2018
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -24,7 +22,7 @@
2422

2523
# Add any Sphinx extension module names here, as strings. They can be extensions
2624
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
27-
extensions = [ ]
25+
extensions = [ 'sphinxcontrib.bitbucket' ]
2826

2927
bitbucket_project_url = 'http://bitbucket.org/dhellmann/virtualenvwrapper/'
3028

@@ -196,90 +194,3 @@
196194

197195
# If false, no module index is generated.
198196
#latex_use_modindex = True
199-
200-
from docutils import nodes, utils
201-
from docutils.parsers.rst.roles import set_classes
202-
203-
def make_link_node(rawtext, app, type, slug, options):
204-
"""Create a link to a BitBucket resource.
205-
206-
:param rawtext: Text being replaced with link node.
207-
:param app: Sphinx application context
208-
:param type: Link type (issue, changeset, etc.)
209-
:param slug: ID of the thing to link to
210-
:param options: Options dictionary passed to role func.
211-
"""
212-
#
213-
try:
214-
base = app.config.bitbucket_project_url
215-
if not base:
216-
raise AttributeError
217-
except AttributeError, err:
218-
raise ValueError('bitbucket_project_url configuration value is not set (%s)' % str(err))
219-
#
220-
slash = '/' if base[-1] != '/' else ''
221-
ref = base + slash + type + '/' + slug + '/'
222-
set_classes(options)
223-
node = nodes.reference(rawtext, type + ' ' + utils.unescape(slug), refuri=ref,
224-
**options)
225-
return node
226-
227-
228-
def bbissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
229-
"""Link to a BitBucket issue.
230-
231-
Returns 2 part tuple containing list of nodes to insert into the
232-
document and a list of system messages. Both are allowed to be
233-
empty.
234-
235-
:param name: The role name used in the document.
236-
:param rawtext: The entire markup snippet, with role.
237-
:param text: The text marked with the role.
238-
:param lineno: The line number where rawtext appears in the input.
239-
:param inliner: The inliner instance that called us.
240-
:param options: Directive options for customization.
241-
:param content: The directive content for customization.
242-
"""
243-
try:
244-
issue_num = int(text)
245-
if issue_num <= 0:
246-
raise ValueError
247-
except ValueError:
248-
msg = inliner.reporter.error(
249-
'BitBucket issue number must be a number greater than or equal to 1; '
250-
'"%s" is invalid.' % text, line=lineno)
251-
prb = inliner.problematic(rawtext, rawtext, msg)
252-
return [prb], [msg]
253-
app = inliner.document.settings.env.app
254-
node = make_link_node(rawtext, app, 'issue', str(issue_num), options)
255-
return [node], []
256-
257-
def bbchangeset_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
258-
"""Link to a BitBucket changeset.
259-
260-
Returns 2 part tuple containing list of nodes to insert into the
261-
document and a list of system messages. Both are allowed to be
262-
empty.
263-
264-
:param name: The role name used in the document.
265-
:param rawtext: The entire markup snippet, with role.
266-
:param text: The text marked with the role.
267-
:param lineno: The line number where rawtext appears in the input.
268-
:param inliner: The inliner instance that called us.
269-
:param options: Directive options for customization.
270-
:param content: The directive content for customization.
271-
"""
272-
app = inliner.document.settings.env.app
273-
node = make_link_node(rawtext, app, 'changeset', text, options)
274-
return [node], []
275-
276-
277-
def setup(app):
278-
"""Install the plugin.
279-
280-
:param app: Sphinx application context.
281-
"""
282-
app.add_role('bbissue', bbissue_role)
283-
app.add_role('bbchangeset', bbchangeset_role)
284-
app.add_config_value('bitbucket_project_url', None, 'env')
285-
return

0 commit comments

Comments
 (0)