diff --git a/applications/HTMLhelp/ita_generate_documentation.m b/applications/HTMLhelp/ita_generate_documentation.m index 0e13abcd6ed58ec390625c51b5d19ea1d9731d37..4547013024c14fbc1eccadfd8605de6d7dd7efe3 100644 --- a/applications/HTMLhelp/ita_generate_documentation.m +++ b/applications/HTMLhelp/ita_generate_documentation.m @@ -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 Tumbrägel +% Edited: 18-May-2012 Tumbr�gel % pdi not for preferences sArgs = struct('rootpath',ita_toolbox_path); sArgs = ita_parse_arguments(sArgs,varargin); +currentDir = pwd; -%generate helpbrowser html files - Tumbrägel 05/2012: +%generate helpbrowser html files - Tumbr�gel 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) diff --git a/applications/HTMLhelp/ita_generate_helpOverview.m b/applications/HTMLhelp/ita_generate_helpOverview.m index 9278b443f26ad292be397f2f34c88fa67cedd378..f950270ac1f3a7d120ef5cef9afe7ccc1b322592 100644 --- a/applications/HTMLhelp/ita_generate_helpOverview.m +++ b/applications/HTMLhelp/ita_generate_helpOverview.m @@ -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,... ' 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 helpXML = [helpXML,... '
',... sprintf('\n') - ]; + ]; %#ok end if ~isempty(appName) classesHTML = [classesHTML '

The following classes are app-classes
' sprintf('\n')]; @@ -232,7 +237,7 @@ if ~isempty(appName) appFileName{appIdx(idx)}(1:end-2),... '
',... sprintf('\n') - ]; + ]; %#ok else %next App headline+file classesHTML = [classesHTML,... '
',... @@ -244,7 +249,7 @@ if ~isempty(appName) appFileName{appIdx(idx)}(1:end-2),... '
',... sprintf('\n') - ]; + ]; %#ok end else %first App headline+file classesHTML = [classesHTML,... @@ -257,17 +262,17 @@ if ~isempty(appName) appFileName{appIdx(idx)}(1:end-2),... '
',... sprintf('\n') - ]; + ]; %#ok end end end classesHTML=[classesHTML, '
', 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 '', appname, '', sprintf('\n'),... '', data, sprintf('\n'),... '',sprintf('\n'),... - '', sprintf('\n')]; + '', sprintf('\n')]; %#ok end appsHTML = [appsHTML '' 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 '' 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 pos = strfind(kernelName{idx},'KernelDescription.txt'); - kernelName{idx} = kernelName{idx}(1:pos(1)-2); + kernelName{idx} = kernelName{idx}(1:pos(1)-2); %#ok %get m2html documentation fileposition: pos = strfind(kernelDescriptionPath,'kernel'); @@ -362,11 +367,10 @@ for idx = 1:numel(kernelList) '', sprintf('\n'),... '',sprintf('\n'),... - '', sprintf('\n')]; + '', sprintf('\n')]; %#ok end kernelHTML = [kernelHTML '
', kernelName{idx}, '', data, sprintf('\n'),... '
' 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 diff --git a/applications/HTMLhelp/templates/template_info.xml b/applications/HTMLhelp/templates/template_info.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a10d88ef84210cab23b8fd3a177b29fae368a23 --- /dev/null +++ b/applications/HTMLhelp/templates/template_info.xml @@ -0,0 +1,46 @@ + + + + R14 + RWTH ITA + toolbox + ../pics/ITA16x16.gif + + ./ + + + + + + ita_toolbox_setup + $toolbox/matlab/icons/greencircleicon.gif + + + + + web index.html -helpbrowser + $toolbox/matlab/icons/book_mat.gif + + + + + open('ITA_Toolbox_Getting_Started.pdf'); + $toolbox/matlab/icons/pdficon.gif + + + + + web http://www.akustik.rwth-aachen.de -browser; + $docroot/techdoc/matlab_env/examples/webicon.gif + + + + web http://www.ita-toolbox.org -browser; + $docroot/techdoc/matlab_env/examples/webicon.gif + + + + +