-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_matlab_doc.m
42 lines (35 loc) · 1.13 KB
/
make_matlab_doc.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
40
41
42
function make_matlab_doc(mfile,outDir)
try
if nargin<2
outDir='html/';
end
[filePath,baseName,~] = fileparts(mfile);
evalCode = isempty(strfind(filePath,'@')) && isempty(strfind(filePath,'+'));
if evalCode
addpath(filePath);
end
publish(mfile,'evalCode',evalCode,'showCode',true,'outputDir',outDir);
%% Fix some things to play nicer with doxygen html formatting
%continue
htmlFile = [outDir '/' baseName '.html'];
fid=fopen(htmlFile,'r');
s=fread(fid,'*char').';
fclose(fid);
s=regexprep(s,'html,body,div,span','html,body,div.content,span');
s=regexprep(s,'table th {','table.content th {');
s=regexprep(s,'table td {','table.content td {');
%s=regexprep(s,'pre, tt, code {','pre, code {');
fid=fopen(htmlFile,'w');
fwrite(fid,s);
%% Remove timestamp from images
f=dir([outDir '/' baseName '*.png']);
for i=1:length(f)
I=imread([outDir '/' f(i).name]);
imwrite(I,[outDir '/' f(i).name],'ImageModTime',1);
end
catch e
disp(e)
fprintf('Error detected. Exiting MATLAB...\n');
% exit();
end
end