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 HAL2.0 Properties</title>
22  <style type="text/css">
23    .section { font-size: 1.5em; font-weight: bold; background-color: beige; padding: 0.5em 0em 0.5em 0.1em }
24    .kind { font-size: 1.2em; font-weight: bold; padding-left: 0.5em; background-color: gray }
25    .entry { background-color: burlywood }
26
27    /* table column sizes */
28    table { table-layout: fixed; width: 100%; word-wrap: break-word }
29    td,th { border: 1px solid;  }
30    .th_name { width: 20% }
31    .th_units { width: 10% }
32    .th_tags { width: 5% }
33    .th_notes { width: 30% }
34    .th_type { width: 20% }
35    td { font-size: 0.9em; }
36
37    /* hide the first thead, we need it there only to enforce column sizes */
38    .thead_dummy { visibility: hidden; }
39
40    /* Entry flair */
41    .entry_name { font-family: monospace; font-style: italic; }
42
43    /* Entry type flair */
44    .entry_type_name { color: darkgreen; font-weight: bold; }
45    .entry_type_name_enum:after { color: darkgreen; font-weight: bold; content:" (enum)" }
46    .entry_type_enum_name { font-family: monospace; font-weight: bolder; }
47    .entry_type_enum_notes:before { content:" - " }
48    .entry_type_enum_value:before { content:" = " }
49    .entry_type_enum_value { font-family: monospace; }
50    .entry ul { margin: 0 0 0 0; list-style-position: inside; padding-left: 0.5em; }
51    .entry ul li { padding: 0 0 0 0; margin: 0 0 0 0;}
52
53    /* Entry tags flair */
54    .entry_tags ul { list-style-type: none; }
55
56
57    /* TODO: generate abbr element for each tag link? */
58    /* TODO for each x.y.z try to link it to the entry */
59
60  </style>
61
62  <style>
63
64    {
65      /* broken...
66         supposedly there is a bug in chrome that it lays out tables before
67         it knows its being printed, so the page-break-* styles are ignored
68         */
69        tr { page-break-after: always; page-break-inside: avoid; }
70    }
71
72  </style>
73</head>
74
75<%!
76  import re
77
78  # insert word break hints for the browser
79  def wbr(text):
80    new_txt = text
81
82    # for johnyOrange.appleCider.redGuardian also insert wbr before the caps
83    # => johny<wbr>Orange.apple<wbr>Cider.red<wbr>Guardian
84    for words in text.split(" "):
85      if len(words.split(".")) >= 3: # match only x.y.z
86        addwbr = lambda x: i.isupper() and ("<wbr>" + i) or i
87        new_word = "".join([addwbr(i) for i in words])
88        new_txt = new_txt.replace(words, new_word)
89
90    # e.g. X/Y/Z -> X/<wbr>Y/<wbr>/Z. also for X.Y.Z, X_Y_Z.
91    replace_chars=['.', '/', '_', ',']
92    for i in replace_chars:
93      new_txt = new_txt.replace(i, i + "<wbr>")
94
95    return new_txt
96
97  # insert line breaks after every two \n\n
98  def br(text):
99    return re.sub(r"(\r?\n)(\r?\n)", r"\1<br>\2<br>", text)
100%>
101
102
103<body>
104  <h1>Android Camera HAL2.0 Properties</h1>
105
106  <h2>Table of Contents</h2>
107  <ul class="toc">
108    <li><a href="#tag_index">Tags</a></li>
109
110
111    % for section in metadata.find_all(lambda x: isinstance(x, metadata_model.Section)):
112    <li><p class="toc_section"><a href="#section_${section.name}">${section.name}</a></p>
113    <ul class="toc_section">
114      % for prop in section.find_all(lambda x: isinstance(x, metadata_model.Entry)):
115        <li><a href="#${prop.kind}_${prop.name}">${prop.name}</a> (${prop.kind})</li>
116      % endfor
117    </ul>
118    </li> <!-- toc_section -->
119    % endfor
120  </ul>
121
122  <h1>Properties</h1>
123  <table class="properties">
124
125    <thead class="thead_dummy">
126      <tr>
127        <th class="th_name">Property Name</th>
128        <th class="th_type">Type</th>
129        <th class="th_description">Description</th>
130        <th class="th_units">Units</th>
131        <th class="th_range">Range</th>
132        <th class="th_notes">Notes</th>
133        <th class="th_tags">Tags</th>
134      </tr>
135    </thead> <!-- so that the first occurrence of thead is not
136                         above the first occurrence of tr -->
137% for root in metadata.outer_namespaces:
138<!-- <namespace name="${root.name}"> -->
139  % for section in root.sections:
140  <tr><td colspan="7" id="section_${section.name}" class="section">${section.name}</td></tr>
141
142    % if section.description is not None:
143      <tr class="description"><td>${section.description}</td></tr>
144    % endif
145
146    % for kind in section.merged_kinds: # dynamic,static,controls
147      <tr><td colspan="7" class="kind">${kind.name}</td></tr>
148
149      <thead>
150        <tr>
151          <th class="th_name">Property Name</th>
152          <th class="th_type">Type</th>
153          <th class="th_description">Description</th>
154          <th class="th_units">Units</th>
155          <th class="th_range">Range</th>
156          <th class="th_notes">Notes</th>
157          <th class="th_tags">Tags</th>
158        </tr>
159      </thead>
160
161      <tbody>
162
163        <%def name="insert_body(node)">
164            % for nested in node.namespaces:
165                ${insert_namespace(nested)}
166            % endfor
167
168            % for entry in node.merged_entries:
169                ${insert_entry(entry)}
170            % endfor
171        </%def>
172
173        <%def name="insert_namespace(namespace)">
174            ${insert_body(namespace)}
175        </%def>
176
177        <%def name="insert_entry(prop)">
178        % if False: #prop.is_clone():
179            <clone entry="${prop.name}" kind="${prop.target_kind}">
180
181              % if prop.notes is not None:
182                <notes>${prop.notes | h,wbr}</notes>
183              % endif
184
185              % for tag in prop.tags:
186                <tag id="${tag.id}" />
187              % endfor
188
189            </clone>
190        % else:
191          <tr class="entry" id="${prop.kind}_${prop.name}">
192            <td class="entry_name">${prop.name | wbr}</td>
193            <td class="entry_type">
194              % if prop.enum:
195                <span class="entry_type_name entry_type_name_enum">${prop.type}</span>
196              % else:
197                <span class="entry_type_name">${prop.type}</span>
198              % endif
199              % if prop.container is not None:
200                <span class="entry_type_container">x</span>
201              % endif
202
203              % if prop.container == 'array':
204                <span class="entry_type_array">
205                  ${" x ".join(prop.container_sizes)}
206                </span>
207              % elif prop.container == 'tuple':
208                <ul class="entry_type_tuple">
209                % for val in prop.tuple_values:
210                  <li>${val}</li>
211                % endfor
212                </ul>
213              % endif
214
215              % if prop.type_notes is not None:
216                <div class="entry_type_notes">${prop.type_notes | wbr}</div>
217              % endif
218
219              % if prop.enum:
220                <ul class="entry_type_enum">
221                  % for value in prop.enum.values:
222                  <li>
223                    <span class="entry_type_enum_name">${value.name}</span>
224                  % if value.optional:
225                    <span class="entry_type_enum_optional">optional</span>
226                  % endif:
227                  % if value.id is not None:
228                    <span class="entry_type_enum_value">${value.id}</span>
229                  % endif
230                  % if value.notes is not None:
231                    <span class="entry_type_enum_notes">${value.notes | wbr}</span>
232                  % endif
233                  </li>
234                  % endfor
235                </ul>
236              % endif
237
238            </td> <!-- entry_type -->
239
240            <td class="entry_description">
241            % if prop.description is not None:
242              ${prop.description | wbr, br}
243            % endif
244            </td>
245
246            <td class="entry_units">
247            % if prop.units is not None:
248              ${prop.units | wbr}
249            % endif
250            </td>
251
252            <td class="entry_range">
253            % if prop.range is not None:
254              ${prop.range | wbr}
255            % endif
256            </td>
257
258            <td class="entry_notes">
259            % if prop.notes is not None:
260              ${prop.notes | wbr, br}
261            % endif
262            </td>
263
264            <td class="entry_tags">
265            % if next(prop.tags, None):
266              <ul class="entry_tags">
267              % for tag in prop.tags:
268                  <li><a href="#tag_${tag.id}">${tag.id}</a></li>
269              % endfor
270              </ul>
271            % endif
272            </td>
273
274          </tr> <!-- end of entry -->
275        % endif
276        </%def>
277
278        ${insert_body(kind)}
279
280      <!-- end of kind -->
281      </tbody>
282    % endfor # for each kind
283
284  <!-- end of section -->
285  % endfor
286<!-- </namespace> -->
287% endfor
288  </table>
289
290  <div class="tags" id="tag_index">
291    <h2>Tags</h2>
292    <ul>
293    % for tag in metadata.tags:
294      <li id="tag_${tag.id}">${tag.id} - ${tag.description}
295        <ul class="tags_entries">
296        % for prop in tag.entries:
297          <li><a href="#${prop.kind}_${prop.name}">${prop.name}</a> (${prop.kind})</li>
298        % endfor
299        </ul>
300      </li> <!-- tag_${tag.id} -->
301    % endfor
302    </ul>
303  </div>
304
305  [ <a href="#">top</a> ]
306
307</body>
308</html>
309