Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pspm document generation functions for new website #823

Merged
merged 6 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/pspm_doc.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
M = [];
% 3.1 Add title
Title = pspm_doc_get_title(func_name);
M = [M, '# ', Title, newline];
M = [M, '---', newline];
M = [M, 'layout: post', newline];
M = [M, 'title: ', func_name, newline];
M = [M, 'permalink: /ref/', func_name, newline];
M = [M, '---', newline];
M = [M, ' ', newline];
M = [M, '[Back to index](/PsPM/ref/)', newline];
% 3.2 Add description
if isfield(S, 'Description')
Expand Down Expand Up @@ -52,10 +57,15 @@
end
M = [M, '[Back to index](/PsPM/ref/)', newline];
%% 4 Write to file
if isfield(options, 'post') && options.post == 1
PrefTitle = ['2024-01-01-',Title];
else
PrefTitle = Title;
end
if isfield(options, 'path')
writelines(M, [options.path, '/', Title,'.md']);
writelines(M, [options.path, '/', PrefTitle,'.md']);
else
writelines(M, [Title,'.md']);
writelines(M, [PrefTitle,'.md']);
end
sts = 1;
end
Expand Down Expand Up @@ -125,6 +135,7 @@
Y = [Y, newline];
end
end
Y = [Y, newline];
end
end
end
Expand Down
1 change: 1 addition & 0 deletions src/pspm_doc_gen.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
for i_func = 1:length(list_func)
options = struct();
options.path = savepath;
options.post = 1;
disp(list_func{i_func});
sts_temp = pspm_doc(list_func{i_func}, options);
if sts_temp == -1
Expand Down
2 changes: 1 addition & 1 deletion test/pspm_doc_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function valid_input(this)
end
this.verifyEqual(pspm_doc_gen(this.list_func), 1);
for i = 1:length(this.list_func)
this.verifyEqual(isfile(['src/ref/',this.list_func{i},'.md']), true);
this.verifyEqual(isfile(['src/ref/2024-01-01-',this.list_func{i},'.md']), true);
end
rmdir('src/ref', 's');
end
Expand Down