Skip to content

Commit b52733c

Browse files
committed
re build sphinx doc
1 parent 83461e4 commit b52733c

19 files changed

+919
-442
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
# exclude content of logfiles folders
77
*.tsv
88
*.mat
9-
check_my_code_report.txt
9+
check_my_code_report.txt
10+
11+
# ignore file created by sphynx
12+
/docs/build

docs/.readthedocs.yml0

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/.readthedocs.yml1

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/.readthedocs.yml2

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/.readthedocs.yml3

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,116 @@ sphinx-quickstart # launch a basic interactive set up of sphinx
2424
```
2525

2626
Answer the questions on prompt.
27+
28+
## Setting up conf.py for matlab doc
29+
30+
Following the documentation from
31+
[matlabdomain for sphinx](https://github.com/sphinx-contrib/matlabdomain).
32+
33+
Specify the extensions you are using:
34+
35+
```python
36+
extensions = [
37+
'sphinxcontrib.matlab',
38+
'sphinx.ext.autodoc']
39+
```
40+
41+
`matlab_src_dir` in `docs/source/conf.py` should have the path (relative to `conf.py`)
42+
to the folder containing your matlab code:
43+
44+
```python
45+
matlab_src_dir = os.path.dirname(os.path.abspath('../../src'))
46+
```
47+
48+
## reStructured text markup
49+
50+
reStructured text mark up
51+
[primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html).
52+
53+
## "Templates"
54+
55+
There are different ways you can document the help section of your matlab
56+
functions so it can be documented automatically by sphinx.
57+
58+
```matlab
59+
function y = my_function(arg1, arg2)
60+
%
61+
% Describe what the function does here.
62+
%
63+
% y = my_function_napoleon(arg1, arg2)
64+
%
65+
% :param arg1: The first input value
66+
% :param arg2: The second input value
67+
% :returns: The input value multiplied by two
68+
69+
y = arg1 + arg2
70+
```
71+
72+
"Napoleon" way more similar to Numpy:
73+
74+
```matlab
75+
function y = my_function_napoleon(arg1, arg2)
76+
%
77+
% Describe what the function does here.
78+
%
79+
% y = my_function_napoleon(arg1, arg2)
80+
%
81+
% Parameters:
82+
% x: The first input value
83+
%
84+
% y: The second input value
85+
%
86+
% Returns:
87+
% The input value multiplied by two
88+
89+
y = x * 2;
90+
```
91+
92+
You then just need to insert this in your `.rst` file for the documentation to
93+
be done automatically.
94+
95+
```rst
96+
97+
.. automodule:: src .. <-- This is necessary for autodocumenting the rest
98+
99+
.. autofunction:: my_function
100+
101+
.. autofunction:: my_function_napoleon
102+
```
103+
104+
## Build the documentation locally
105+
106+
From the `docs` directory:
107+
108+
```bash
109+
sphinx-build -b html source build
110+
```
111+
112+
This will build an html version of the doc in the `build` folder.
113+
114+
## Buid the documentation with Read the Docs
115+
116+
Add a [`.readthedocs.yml`](../.readthedocs.yml) file in the root of your repo.
117+
118+
See [HERE](https://docs.readthedocs.io/en/stable/config-file/v2.html) for
119+
details.
120+
121+
You can then trigger the build of the doc by going to the [read the docs]
122+
website: https://readthedocs.org.
123+
124+
You might need to be added as a maintainer of the doc.
125+
126+
The doc can be built from any branch of a repo.
127+
128+
<!-- TODO -->
129+
130+
## Other matlab projects that use...
131+
132+
### Sphinx
133+
134+
Some are listed
135+
https://github.com/sphinx-contrib/matlabdomain#users
136+
137+
### Read the docs
138+
139+
- [qMRLab](https://github.com/qMRLab/qMRLab/wiki/Guideline:-Generating-Documentation)

docs/build/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 7b5b1a5e051521c21de157c4bf2ecab6
3+
config: 10fab318711bbc6c9d19f0bcaabfa2e5
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
1.05 KB
Binary file not shown.
-486 Bytes
Binary file not shown.

docs/build/.doctrees/index.doctree

368 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)