generate_html_file - create man page for scilab html browser
generate_html_file(lisf,flag,lang)
- lisf : string. a name of a man page
- flag : string. set the type of man page
- 'block' : for interfacing function of scicos block
- 'pal' : for a palette (.cosf file)
- 'diagr' : for a scicos diagram (.cos file)
- 'scilib' : for a library of scilab macros
- 'sci' : for a scilab macro.
- 'rout' : for computational routine
- 'sim' : for scilab simulation script (_sim.sce file)
- 'sce' : for scilab script (.sce file)
- lang : string. set the lang of tex file
- 'eng' : to produce english man page
- 'fr' : to produce french man page
//generate_html_file
//Entrée : lisf est une liste de nom de fichier sans extension: CAN_f, Linear ou synthe
// flag est un drapeau(pour l'instant de taille 1):
// 'block' pour une fonction d'interface scicos
// 'pal' pour un fichier palette scicos (cosf)
// 'diagr' pour un diagramme de simulation scicos
// 'scilib' pour une librairie de fonctions scilab
// 'sci' pour une fonction scilab.
// 'rout' pour une routines bas niveau
// 'sim' pour un script de simulation scilab
// 'sce' pour un script scilab
// DOIT RAJOUTER lang
function generate_html_file(lisf,flag,lang)
//verify the 'lang' right parameter
[lsh,rsh]=argn(0)
if rsh<3 then
if ~exists('lang') then
lang='eng'
elseif lang<>'eng' & lang<>'fr' then
lang='eng'
end
end
select flag
case 'block'
ext=''
func=generate_blocks_tex_file
case 'pal'
ext='_cosf'
func=generate_pals_tex_file
case 'diagr'
ext='_cos'
func=generate_diagr_tex_file
case 'scilib'
ext='_scilib'
func=generate_scilib_tex_file
case 'sci'
ext='_sci'
func=generate_scifun_tex_file
case 'rout'
ext='_rout'
func=generate_rout_tex_file
case 'sim'
ext=''
func=generate_sim_tex_file
case 'sce'
ext='_sce'
func=generate_sce_tex_file
else
printf("Try with flag ''block'',''pal'',...
''diagr'',''scilib'',''sci'',''rout'',''sim''\n")
abort
end
rep=lisf+ext
for i=1:size(lisf,1)
//generate main tex file DOIT RAJOUTER lang
func(lisf(i,1),'html',lang);
chdir(rep(i,1));
//analyse tex files
analyse_tex_file('.');
flg_bib=%f;
//run LaTeX
if fileinfo(lisf(i,1)+'_bib.tex')<>[] then //bibliography
printf("Bibliography file found. Run latex...")
unix_g(latex_cmd+lisf(i,1)+'.tex');
printf("Done\n")
flg_bib=%t; //flag bib
end
//conversion latex2html
printf("Convert %s.tex file in %s.html... ",lisf(i,1),lisf(i,1));
unix_g(latex2html_cmd+lisf(i,1)+'_ '+lisf(i,1));
printf("Done\n");
//change color subtitle
html_txt=change_color_subtitle('./'+lisf(i,1)+'/'+lisf(i,1)+'.htm','blue');
if html_txt<>[] then mputl(html_txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm'); end;
//change font
html_txt=change_font('./'+lisf(i,1)+'/'+lisf(i,1)+'.htm',flag);
if html_txt<>[] then mputl(html_txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm'); end;
//change bibliography level
if flg_bib then
html_txt=change_level_bib('./'+lisf(i,1)+'/'+lisf(i,1)+'.htm');
end
if html_txt<>[] then mputl(html_txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm'); end;
//change 'Contents' and 'Bibliography' line
if lang<>'eng' then
html_txt=change_contents_line('./'+lisf(i,1)+'/'+lisf(i,1)+'.htm',lang);
end
if html_txt<>[] then mputl(html_txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm'); end;
if lang<>'eng' then
html_txt=change_biblio_line('./'+lisf(i,1)+'/'+lisf(i,1)+'.htm',lang);
end
if html_txt<>[] then mputl(html_txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm'); end;
tt=listfiles("./"+lisf(i,1)+"/");
htm_f=%f;gif_f=%f;
for j=1:size(tt,1)
if strindex(tt(j),'.htm')<>[] then htm_f=%t, end;
if strindex(tt(j),'.gif')<>[] then gif_f=%t, end;
end
//move htm files
if htm_f then
//unix_g(mv_cmd+'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm ../htm')
unix_g(mv_cmd+'./'+lisf(i,1)+'/'+lisf(i,1)+'.htm '+html_path+lang+'/')
end
//move gif files
if gif_f then
//unix_g(mv_cmd+'./'+lisf(i,1)+'/*.gif ../htm');
unix_g(mv_cmd+'./'+lisf(i,1)+'/*.gif '+html_path+lang+'/')
end
//clean temporary files
chdir('..')
unix_g(rm_cmd+rep(i,1))
end
endfunction
IRCOM Group
Alan Layec