1 ## Copyright (C) 2008 Bill Denney
3 ## This software is free software; you can redistribute it and/or modify it
4 ## under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 3 of the License, or (at
6 ## your option) any later version.
8 ## This software is distributed in the hope that it will be useful, but
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this software; see the file COPYING. If not, see
15 ## <http://www.gnu.org/licenses/>.
18 ## @deftypefn {Function File} {} __missingmatlab2txt__ (@var{funlist}, @var{funloc}, @var{funstat}, @var{catlist}, @var{catloc}, @var{catlvl}, @var{outformat})
19 ## Convert the function and category information into text. The
20 ## @var{outformat} can be one of "wiki" or "html".
23 function output = __missingmatlab2txt__ (funlist, funloc, funstat, catlist, catloc, catlvl, outformat = "wiki")
25 ## this will be to keep track of what we are currently looking at,
26 ## functions will be considered at category level 99.
28 statstr = {"Not Checked" "Missing" "Present"};
30 allloc = [catloc(:);funloc(:)];
31 [alloc, sidx] = sort (allloc);
32 allname = [catlist(:);funlist(:)](sidx);
33 allstat = [zeros(numel(catlist), 1);funstat(:)](sidx);
34 alllvl = [catlvl(:);funlvl*ones(numel(funlist), 1)](sidx);
36 switch lower (outformat)
38 output = __towiki__ (alllvl, allname, allstat, funlvl, statstr);
40 output = __tohtml__ (alllvl, allname, allstat, funlvl, statstr);
42 error ("missingmatlab2txt: invalid outformat (%s)", outformat);
47 function output = __towiki__ (alllvl, allname, allstat, funlvl, statstr)
49 output = cell (size (allname));
50 for i = 1:numel (alllvl)
51 if (alllvl(i) == funlvl)
52 output{i} = sprintf ("||%s||%s||\n", allname{i}, statstr{allstat(i)+2});
54 hstring = char ("="*ones (1, alllvl(i)));
55 output{i} = sprintf ("\n%s%s%s\n", hstring, allname{i}, hstring)
61 function output = __tohtml__ (alllvl, allname, allstat, funlvl, statstr)
63 output = cell (size (allname));
65 lastwasfun = false ();
67 output{idx} = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>Matlab Functions Missing from Octave</title><link rel=\"stylesheet\" type=\"text/css\" href=\"missingmatlab.css\"/></head><body>\n";
69 for i = 1:numel (alllvl)
70 if (alllvl(i) == funlvl)
72 output{++idx} = "<table>\n";
75 thisclass = statstr{allstat(i)+2};
76 thisclass(isspace (thisclass)) = [];
77 output{++idx} = sprintf ("<tr class=\"%s\"><td class=\"funname\">%s</td><td class=\"funstatus\">%s</td></tr>\n",
78 thisclass, allname{i}, statstr{allstat(i)+2});
82 output{++idx} = "</table>\n";
84 hstring = sprintf ("h%d", alllvl(i));
85 output{++idx} = sprintf ("\n<%s>%s</%s>\n", hstring, allname{i}, hstring);
86 lastwasfun = false ();
91 output{++idx} = "</table>\n";
93 output{++idx} = "</body></html>";