html.mako revision 0b080452cca90f215d10d636abfb47701d7518da
1## -*- coding: utf-8 -*-
2<!DOCTYPE html>
3<html>
4<!-- Copyright (C) 2012 The Android Open Source Project
5
6     Licensed under the Apache License, Version 2.0 (the "License");
7     you may not use this file except in compliance with the License.
8     You may obtain a copy of the License at
9
10          http://www.apache.org/licenses/LICENSE-2.0
11
12     Unless required by applicable law or agreed to in writing, software
13     distributed under the License is distributed on an "AS IS" BASIS,
14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15     See the License for the specific language governing permissions and
16     limitations under the License.
17-->
18<head>
19  <!-- automatically generated from html.mako. do NOT edit directly -->
20  <meta charset="utf-8" />
21  <title>Android Camera HAL3.0 Properties</title>
22  <style type="text/css">
23     body { background-color: #f7f7f7; font-family: Roboto, sans-serif;}
24     h1 { color: #333333; }
25     h2 { color: #333333; }
26     a:link { color: #258aaf; text-decoration: none}
27     a:hover { color: #459aaf; text-decoration: underline }
28     a:visited { color: #154a5f; text-decoration: none}
29    .section { color: #eeeeee; font-size: 1.5em; font-weight: bold; background-color: #888888; padding: 0.5em 0em 0.5em 0.5em; border-width: thick thin thin thin; border-color: #111111 #777777 #777777 #777777}
30    .kind { color: #eeeeee; font-size: 1.2em; font-weight: bold; padding-left: 1.5em; background-color: #aaaaaa }
31    .entry { background-color: #f0f0f0 }
32    .entry_cont { background-color: #f0f0f0 }
33    .entries_header { background-color: #dddddd; text-align: center}
34
35    /* toc style */
36    .toc_section_header { font-size:1.3em;  }
37    .toc_kind_header { font-size:1.2em;  }
38
39    /* table column sizes */
40    table { border-collapse:collapse; table-layout: fixed; width: 100%; word-wrap: break-word }
41    td,th { border: 1px solid; border-color: #aaaaaa; padding-left: 0.5em; padding-right: 0.5em }
42    .th_name { width: 20% }
43    .th_units { width: 10% }
44    .th_tags { width: 5% }
45    .th_details { width: 25% }
46    .th_type { width: 20% }
47    .th_description { width: 20% }
48    .th_range { width: 10% }
49    td { font-size: 0.9em; }
50
51    /* hide the first thead, we need it there only to enforce column sizes */
52    .thead_dummy { visibility: hidden; }
53
54    /* Entry flair */
55    .entry_name { color: #333333; padding-left:1.0em; font-size:1.1em; font-family: monospace; vertical-align:top; }
56
57    /* Entry type flair */
58    .entry_type_name { font-size:1.1em; color: #669900; font-weight: bold;}
59    .entry_type_name_enum:after { color: #669900; font-weight: bold; content:" (enum)" }
60    .entry_type_visibility { font-weight: bolder; padding-left:1em}
61    .entry_type_enum_name { font-family: monospace; font-weight: bolder; }
62    .entry_type_enum_notes:before { content:" - " }
63    .entry_type_enum_value:before { content:" = " }
64    .entry_type_enum_value { font-family: monospace; }
65    .entry ul { margin: 0 0 0 0; list-style-position: inside; padding-left: 0.5em; }
66    .entry ul li { padding: 0 0 0 0; margin: 0 0 0 0;}
67
68    /* Entry tags flair */
69    .entry_tags ul { list-style-type: none; }
70
71    /* Entry details (full docs) flair */
72    .entry_details_header { font-weight: bold; background-color: #dddddd;
73      text-align: center; font-size: 1.1em; margin-left: 0em; margin-right: 0em; }
74
75    /* Entry spacer flair */
76    .entry_spacer { background-color: transparent; border-style: none; height: 0.5em; }
77
78    /* TODO: generate abbr element for each tag link? */
79    /* TODO for each x.y.z try to link it to the entry */
80
81  </style>
82
83  <style>
84
85    {
86      /* broken...
87         supposedly there is a bug in chrome that it lays out tables before
88         it knows its being printed, so the page-break-* styles are ignored
89         */
90        tr { page-break-after: always; page-break-inside: avoid; }
91    }
92
93  </style>
94</head>
95
96<%!
97  import re
98  from metadata_helpers import md
99  from metadata_helpers import IMAGE_SRC_METADATA
100  from metadata_helpers import wbr
101
102  # insert line breaks after every two \n\n
103  def br(text):
104    return re.sub(r"(\r?\n)(\r?\n)", r"\1<br>\2<br>", text)
105
106  # Render as markdown, and do HTML-doc-specific rewrites
107  def md_html(text):
108    # prepend the image directory path to each <img src="...">
109    return md(text, IMAGE_SRC_METADATA)
110
111  # Number of rows an entry will span
112  def entry_cols(prop):
113    cols = 1
114    if prop.details: cols = cols + 2
115    if prop.hal_details: cols = cols + 2
116    return cols
117%>
118
119<body>
120  <h1>Android Camera HAL3.0 Properties</h1>
121\
122<%def name="insert_toc_body(node)">
123  % for nested in node.namespaces:
124${    insert_toc_body(nested)}
125  % endfor
126  % for entry in node.merged_entries:
127            <li><a href="#${entry.kind}_${entry.name}">${entry.name}</a></li>
128  % endfor
129</%def>
130
131  <h2>Table of Contents</h2>
132  <ul class="toc">
133    <li><a href="#tag_index" class="toc_section_header">Tags</a></li>
134% for root in metadata.outer_namespaces:
135  % for section in root.sections:
136    <li>
137      <span class="toc_section_header"><a href="#section_${section.name}">${section.name}</a></span>
138      <ul class="toc_section">
139      % for kind in section.merged_kinds: # dynamic,static,controls
140        <li>
141          <span class="toc_kind_header">${kind.name}</span>
142          <ul class="toc_section">\
143${          insert_toc_body(kind)}\
144          </ul>
145        </li>
146      % endfor
147      </ul> <!-- toc_section -->
148    </li>
149  % endfor
150% endfor
151  </ul>
152
153
154  <h1>Properties</h1>
155  <table class="properties">
156
157    <thead class="thead_dummy">
158      <tr>
159        <th class="th_name">Property Name</th>
160        <th class="th_type">Type</th>
161        <th class="th_description">Description</th>
162        <th class="th_units">Units</th>
163        <th class="th_range">Range</th>
164        <th class="th_tags">Tags</th>
165      </tr>
166    </thead> <!-- so that the first occurrence of thead is not
167                         above the first occurrence of tr -->
168% for root in metadata.outer_namespaces:
169<!-- <namespace name="${root.name}"> -->
170  % for section in root.sections:
171  <tr><td colspan="6" id="section_${section.name}" class="section">${section.name}</td></tr>
172
173    % if section.description is not None:
174      <tr class="description"><td>${section.description}</td></tr>
175    % endif
176
177    % for kind in section.merged_kinds: # dynamic,static,controls
178      <tr><td colspan="6" class="kind">${kind.name}</td></tr>
179
180      <thead class="entries_header">
181        <tr>
182          <th class="th_name">Property Name</th>
183          <th class="th_type">Type</th>
184          <th class="th_description">Description</th>
185          <th class="th_units">Units</th>
186          <th class="th_range">Range</th>
187          <th class="th_tags">Tags</th>
188        </tr>
189      </thead>
190
191      <tbody>
192
193        <%def name="insert_body(node)">
194            % for nested in node.namespaces:
195                ${insert_namespace(nested)}
196            % endfor
197
198            % for entry in node.merged_entries:
199                ${insert_entry(entry)}
200            % endfor
201        </%def>
202
203        <%def name="insert_namespace(namespace)">
204            ${insert_body(namespace)}
205        </%def>
206
207        <%def name="insert_entry(prop)">
208          <tr class="entry" id="${prop.kind}_${prop.name}">
209            <td class="entry_name" rowspan="${entry_cols(prop)}">
210              ${prop.name | wbr}
211            </td>
212            <td class="entry_type">
213              % if prop.enum:
214                <span class="entry_type_name entry_type_name_enum">${prop.type}</span>
215              % else:
216                <span class="entry_type_name">${prop.type}</span>
217              % endif
218              % if prop.container is not None:
219                <span class="entry_type_container">x</span>
220              % endif
221
222              % if prop.container == 'array':
223                <span class="entry_type_array">
224                  ${" x ".join(prop.container_sizes)}
225                </span>
226              % elif prop.container == 'tuple':
227                <ul class="entry_type_tuple">
228                % for val in prop.tuple_values:
229                  <li>${val}</li>
230                % endfor
231                </ul>
232              % endif
233              <span class="entry_type_visibility"> [${prop.applied_visibility}${" as %s" %prop.typedef.name if prop.typedef else ""}]</span>
234              % if prop.type_notes is not None:
235                <div class="entry_type_notes">${prop.type_notes | wbr}</div>
236              % endif
237
238              % if prop.enum:
239                <ul class="entry_type_enum">
240                  % for value in prop.enum.values:
241                  <li>
242                    <span class="entry_type_enum_name">${value.name}</span>
243                  % if value.optional:
244                    <span class="entry_type_enum_optional">optional</span>
245                  % endif:
246                  % if value.id is not None:
247                    <span class="entry_type_enum_value">${value.id}</span>
248                  % endif
249                  % if value.notes is not None:
250                    <span class="entry_type_enum_notes">${value.notes | wbr}</span>
251                  % endif
252                  </li>
253                  % endfor
254                </ul>
255              % endif
256
257            </td> <!-- entry_type -->
258
259            <td class="entry_description">
260            % if prop.description is not None:
261              ${prop.description | md_html, wbr}
262            % endif
263            </td>
264
265            <td class="entry_units">
266            % if prop.units is not None:
267              ${prop.units | wbr}
268            % endif
269            </td>
270
271            <td class="entry_range">
272            % if prop.range is not None:
273              ${prop.range | wbr}
274            % endif
275            </td>
276
277            <td class="entry_tags">
278            % if next(prop.tags, None):
279              <ul class="entry_tags">
280              % for tag in prop.tags:
281                  <li><a href="#tag_${tag.id}">${tag.id}</a></li>
282              % endfor
283              </ul>
284            % endif
285            </td>
286
287          </tr>
288          % if prop.details is not None:
289          <tr class="entries_header">
290            <th class="th_details" colspan="5">Details</th>
291          </tr>
292          <tr class="entry_cont">
293            <td class="entry_details" colspan="5">
294              ${prop.details | md_html, wbr}
295            </td>
296          </tr>
297          % endif
298
299          % if prop.hal_details is not None:
300          <tr class="entries_header">
301            <th class="th_details" colspan="5">HAL Implementation Details</th>
302          </tr>
303          <tr class="entry_cont">
304            <td class="entry_details" colspan="5">
305              ${prop.hal_details | md_html, wbr}
306            </td>
307          </tr>
308          % endif
309
310          <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
311           <!-- end of entry -->
312        </%def>
313
314        ${insert_body(kind)}
315
316      <!-- end of kind -->
317      </tbody>
318    % endfor # for each kind
319
320  <!-- end of section -->
321  % endfor
322<!-- </namespace> -->
323% endfor
324  </table>
325
326  <div class="tags" id="tag_index">
327    <h2>Tags</h2>
328    <ul>
329    % for tag in metadata.tags:
330      <li id="tag_${tag.id}">${tag.id} - ${tag.description}
331        <ul class="tags_entries">
332        % for prop in tag.entries:
333          <li><a href="#${prop.kind}_${prop.name}">${prop.name}</a> (${prop.kind})</li>
334        % endfor
335        </ul>
336      </li> <!-- tag_${tag.id} -->
337    % endfor
338    </ul>
339  </div>
340
341  [ <a href="#">top</a> ]
342
343</body>
344</html>
345