Skip to content

Commit 2ebe099

Browse files
committed
build(sphinx): Port back to sphinx
1 parent ac35e70 commit 2ebe099

File tree

7 files changed

+50
-159
lines changed

7 files changed

+50
-159
lines changed

docs/.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
api.md

docs/Makefile

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Makefile for Sphinx documentation
22
#
3+
SHELL := /bin/bash
34
PYVERSION=$(shell python -c "import sys;v=sys.version_info[0];sys.stdout.write(str(v))")
45
HTTP_PORT = 8068
56

@@ -166,13 +167,16 @@ watch:
166167
serve:
167168
@echo '=============================================================='
168169
@echo
169-
@echo 'docs server running at http://0.0.0.0:${HTTP_PORT}/_build/html'
170+
@echo 'docs server running at http://0.0.0.0:${HTTP_PORT}/'
170171
@echo
171172
@echo '=============================================================='
172173
@if test ${PYVERSION} -eq 2; then $(MAKE) serve_py2; else make serve_py3; fi
173174

174175
serve_py2:
175-
python -m SimpleHTTPServer ${HTTP_PORT}
176+
pushd _build/html; python2 -m SimpleHTTPServer ${HTTP_PORT}; popd
176177

177178
serve_py3:
178-
python -m http.server ${HTTP_PORT}
179+
python -m http.server ${HTTP_PORT} --directory _build/html
180+
181+
dev:
182+
$(MAKE) -j watch serve
+20-17
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
.. _api:
22

3-
=============
4-
API Reference
5-
=============
3+
# API Reference
64

7-
Creating a repo object
8-
----------------------
5+
## Creating a repo object
96

107
Helper methods are available in ``libvcs.shortcuts`` which
118
can return a repo object from a single entry-point.
129

10+
```eval_rst
1311
.. autofunction:: libvcs.shortcuts.create_repo
1412
1513
.. autofunction:: libvcs.shortcuts.create_repo_from_pip_url
14+
```
1615

17-
Instantiating a repo by hand
18-
----------------------------
16+
## Instantiating a repo by hand
1917

2018
Tools like :func:`libvcs.shortcuts.create_repo` and
2119
:func:`libvcs.shortcuts.create_repo_from_pip_url` are just wrappers
2220
around instantiated these classes.
2321

2422
See examples below of git, mercurial, and subversion.
2523

26-
Git
27-
---
24+
### Git
2825

26+
```eval_rst
2927
.. autoclass:: libvcs.git.GitRepo
3028
:members:
3129
:show-inheritance:
@@ -35,36 +33,41 @@ Git
3533
:show-inheritance:
3634
3735
.. autofunction:: libvcs.git.extract_status
36+
```
3837

39-
Mercurial
40-
---------
38+
### Mercurial
4139

4240
aka ``hg(1)``
4341

42+
```eval_rst
4443
.. autoclass:: libvcs.hg.MercurialRepo
4544
:members:
4645
:show-inheritance:
46+
```
4747

48-
Subversion
49-
----------
48+
### Subversion
5049

5150
aka ``svn(1)``
5251

52+
```eval_rst
5353
.. autoclass:: libvcs.svn.SubversionRepo
5454
:members:
5555
:show-inheritance:
56+
```
5657

57-
Adding your own VCS
58-
-------------------
58+
### Adding your own VCS
5959

6060
Extending libvcs can be done through subclassing ``BaseRepo``.
6161

62+
```eval_rst
6263
.. autoclass:: libvcs.base.BaseRepo
6364
:members:
6465
:show-inheritance:
66+
```
6567

66-
Utility stuff
67-
-------------
68+
### Utility stuff
6869

70+
```eval_rst
6971
.. automodule:: libvcs.util
7072
:members:
73+
```

docs/conf.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
with open("../libvcs/__about__.py") as fp:
1313
exec(fp.read(), about)
1414

15+
import recommonmark
16+
from recommonmark.transform import AutoStructify
17+
1518
extensions = [
1619
'sphinx.ext.autodoc',
1720
'sphinx.ext.intersphinx',
1821
'sphinx.ext.todo',
1922
'sphinx.ext.napoleon',
2023
'alagitpull',
2124
'sphinx_issues',
25+
'recommonmark',
2226
]
2327

2428
releases_unstable_prehistory = True
@@ -30,10 +34,27 @@
3034

3135
templates_path = ['_templates']
3236

33-
source_suffix = '.rst'
37+
source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'}
3438

3539
master_doc = 'index'
3640

41+
# app setup hook
42+
def setup(app):
43+
app.add_config_value(
44+
'recommonmark_config',
45+
{
46+
#'url_resolver': lambda url: github_doc_root + url,
47+
'enable_auto_toc_tree': True,
48+
'auto_toc_tree_section': 'Contents',
49+
'enable_auto_doc_ref': True,
50+
'auto_code_block': True,
51+
'enable_eval_rst': True,
52+
},
53+
True,
54+
)
55+
app.add_transform(AutoStructify)
56+
57+
3758
project = about['__title__']
3859
copyright = about['__copyright__']
3960

docs/developing.rst

-129
This file was deleted.

docs/history.rst

-8
This file was deleted.

docs/index.md

-1
This file was deleted.

0 commit comments

Comments
 (0)