Skip to content

Commit

Permalink
docs: Generate ref API index.rst from scratch
Browse files Browse the repository at this point in the history
Signed-off-by: RibhuDP <[email protected]>
  • Loading branch information
ribdp committed Apr 3, 2024
1 parent 2ccf945 commit ec4f89e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/source/reference_api/gen_sysobj_doc.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[filepath,name,ext] = fileparts(mfilename('fullpath'));
cd(filepath);
%cd('..');

mfiledir = fullfile('adi');

Expand Down Expand Up @@ -110,13 +109,36 @@
rstFiles = [rstFiles, convertCharsToStrings([' ' part '_' trx_file '.rst'])];
end

end

%% Overwrite any existing index.rst file
if isfile('index_template.tmpl')
template = [];
fileID = fopen('index_template.tmpl','r');
current_line = convertCharsToStrings(fgetl(fileID));

while isstring(current_line)
template = [template, current_line];
current_line = convertCharsToStrings(fgetl(fileID));
end
fclose(fileID);

disp(length(template))
fileID = fopen('index.rst','wt');
for i = 1:length(template)
fprintf(fileID, template(i));
fprintf(fileID, '\n');
end

fclose(fileID);

end

%% Add toctree to the reference api index.rst file using the rstFiles
fileID = fopen('index.rst','a+');
fprintf(fileID, '\n');
for i = 1:length(rstFiles)
fprintf(fileID, '\n');
fprintf(fileID, "%s", rstFiles(i));
fprintf(fileID, '\n');
end
fclose(fileID);
6 changes: 6 additions & 0 deletions docs/source/reference_api/index_template.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Reference APIs
--------------

.. toctree::
:maxdepth: 1
:caption: Driver Classes:

0 comments on commit ec4f89e

Please sign in to comment.