Skip to content

Commit

Permalink
Merge pull request #823 from bachlab/update_pspm_doc
Browse files Browse the repository at this point in the history
Update pspm document generation functions for new website
  • Loading branch information
dominikbach authored Feb 1, 2025
2 parents 798b7b2 + fbdd691 commit d831fa3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
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
2 changes: 2 additions & 0 deletions src/pspm_doc_gen.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'pspm_convert_hb2hp', ...
'pspm_convert_ppg2hb', ...
'pspm_emg_pp', ...
'pspm_expand_epochs', ...
'pspm_find_sounds', ...
'pspm_find_valid_fixations', ...
'pspm_gaze_pp', ...
Expand All @@ -72,6 +73,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 src/pspm_expand_epochs.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% [sts, output_file] = pspm_expand_epochs(epochs_fn, expansion, options)
% [sts, expanded_epochs] = pspm_expand_epochs(epochs, expansion, options)
% [sts, channel_index] = pspm_expand_epochs(data_fn, channel, expansion , options)
% ● Arguments
% ● Arguments
% * epochs_fn: An epochs file as defined in pspm_get_timing.
% * epochs: A 2-column matrix with epochs onsets and offsets in seconds.
% * data_fn: A PsPM data file.
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

0 comments on commit d831fa3

Please sign in to comment.