-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildfile.m
More file actions
46 lines (34 loc) · 1.22 KB
/
buildfile.m
File metadata and controls
46 lines (34 loc) · 1.22 KB
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
43
44
45
46
function plan = buildfile()
%BUILDFILE Build plan for the Term Premium Modelling project.
% Build plan
plan = buildplan( localfunctions() );
plan.DefaultTasks = "export";
% List Live Script files for conversion
liveScript = fullfile( plan.RootFolder, "TermPremiumModelling.mlx" );
% Set task inputs
plan("md").Inputs = liveScript;
% Set task dependencies
plan("export").Dependencies = "md";
end % buildfile
function mdTask( context )
% Generate Markdown files from the MATLAB Live Scripts.
liveScripts = context.Task.Inputs;
for scriptIdx = 1 : numel( liveScripts )
currentLiveScript = liveScripts(scriptIdx).Path;
[currentPath, currentFilename] = fileparts( currentLiveScript );
exportFile = fullfile( currentPath, currentFilename + ".md" );
export( currentLiveScript, exportFile, ...
"Format", "markdown", ...
"IncludeOutputs", true, ...
"Run", false, ...
"AcceptHTML", true, ...
"RenderLateXOnline", "svg" );
fprintf( "[+] %s\n", exportFile )
end % for
end % mdTask
function exportTask( ~ )
% Export the project.
prj = currentProject();
mlproj = fullfile( prj.RootFolder, "ACM.mlproj" );
prj.export( mlproj )
end % exportTask