forked from OHBA-analysis/osl-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosl_publish.m
39 lines (33 loc) · 1.58 KB
/
osl_publish.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function osl_publish(filename,evalCode,stylesheet,maxOutputLines)
% Make an HTML page on the OSL website
%
% INPUTS
% - filename - name of the file being published
% - evalCode - run the code and save code output and figures (default=true)
% - stylesheet - specify which formatting to apply (default=github pages formatting, set to '' for default matlab formatting)
%
% OUTPUT - output html will be written in osl2/docs/matlab
%
% To complete publishing, add files via Git and push to GitHub
%
% PUBLISHING WORKFLOW
% 1. After writing your script, use osl_publish('myscript',false,'') to do an initial test of the formatting
% 2. Then, use osl_publish('myscript',true,'') to check the figures are correct
% 3. Finally, use osl_publish('myscript') to generate the github-pages ready files
% 4. Add the new files in the docs folder, commit, and push, to publish them online
%
%
% Romesh Abeysuriya 2017
if nargin < 4 || isempty(maxOutputLines)
maxOutputLines=Inf;
end
if nargin < 3 || isempty(stylesheet)
stylesheet = fullfile(osldir,'osl-docs','mxdom2simplehtml_jekyll.xsl');
end
if nargin < 2 || isempty(evalCode)
evalCode = true;
end
output_html = publish(filename,'evalCode',evalCode,'stylesheet',stylesheet,'format','html','outputDir',fullfile(osldir,'osl-docs','matlab'),'maxOutputLines',maxOutputLines);
% To check locally, with standard MATLAB html formatting
% output_html = publish(filename,'evalCode',evalCode,'format','html','outputDir',fullfile(osldir,'osl-core','docs','matlab'),'maxOutputLines',maxOutputLines);
runcmd('open %s',output_html)