comparison m-toolbox/classes/@minfo/tohtml.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % TOHTML convert an minfo object to an html document
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: TOHTML convert an minfo object to an html document
5 %
6 % VERSION: $Id: tohtml.m,v 1.19 2011/08/24 06:06:04 hewitson Exp $
7 %
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
10 function varargout = tohtml(varargin)
11
12 % Get minfo objects
13 objs = utils.helper.collect_objects(varargin(:), 'minfo');
14
15 if numel(objs) > 1
16 error('### Only works for one info object');
17 end
18
19 txts = html(objs(1));
20
21 % display the objects
22 if nargout > 0
23 varargout{1} = txts;
24 elseif nargout == 0;
25 disp(txts);
26 end
27 end
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 % Local Functions %
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32
33 function txt = html(ii)
34
35 helpPath = utils.helper.getHelpPath();
36 docStyleFile = ['file://' helpPath '/ug/docstyle.css'];
37 prefArrowFile = ['file://' helpPath '/ug/b_prev.gif'];
38 nextArrowFile = ['file://' helpPath '/ug/b_next.gif'];
39 toTopFile = ['file://' helpPath '/ug/doc_to_top_up.gif'];
40 mainClassDescFile = ['file://' helpPath '/ug/class_desc_main.html'];
41 helptocFile = ['file://' helpPath '/helptoc.html'];
42 classDescFile = ['file://' helpPath '/ug/class_desc_', ii.mclass, '.html'];
43
44 txt = '';
45
46 % First the header table
47 txt = [txt sprintf('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n')];
48 txt = [txt sprintf(' "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">\n\n')];
49
50 txt = [txt sprintf('<html lang="en">\n')];
51
52 % Head definition
53 txt = [txt sprintf(' <head>\n')];
54 txt = [txt sprintf(' <title>Method Report for %s.%s</title>\n', ii.mclass, ii.mname)];
55 txt = [txt sprintf(' <link rel="stylesheet" type="text/css" href="%s">\n', docStyleFile)];
56 txt = [txt sprintf(' </head>\n\n')];
57
58 txt = [txt sprintf(' <body>\n\n')];
59
60 txt = [txt sprintf(' <a name="top_of_page" id="top_of_page"></a>\n')];
61 txt = [txt sprintf(' <p style="font-size:1px;">&nbsp;</p>\n\n')];
62
63 % Table of the navigation (top)
64 txt = [txt sprintf(' <table class="nav" summary="Navigation aid" border="0" width="100%%" cellpadding="0" cellspacing="0">\n')];
65 txt = [txt sprintf(' <tr>\n')];
66 txt = [txt sprintf(' <td valign="baseline"><b>LTPDA Toolbox</b></td>\n')];
67 txt = [txt sprintf(' <td><a href="%s">contents</a></td>\n', helptocFile)];
68 txt = [txt sprintf(' <td valign="baseline" align="right"><a href=\n')];
69 txt = [txt sprintf(' "%s"><img src=\n', mainClassDescFile)];
70 txt = [txt sprintf(' "%s" border="0" align="bottom" alt="Class descriptions"></img></a>&nbsp;&nbsp;&nbsp;<a href=\n', prefArrowFile)];
71 txt = [txt sprintf(' "%s"><img src=\n', classDescFile)];
72 txt = [txt sprintf(' "%s" border="0" align="bottom" alt="%s Class"></a></td>\n', nextArrowFile, upper(ii.mclass))];
73 txt = [txt sprintf(' </tr>\n')];
74 txt = [txt sprintf(' </table>\n\n')];
75
76 txt = [txt sprintf(' <h1 class="title">Method Report for %s.%s</h1>\n', ii.mclass, ii.mname)];
77 txt = [txt sprintf(' <hr>\n\n')];
78
79 % Documentation
80 txt = [txt sprintf('<h2>Description</h2>\n')];
81 txt = [txt sprintf('<p>%s</p>', ii.description)];
82
83 % Link-Table of the sets
84 txt = [txt sprintf(' <p><!-- Link-Table of the sets -->\n')];
85 txt = [txt sprintf(' <table border="0" cellpadding="4" cellspacing="0" class="pagenavtable">\n')];
86 txt = [txt sprintf(' <tr><th>Sets for this method &#8230;</th></tr>\n')];
87 for ll=1:numel(ii.sets)
88 set = ii.sets{ll};
89 txt = [txt sprintf(' <tr><td><a href="#%d">%s</a></td></tr>\n', ll, set)];
90 end
91 txt = [txt sprintf(' </table>\n')];
92 txt = [txt sprintf(' <p>\n\n')];
93
94
95 % Table of the sets
96 for ll=1:numel(ii.sets)
97 set = ii.sets{ll};
98 pl = ii.plists(ll);
99 pl.setName(set);
100 txt = [txt pl.tohtml(num2str(ll))];
101
102 % Back to top
103 txt = [txt sprintf(' <!-- ===== Back to top ===== -->\n')];
104 txt = [txt sprintf(' <a href="#top_of_page">\n')];
105 txt = [txt sprintf(' <img src="%s" border="0" align="bottom" alt="back to top"/>\n', toTopFile)];
106 txt = [txt sprintf(' back to top\n')];
107 txt = [txt sprintf(' </a>\n')];
108 txt = [txt sprintf(' </p>\n\n')];
109 end
110
111 % Table of the minfo object
112 txt = [txt sprintf(' <p><!-- Table of the minfo object -->\n')];
113 txt = [txt sprintf(' <table cellspacing="0" class="body" cellpadding="2" border="0" width="60%%">\n')];
114 txt = [txt sprintf(' <colgroup>\n')];
115 txt = [txt sprintf(' <col width="25%%"/>\n')];
116 txt = [txt sprintf(' <col width="75%%"/>\n')];
117 txt = [txt sprintf(' </colgroup>\n')];
118 txt = [txt sprintf(' <thead>\n')];
119 txt = [txt sprintf(' <tr valign="top">\n')];
120 txt = [txt sprintf(' <th class="categorylist" colspan="2">Some information of the method %s/%s are listed below:</th>\n', ii.mclass, ii.mname)];
121 txt = [txt sprintf(' </tr>\n')];
122 txt = [txt sprintf(' </thead>\n')];
123 txt = [txt sprintf(' <tbody>\n')];
124 txt = [txt sprintf(' <!-- Property: ''mclass'' -->\n')];
125 txt = [txt sprintf(' <tr valign="top">\n')];
126 txt = [txt sprintf(' <td bgcolor="#f3f4f5">Class name</td>\n')];
127 txt = [txt sprintf(' <td bgcolor="#f3f4f5">%s</td>\n', ii.mclass)];
128 txt = [txt sprintf(' </tr>\n')];
129 txt = [txt sprintf(' <!-- Property: ''mname'' -->\n')];
130 txt = [txt sprintf(' <tr valign="top">\n')];
131 txt = [txt sprintf(' <td bgcolor="#ffffff">Method name</td>\n')];
132 txt = [txt sprintf(' <td bgcolor="#ffffff">%s</td>\n', ii.mname)];
133 txt = [txt sprintf(' </tr>\n')];
134 txt = [txt sprintf(' <!-- Property: ''mcategory'' -->\n')];
135 txt = [txt sprintf(' <tr valign="top">\n')];
136 txt = [txt sprintf(' <td bgcolor="#f3f4f5">Category</td>\n')];
137 txt = [txt sprintf(' <td bgcolor="#f3f4f5">%s</td>\n', ii.mcategory)];
138 txt = [txt sprintf(' </tr>\n')];
139 txt = [txt sprintf(' <!-- Property: ''mversion'' -->\n')];
140 txt = [txt sprintf(' <tr valign="top">\n')];
141 txt = [txt sprintf(' <td bgcolor="#ffffff">CVS Version</td>\n')];
142 txt = [txt sprintf(' <td bgcolor="#ffffff">%s</td>\n', ii.mversion)];
143 txt = [txt sprintf(' </tr>\n')];
144 txt = [txt sprintf(' <!-- Property: ''argsmin'' -->\n')];
145 txt = [txt sprintf(' <tr valign="top">\n')];
146 txt = [txt sprintf(' <td bgcolor="#f3f4f5">Min input args</td>\n')];
147 txt = [txt sprintf(' <td bgcolor="#f3f4f5">%d</td>\n', ii.argsmin)];
148 txt = [txt sprintf(' </tr>\n')];
149 txt = [txt sprintf(' <!-- Property: ''argsmax'' -->\n')];
150 txt = [txt sprintf(' <tr valign="top">\n')];
151 txt = [txt sprintf(' <td bgcolor="#ffffff">Max input args</td>\n')];
152 txt = [txt sprintf(' <td bgcolor="#ffffff">%d</td>\n', ii.argsmax)];
153 txt = [txt sprintf(' </tr>\n')];
154 txt = [txt sprintf(' <!-- Property: ''outmin'' -->\n')];
155 txt = [txt sprintf(' <tr valign="top">\n')];
156 txt = [txt sprintf(' <td bgcolor="#f3f4f5">Min output args</td>\n')];
157 txt = [txt sprintf(' <td bgcolor="#f3f4f5">%d</td>\n', ii.outmin)];
158 txt = [txt sprintf(' </tr>\n')];
159 txt = [txt sprintf(' <!-- Property: ''outmax'' -->\n')];
160 txt = [txt sprintf(' <tr valign="top">\n')];
161 txt = [txt sprintf(' <td bgcolor="#ffffff">Max output args</td>\n')];
162 txt = [txt sprintf(' <td bgcolor="#ffffff">%d</td>\n', ii.outmax)];
163 txt = [txt sprintf(' </tr>\n')];
164 txt = [txt sprintf(' </tbody>\n')];
165 txt = [txt sprintf(' </table>\n')];
166 txt = [txt sprintf(' </p>\n\n')];
167
168 % Table of the navigation (bottom)
169 txt = [txt sprintf(' <br>\n')];
170 txt = [txt sprintf(' <table class="nav" summary="Navigation aid" border="0" width="100%%" cellpadding="0" cellspacing="0">\n')];
171 txt = [txt sprintf(' <tr valign="top">\n')];
172 txt = [txt sprintf(' <td align="left" width="20">\n')];
173 txt = [txt sprintf(' <a href="%s"><img src="%s" border="0" align="bottom" alt="Class descriptions"></img></a>\n', mainClassDescFile, prefArrowFile)];
174 txt = [txt sprintf(' </td>\n')];
175 txt = [txt sprintf(' <td align="left">Class descriptions</td>\n')];
176 txt = [txt sprintf(' <td>&nbsp;</td>\n')];
177 txt = [txt sprintf(' <td align="right">%s Class</td>\n', upper(ii.mclass))];
178 txt = [txt sprintf(' <td align="right" width="20">\n')];
179 txt = [txt sprintf(' <a href="%s"><img src="%s" border="0" align="bottom" alt="%s Class"></img></a>\n', classDescFile, nextArrowFile, upper(ii.mclass))];
180 txt = [txt sprintf(' </td>\n')];
181 txt = [txt sprintf(' </tr>\n')];
182 txt = [txt sprintf(' </table><br>\n')];
183
184 txt = [txt sprintf(' <p class="copy">&copy;LTP Team</p>\n')];
185
186 txt = [txt sprintf(' </body>\n')];
187 txt = [txt sprintf('</html>')];
188
189 end
190