Commit 1ebebe6d authored by Marco Berzborn's avatar Marco Berzborn

Merge branch 'documentationFix'

bugfix for ita_generate documentation
parents c6959952 b5d3b82a
......@@ -15,65 +15,58 @@ function ita_generate_documentation(varargin)
%
% Author: Pascal Dietrich -- Email: pdi@akustik.rwth-aachen.de
% Created: 17-Apr-2009
% Edited: 18-May-2012 Tumbrgel
% Edited: 18-May-2012 Tumbrgel
% pdi not for preferences
sArgs = struct('rootpath',ita_toolbox_path);
sArgs = ita_parse_arguments(sArgs,varargin);
currentDir = pwd;
%generate helpbrowser html files - Tumbrgel 05/2012:
%generate helpbrowser html files - Tumbrgel 05/2012:
ita_generate_helpOverview(sArgs.rootpath);
fullpath = sArgs.rootpath;
cd(fullpath)
disp(fullpath)
cd(sArgs.rootpath)
%% Get folders for m2html
ignoreList = {'.svn','private','tmp','prop-base','props','text-base','template','doc','GuiCallbacks'};
pathStr = genpath(fullpath); %generates folderlist with ';' to seperate folders
prefixToolbox = fliplr(strtok(fliplr(fullpath),filesep)); %get Toolbox folder name
ignoreList = {'.svn','.git','private','tmp','prop-base','props','text-base','template','doc','GuiCallbacks'};
pathStr = genpath(sArgs.rootpath); %generates folderlist with ';' to seperate folders
prefixToolbox = fliplr(strtok(fliplr(sArgs.rootpath),filesep)); %get Toolbox folder name
outpathStr = [];
outpathList = [];
tokenIdx = [0 findstr(pathStr,pathsep)];
if isunix
separator = ':';
else
separator = ';';
end
tokenIdx = [0 strfind(pathStr,pathsep)];
for idx=1:(length(tokenIdx)-1)
tokenCell{idx} = pathStr(tokenIdx(idx)+1:tokenIdx(idx+1)-1); %get single folder name
isIgnore = false;
for ignIdx = 1:length(ignoreList)
foundIdx = findstr(tokenCell{idx},ignoreList{ignIdx}); %folder in ignore list?
foundIdx = strfind(tokenCell{idx},ignoreList{ignIdx}); %folder in ignore list?
isIgnore = ~isempty(foundIdx) || isIgnore;
end
if ~isIgnore %add string token
outpathStr = [outpathStr separator tokenCell{idx}]; %#ok<*AGROW>
idxITA = findstr(tokenCell{idx},prefixToolbox); %pdi
outpathStr = [outpathStr,pathsep,tokenCell{idx}]; %#ok<*AGROW>
idxITA = strfind(tokenCell{idx},prefixToolbox); %pdi
outpathList = [outpathList; {tokenCell{idx}(idxITA:end)}]; %throw away 'C:\...' until ITA-TB path
end
end
% delete old one first
graphInst = ita_preferences('isGraphVizInstalled');
cd(fullpath)
cd ..
if ischar(graphInst), graphInst = str2double(graphInst); end;
%% ignorelist -- doc - guicallbacks - externalpackages
if graphInst
graphState = 'on';
disp('with GraphViz')
disp('Generating with GraphViz')
else
graphState = 'off';
end
docFolder = [fullpath filesep 'HTML' filesep 'doc'];
htmlFolder = fullfile(sArgs.rootpath, 'HTML');
docFolder = fullfile(htmlFolder, 'doc');
% cd required for m2html
cd ..
tic
m2html('mfiles',outpathList, 'htmldir',docFolder, 'recursive','off', 'source','off', 'syntaxHighlighting','on', ...
'global','on', 'globalHypertextLinks','on', 'todo','on', ...
......@@ -81,7 +74,20 @@ m2html('mfiles',outpathList, 'htmldir',docFolder, 'recursive','off', 'source','o
toc
%% Build search database for helpdesk
% switching to basic rendering to fix bug with builddocsearchdb
webutils.htmlrenderer('basic');
% MATLAB requires the html files to be in its search path
addpath(htmlFolder, docFolder);
savepath;
% switching seems to take a while sometimes
pause(1);
if nargin == 0
builddocsearchdb( [fullpath filesep 'HTML' ] ); %generate help search
builddocsearchdb(htmlFolder); %generate help search
rehash toolboxcache
end
% switch back to standard renderer
webutils.htmlrenderer('default');
ita_verbose_info('Please restart MATLAB if the MATLAB ITA Toolbox entry does not show in the documentation browser.',0);
%% Go back to the last working directory
cd(currentDir)
......@@ -26,22 +26,24 @@ function ita_generate_helpOverview(folder)
% 2. open index.html and look for insertion point with ita_openHTML
% 3. looks for avaliable tutorials in Toolbox Folder (tutorials)
% 4. Generate helptoc.xml and index_demo.html->link existing tutorials
%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% 1. ....
oldfolder = cd;
pos = strfind(folder,filesep);
toolboxFolderName = folder(pos(end)+1:end);
oldfolder = pwd;
[~, toolboxFolderName] = fileparts(folder);
templateFolder = fullfile(ita_toolbox_path, 'applications', 'HTMLhelp', 'templates');
htmlFolder = fullfile(folder, 'HTML');
[helpXML_begin, helpXML_end] = ita_openHTML(fullfile(templateFolder, 'template_helptoc.xml'));
[helpXML_begin, helpXML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_helptoc.xml']);
% 2. ....
[index_demoHTML_begin, index_demoHTML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_index_demos.html']);
[index_demoHTML_begin, index_demoHTML_end] = ita_openHTML(fullfile(templateFolder, 'template_index_demos.html'));
% 3. ....
cd(folder);
tutFiles = rdir(['**' filesep 'ita_tutorial*.m']); %search for tutorial files
% 4. ....
helpXML = [helpXML_begin]; %now build a new helptoc.xml
index_demoHTML = [index_demoHTML_begin]; %now build a new index_demo.html
helpXML = helpXML_begin; %now build a new helptoc.xml
index_demoHTML = index_demoHTML_begin; %now build a new index_demo.html
idxApp=1;
appDemo=[];
for idx = 1:length(tutFiles)
......@@ -50,7 +52,9 @@ for idx = 1:length(tutFiles)
continue
end
end
tutFiles(idx).html = publish(tutFiles(idx).name,struct('evalCode',false,'outputDir',[folder filesep 'HTML' filesep 'tutorials']));%finally generate linked HTML File
%finally generate linked HTML File
tutFiles(idx).html = publish(tutFiles(idx).name, struct('evalCode', false, 'outputDir', ...
fullfile(htmlFolder, 'tutorials')));
pos = strfind(tutFiles(idx).html,toolboxFolderName);
tutFiles(idx).html = tutFiles(idx).html(pos(1)+length(toolboxFolderName)+1:end);
tutFiles(idx).html = strrep(tutFiles(idx).html,filesep,'/');%conversion for html
......@@ -75,7 +79,6 @@ for idx = 1:length(tutFiles)
if isempty(app)
% generate new helptoc.xml
fileLocationHTML = strrep(tutFiles(idx).name,filesep,'/');%conversion for html
helpXML = [helpXML,...
' <tocitem target="../',...
tutFiles(idx).html,...
......@@ -83,7 +86,7 @@ for idx = 1:length(tutFiles)
tutFiles(idx).comment,...
'</tocitem>',...
sprintf('\n'),...
];
]; %#ok<AGROW>
% generate new index_demo.html
index_demoHTML = [index_demoHTML,...
' <tr>',...
......@@ -107,23 +110,23 @@ for idx = 1:length(tutFiles)
sprintf('\n'),...
' </tr>',...
sprintf('\n'),...
];
]; %#ok<AGROW>
else
appDemo{idxApp} = tutFiles(idx);
appDemo{idxApp} = tutFiles(idx); %#ok<AGROW>
idxApp = idxApp+1;
end
end
% now put all application demos in helptoc.xml + application_demo.html file:
[app_demoHTML_begin app_demoHTML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_application_demos.html']);
app_demoHTML = [app_demoHTML_begin];
[app_demoHTML_begin, app_demoHTML_end] = ita_openHTML(fullfile(templateFolder, 'template_application_demos.html'));
app_demoHTML = app_demoHTML_begin;
if ~isempty(appDemo)
%XML File:
helpXML = [helpXML,...
' <tocitem target="application_demos.html" image="HelpIcon.EXAMPLES">Application Demos',...
sprintf('\n')];
for idx = 1:length(appDemo)
fileLocationHTML = strrep(appDemo{idx}.name,filesep,'/');
appDemo{idx}.name = appDemo{idx}.name(14:end); %no "/applications/" in front of the name
% no "/applications/" in front of the name
appDemo{idx}.name = appDemo{idx}.name(14:end); %#ok<AGROW>
helpXML = [helpXML,...
' <tocitem target="../',...
appDemo{idx}.html,...
......@@ -131,7 +134,7 @@ if ~isempty(appDemo)
appDemo{idx}.comment,...
'</tocitem>',...
sprintf('\n'),...
];
]; %#ok<AGROW>
%HTML File:
app_demoHTML = [app_demoHTML,...
......@@ -156,16 +159,18 @@ if ~isempty(appDemo)
sprintf('\n'),...
' </tr>',...
sprintf('\n'),...
];
]; %#ok<AGROW>
end
helpXML = [helpXML, ' </tocitem>'];
end
helpXML = [helpXML, helpXML_end]; %put code after insertion point at the end
index_demoHTML = [index_demoHTML, index_demoHTML_end];
app_demoHTML = [app_demoHTML, app_demoHTML_end];
ita_writeHTML([folder filesep 'HTML' filesep 'helptoc.xml'],helpXML) %overwrite old file
ita_writeHTML([folder filesep 'HTML' filesep 'index_demos.html'],index_demoHTML)
ita_writeHTML([folder filesep 'HTML' filesep 'application_demos.html'],app_demoHTML);
ita_writeHTML(fullfile(htmlFolder, 'helptoc.xml'),helpXML); %overwrite old file
ita_writeHTML(fullfile(htmlFolder, 'index_demos.html'),index_demoHTML);
ita_writeHTML(fullfile(htmlFolder, 'application_demos.html'),app_demoHTML);
% copy the info xml file as required since MATLAB R2014b
copyfile(fullfile(templateFolder,'template_info.xml'), fullfile(htmlFolder, 'info.xml'));
%% generate Class/App Documentation in Help Browser
% - Tumbrgel 05/2012
......@@ -188,13 +193,13 @@ for idx = 1:(double('Z')-offset)
fileseps = strfind(currentCharFiles(idxY).name,filesep); %search all '\' to get filenameend
app = strfind(currentCharFiles(idxY).name,'applications'); % sort apps in another list
if isempty(app)
nFileList{idxNfile} = currentCharFiles(idxY).name((fileseps(end)+1):end);
nFileList{idxNfile} = currentCharFiles(idxY).name((fileseps(end)+1):end); %#ok<AGROW>
idxNfile=idxNfile+1;
else
appFileName{idxApp} = currentCharFiles(idxY).name((fileseps(end)+1):end);
appFileName{idxApp} = currentCharFiles(idxY).name((fileseps(end)+1):end); %#ok<AGROW>
appTempName = currentCharFiles(idxY).name(app+length('applications')+1:end);
filesepApp = strfind(appTempName,filesep);
appName{idxApp} = appTempName(1:filesepApp(1)-1);
appName{idxApp} = appTempName(1:filesepApp(1)-1); %#ok<AGROW>
idxApp=idxApp+1;
end
end
......@@ -208,8 +213,8 @@ end
%% 2.
% -> edit classes.html
%get template_classes.html content:
[classesHTML_begin classesHTML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_classes.html']);
classesHTML= [classesHTML_begin];
[classesHTML_begin, classesHTML_end] = ita_openHTML(fullfile(templateFolder, 'template_classes.html'));
classesHTML= classesHTML_begin;
for idx = 1:length(nFileList)
classesHTML = [classesHTML,...
'<a href="matlab:doc ',...
......@@ -218,7 +223,7 @@ for idx = 1:length(nFileList)
nFileList{idx}(1:end-2),...
'</a><br>',...
sprintf('\n')
];
]; %#ok<AGROW>
end
if ~isempty(appName)
classesHTML = [classesHTML '<br><br>The following classes are app-classes<br>' sprintf('\n')];
......@@ -232,7 +237,7 @@ if ~isempty(appName)
appFileName{appIdx(idx)}(1:end-2),...
'</a><br>',...
sprintf('\n')
];
]; %#ok<AGROW>
else %next App headline+file
classesHTML = [classesHTML,...
'<br>',...
......@@ -244,7 +249,7 @@ if ~isempty(appName)
appFileName{appIdx(idx)}(1:end-2),...
'</a><br>',...
sprintf('\n')
];
]; %#ok<AGROW>
end
else %first App headline+file
classesHTML = [classesHTML,...
......@@ -257,17 +262,17 @@ if ~isempty(appName)
appFileName{appIdx(idx)}(1:end-2),...
'</a><br>',...
sprintf('\n')
];
]; %#ok<AGROW>
end
end
end
classesHTML=[classesHTML, '<br>', sprintf('\n'), classesHTML_end];
%write edited file
ita_writeHTML([folder filesep 'HTML' filesep 'classes.html'],classesHTML)
ita_writeHTML(fullfile(htmlFolder, 'classes.html'), classesHTML);
% -> edit apps.html
[appsHTML_begin appsHTML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_apps.html']);
appsHTML= [appsHTML_begin];
[appsHTML_begin, appsHTML_end] = ita_openHTML(fullfile(templateFolder, 'template_apps.html'));
appsHTML= appsHTML_begin;
%%%%%%%%%%%%%%%%%%%
appfolder = rdir([folder filesep '**' filesep 'ita_apps.m']);
if isempty(appfolder)
......@@ -309,17 +314,17 @@ else
'<td width="100"><a href="file:///', appDocumentationFile,'">', appname, '</a></td>', sprintf('\n'),...
'<td>', data, sprintf('\n'),...
'</td>',sprintf('\n'),...
'</tr>', sprintf('\n')];
'</tr>', sprintf('\n')]; %#ok<AGROW>
end
appsHTML = [appsHTML '</table>' appsHTML_end];
end
%write edited file
ita_writeHTML([folder filesep 'HTML' filesep 'apps.html'],appsHTML)
ita_writeHTML(fullfile(htmlFolder, 'apps.html'), appsHTML);
%% Generate Kernel Documentation
[kernelHTML_begin kernelHTML_end] = ita_openHTML([ita_toolbox_path filesep 'applications' filesep 'HTMLhelp' filesep 'templates' filesep 'template_kernel.html']);
kernelHTML= [kernelHTML_begin];
[kernelHTML_begin, kernelHTML_end] = ita_openHTML(fullfile(templateFolder, 'template_kernel.html'));
kernelHTML= kernelHTML_begin;
kernelList = rdir([folder filesep 'kernel' filesep '**' filesep 'KernelDescription.txt']);
kernelHTML = [kernelHTML '<table border="2">' sprintf('\n')];
......@@ -328,9 +333,9 @@ for idx = 1:numel(kernelList)
% get Kernelfoldername
kernelDescriptionPath = kernelList(idx).name;
pos = strfind(kernelDescriptionPath,'kernel');
kernelName{idx} = kernelDescriptionPath(pos(1)+7:end);
kernelName{idx} = kernelDescriptionPath(pos(1)+7:end); %#ok<AGROW>
pos = strfind(kernelName{idx},'KernelDescription.txt');
kernelName{idx} = kernelName{idx}(1:pos(1)-2);
kernelName{idx} = kernelName{idx}(1:pos(1)-2); %#ok<AGROW>
%get m2html documentation fileposition:
pos = strfind(kernelDescriptionPath,'kernel');
......@@ -362,11 +367,10 @@ for idx = 1:numel(kernelList)
'<td width="100"><a href="file:///', kernelDocumentationFile,'">', kernelName{idx}, '</a></td>', sprintf('\n'),...
'<td>', data, sprintf('\n'),...
'</td>',sprintf('\n'),...
'</tr>', sprintf('\n')];
'</tr>', sprintf('\n')]; %#ok<AGROW>
end
kernelHTML = [kernelHTML '</table>' kernelHTML_end];
ita_writeHTML([folder filesep 'HTML' filesep 'kernel.html'],kernelHTML)
ita_writeHTML(fullfile(htmlFolder, 'kernel.html'), kernelHTML);
cd(oldfolder);
disp('****** PLEASE RESTART MATLAB TO GET AN ENTRY "RWTH ITA TOOLBOX" IN YOUR MATLAB HELP BROWSER ******')
end
\ No newline at end of file
end
<productinfo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="optional">
<?xml-stylesheet type="text/xsl" href="optional"?>
<matlabrelease>R14</matlabrelease>
<name>RWTH ITA</name>
<type>toolbox</type>
<icon>../pics/ITA16x16.gif</icon>
<help_location>./</help_location>
<list>
<listitem>
<label>ITA-Toolbox Setup</label>
<callback>ita_toolbox_setup</callback>
<icon>$toolbox/matlab/icons/greencircleicon.gif</icon>
</listitem>
<listitem>
<label>Overview in Helpbrowser</label>
<callback>web index.html -helpbrowser</callback>
<icon>$toolbox/matlab/icons/book_mat.gif</icon>
</listitem>
<listitem>
<label>Getting Started (PDF)</label>
<callback>open('ITA_Toolbox_Getting_Started.pdf');</callback>
<icon>$toolbox/matlab/icons/pdficon.gif</icon>
</listitem>
<listitem>
<label>Web Site (ITA - RWTH Aachen)</label>
<callback>web http://www.akustik.rwth-aachen.de -browser;</callback>
<icon>$docroot/techdoc/matlab_env/examples/webicon.gif</icon>
</listitem>
<listitem>
<label>ITA-Toolbox Website</label>
<callback>web http://www.ita-toolbox.org -browser;</callback>
<icon>$docroot/techdoc/matlab_env/examples/webicon.gif</icon>
</listitem>
</list>
</productinfo>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment