Closed jcohenadad closed 4 years ago
Working prototype on b6f246a2c240cda3a3c53c5faead92256fbe0af4
To build Matlab doc:
FileList = genToolboxHelp('/Users/julien/code/shimming-toolbox', 'shimming-toolbox', {'Ui', 'tests', 'misc', 'Img', 'external', 'example', 'docs', 'doc', 'Coils', 'aux_hardware'}, true, false)
Produces:
Adding a Contents.m file within each folder enables to do this:
>> help imutils
Files
dicom_to_nifti -
get_nii_coordinates -
load_niftis -
read_nii - Load NIfTI image and header; and, when present, the accompanying .json sidecar
On the other hand, if the Contents.m file is not present in the folder, then it recognizes it as a package, and the help is much nicer:
>> help imutils
Contents of imutils package:
dicom_to_nifti - converts dicoms into niftis with dcm2bids output
get_nii_coordinates - Return voxel position "world-coordinates" in mm
load_niftis - Load a nifti acquisition from dcm2bids
read_nii - Load NIfTI image, header, and (if present) the accompanying .json sidecar
so, we should not have Contents.m files for packages.
EDIT: this mush be a new Matlab feature, but even without Contents.m file for non-packages, it does list all the files. So let's get rid of this Contents.m file.
Ready to be tested:
startup
FileList = genToolboxHelp('/Users/julien/code/shimming-toolbox', 'shimming-toolbox', {'doc', 'docs'}, false, true)
doc
The Documentation windows pops-up, go at the bottom and click on "shimming-toolbox Toolbox". You should see this:
I followed the procedure and had the problem with builddocsearchdb
when running genToolboxHelp
. I had to run restart Matlab and run genToolboxHelp
again to fix the problem.
We probably want to create a template on how to create new functions so that both the website and the matlab documentation look good.
Every header page shows a page not found :
We probably want to create a template on how to create new functions so that both the website and the matlab documentation look good.
yup! this is the purpose of https://github.com/shimming-toolbox/shimming-toolbox/issues/133. Out of the scope of this PR. Once merged, we can work on this issue.
Every header page shows a page not found :
yup! i'll find a fix to it before merging.
I followed the procedure and had the problem with builddocsearchdb when running genToolboxHelp. I had to run restart Matlab and run genToolboxHelp again to fix the problem.
🤔 mmh that's annoying. if you could find a better fix to it that would be awesome
EDIT: this mush be a new Matlab feature, but even without Contents.m file for non-packages, it does list all the files. So let's get rid of this Contents.m file.
Actually it's an old feature that, indeed, doesn't seem completely worked out: It's nice that it prints the contents automatically without the Contents.m file, but it seems to me having a package overview is sensible, and since help package_name
displays Contents.m, this seems like the place to put it? E.g. for all the shim material I had started this WIP for issue #75
Actually it's an old feature that, indeed, doesn't seem completely worked out: It's nice that it prints the contents automatically without the Contents.m file, but it seems to me having a package overview is sensible, and since help package_name displays Contents.m, this seems like the place to put it? E.g. for all the shim material I had started this WIP for issue #75
funny you are writing this now, as I am just realizing that the issue described here is caused by a missing Contents.m file 😬. So I am currently creating one per folder, with brief description about the purpose of each folder/package.
for all the shim material I had started this WIP for issue #75
Awesome!
Missing page issue fixed in c240021e064aa64413e7787cd5940ebdb30a78e5. Output looks like this:
I suggest to indicate with (package) when a folder is a package.
even better:
Missing page issue fixed in c240021.
The missing page issue is also for all the other headers, not only +imutils as shown for the "coils" section here :
https://github.com/shimming-toolbox/shimming-toolbox/pull/134#issuecomment-646799509
Missing page issue fixed in c240021.
The missing page issue is also for all the other headers, not only +imutils as shown for the "coils" section here :
yes, i was just looking for a proper solution for imutils, which can then be applied to the other folders. At this point, given the large refactoring ahead, i suggest we don't spend time populating entries that will disappear in the short term (e.g. Coil will be replaced by +coil, etc.). The purpose here is to settle on a set of conventions, that will then be applied to the code at large (in subsequent PRs).
Current problem is building the doc the first time throws an error with
builddocsearchdb
will open an issue for it.
https://github.com/shimming-toolbox/shimming-toolbox/issues/144
Context
This PR adds the necessary files to generate a Matlab documentation, within Matlab's browser. The various pros are:
This PR will be the foundation for establishing docstrings conventions: https://github.com/shimming-toolbox/shimming-toolbox/issues/133
Things to figure out
helpdoc.xml
file (which includes all entries of the doc). Possibly helpful:Contents.m
: not needed (see discussion below).Tips & tricks
Formatting Matlabs's markup
https://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html
Publish Live scripts as html
The function
publish
converts .m files to html. However, this does not work for Live script .mlx files. The solution is to use:builddocsearchdb: Could not write search database
if running into the following error:
The solution is to remove the path to the
info.xml
file and add it again. Matlab will then parse it.builddocsearchdb: There is no installed product with this help location
Solution: the path to the output doc/, included in the info.xml file, should be relative. Any change to the info.xml file should be followed by an rmpath/addpath to refresh the parsing of the info.xml file (or , restart Matlab).
Publish for package files
Example for
+imutils/
package, command is: