html.mako revision ca25627fc63255d147286ef9a9624059825eb548
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.2 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    .toc_deprecated { text-decoration:line-through; }
39
40    /* table column sizes */
41    table { border-collapse:collapse; table-layout: fixed; width: 100%; word-wrap: break-word }
42    td,th { border: 1px solid; border-color: #aaaaaa; padding-left: 0.5em; padding-right: 0.5em }
43    .th_name { width: 20% }
44    .th_units { width: 10% }
45    .th_tags { width: 5% }
46    .th_details { width: 25% }
47    .th_type { width: 20% }
48    .th_description { width: 20% }
49    .th_range { width: 10% }
50    td { font-size: 0.9em; }
51
52    /* hide the first thead, we need it there only to enforce column sizes */
53    .thead_dummy { visibility: hidden; }
54
55    /* Entry flair */
56    .entry_name { color: #333333; padding-left:1.0em; font-size:1.1em; font-family: monospace; vertical-align:top; }
57    .entry_name_deprecated { text-decoration:line-through; }
58
59    /* Entry type flair */
60    .entry_type_name { font-size:1.1em; color: #669900; font-weight: bold;}
61    .entry_type_name_enum:after { color: #669900; font-weight: bold; content:" (enum)" }
62    .entry_type_visibility { font-weight: bolder; padding-left:1em}
63    .entry_type_synthetic { font-weight: bolder; color: #996600; }
64    .entry_type_hwlevel { font-weight: bolder; color: #000066; }
65    .entry_type_deprecated { font-weight: bolder; color: #4D4D4D; }
66    .entry_type_enum_name { font-family: monospace; font-weight: bolder; }
67    .entry_type_enum_notes:before { content:" - " }
68    .entry_type_enum_notes>p:first-child { display:inline; }
69    .entry_type_enum_value:before { content:" = " }
70    .entry_type_enum_value { font-family: monospace; }
71    .entry ul { margin: 0 0 0 0; list-style-position: inside; padding-left: 0.5em; }
72    .entry ul li { padding: 0 0 0 0; margin: 0 0 0 0;}
73    .entry_range_deprecated { font-weight: bolder; }
74
75    /* Entry tags flair */
76    .entry_tags ul { list-style-type: none; }
77
78    /* Entry details (full docs) flair */
79    .entry_details_header { font-weight: bold; background-color: #dddddd;
80      text-align: center; font-size: 1.1em; margin-left: 0em; margin-right: 0em; }
81
82    /* Entry spacer flair */
83    .entry_spacer { background-color: transparent; border-style: none; height: 0.5em; }
84
85    /* TODO: generate abbr element for each tag link? */
86    /* TODO for each x.y.z try to link it to the entry */
87
88  </style>
89
90  <style>
91
92    {
93      /* broken...
94         supposedly there is a bug in chrome that it lays out tables before
95         it knows its being printed, so the page-break-* styles are ignored
96         */
97        tr { page-break-after: always; page-break-inside: avoid; }
98    }
99
100  </style>
101</head>
102
103<%!
104  import re
105  from metadata_helpers import md
106  from metadata_helpers import IMAGE_SRC_METADATA
107  from metadata_helpers import filter_tags
108  from metadata_helpers import wbr
109
110  # insert line breaks after every two \n\n
111  def br(text):
112    return re.sub(r"(\r?\n)(\r?\n)", r"\1<br>\2<br>", text)
113
114  # Convert node name "x.y.z" of kind w to an HTML anchor of form
115  # <a href="#w_x.y.z">x.y.z</a>
116  def html_anchor(node):
117    return '<a href="#%s_%s">%s</a>' % (node.kind, node.name, node.name)
118
119  # Render as markdown, and do HTML-doc-specific rewrites
120  def md_html(text):
121    return md(text, IMAGE_SRC_METADATA)
122
123  # linkify tag names such as "android.x.y.z" into html anchors
124  def linkify_tags(metadata):
125    def linkify_filter(text):
126      return filter_tags(text, metadata, html_anchor)
127    return linkify_filter
128
129  # Number of rows an entry will span
130  def entry_cols(prop):
131    cols = 1
132    if prop.details: cols = cols + 2
133    if prop.hal_details: cols = cols + 2
134    return cols
135%>
136
137<body>
138  <h1>Android Camera HAL3.2 Properties</h1>
139\
140<%def name="insert_toc_body(node)">
141  % for nested in node.namespaces:
142${    insert_toc_body(nested)}
143  % endfor
144  % for entry in node.merged_entries:
145            <li
146    % if entry.deprecated:
147                class="toc_deprecated"
148    % endif
149            >${html_anchor(entry)}</li>
150  % endfor
151</%def>
152
153  <h2>Table of Contents</h2>
154  <ul class="toc">
155    <li><a href="#tag_index" class="toc_section_header">Tags</a></li>
156% for root in metadata.outer_namespaces:
157  % for section in root.sections:
158    <li>
159      <span class="toc_section_header"><a href="#section_${section.name}">${section.name}</a></span>
160      <ul class="toc_section">
161      % for kind in section.merged_kinds: # dynamic,static,controls
162        <li>
163          <span class="toc_kind_header">${kind.name}</span>
164          <ul class="toc_section">\
165${          insert_toc_body(kind)}\
166          </ul>
167        </li>
168      % endfor
169      </ul> <!-- toc_section -->
170    </li>
171  % endfor
172% endfor
173  </ul>
174
175
176  <h1>Properties</h1>
177  <table class="properties">
178
179    <thead class="thead_dummy">
180      <tr>
181        <th class="th_name">Property Name</th>
182        <th class="th_type">Type</th>
183        <th class="th_description">Description</th>
184        <th class="th_units">Units</th>
185        <th class="th_range">Range</th>
186        <th class="th_tags">Tags</th>
187      </tr>
188    </thead> <!-- so that the first occurrence of thead is not
189                         above the first occurrence of tr -->
190% for root in metadata.outer_namespaces:
191<!-- <namespace name="${root.name}"> -->
192  % for section in root.sections:
193  <tr><td colspan="6" id="section_${section.name}" class="section">${section.name}</td></tr>
194
195    % if section.description is not None:
196      <tr class="description"><td>${section.description}</td></tr>
197    % endif
198
199    % for kind in section.merged_kinds: # dynamic,static,controls
200      <tr><td colspan="6" class="kind">${kind.name}</td></tr>
201
202      <thead class="entries_header">
203        <tr>
204          <th class="th_name">Property Name</th>
205          <th class="th_type">Type</th>
206          <th class="th_description">Description</th>
207          <th class="th_units">Units</th>
208          <th class="th_range">Range</th>
209          <th class="th_tags">Tags</th>
210        </tr>
211      </thead>
212
213      <tbody>
214
215        <%def name="insert_body(node)">
216            % for nested in node.namespaces:
217                ${insert_namespace(nested)}
218            % endfor
219
220            % for entry in node.merged_entries:
221                ${insert_entry(entry)}
222            % endfor
223        </%def>
224
225        <%def name="insert_namespace(namespace)">
226            ${insert_body(namespace)}
227        </%def>
228
229        <%def name="insert_entry(prop)">
230          <tr class="entry" id="${prop.kind}_${prop.name}">
231            <td class="entry_name
232              % if prop.deprecated:
233                entry_name_deprecated
234              % endif
235             " rowspan="${entry_cols(prop)}">
236              ${prop.name | wbr}
237            </td>
238            <td class="entry_type">
239              % if prop.enum:
240                <span class="entry_type_name entry_type_name_enum">${prop.type}</span>
241              % else:
242                <span class="entry_type_name">${prop.type}</span>
243              % endif
244              % if prop.container is not None:
245                <span class="entry_type_container">x</span>
246              % endif
247
248              % if prop.container == 'array':
249                <span class="entry_type_array">
250                  ${" x ".join(prop.container_sizes)}
251                </span>
252              % elif prop.container == 'tuple':
253                <ul class="entry_type_tuple">
254                % for val in prop.tuple_values:
255                  <li>${val}</li>
256                % endfor
257                </ul>
258              % endif
259              <span class="entry_type_visibility"> [${prop.applied_visibility}${" as %s" %prop.typedef.name if prop.typedef else ""}]</span>
260
261              % if prop.synthetic:
262              <span class="entry_type_synthetic">[synthetic] </span>
263              % endif
264
265              % if prop.hwlevel:
266              <span class="entry_type_hwlevel">[${prop.hwlevel}] </span>
267              % endif
268
269              % if prop.deprecated:
270              <span class="entry_type_deprecated">[deprecated] </span>
271              % endif
272
273              % if prop.type_notes is not None:
274                <div class="entry_type_notes">${prop.type_notes | wbr}</div>
275              % endif
276
277              % if prop.enum:
278                <ul class="entry_type_enum">
279                  % for value in prop.enum.values:
280                  <li>
281                    <span class="entry_type_enum_name">${value.name}</span>
282                  % if value.optional:
283                    <span class="entry_type_enum_optional">[optional]</span>
284                  % endif:
285                  % if value.hidden:
286                    <span class="entry_type_enum_optional">[hidden]</span>
287                  % endif:
288                  % if value.id is not None:
289                    <span class="entry_type_enum_value">${value.id}</span>
290                  % endif
291                  % if value.notes is not None:
292                    <span class="entry_type_enum_notes">${value.notes | md_html, linkify_tags(metadata), wbr}</span>
293                  % endif
294                  </li>
295                  % endfor
296                </ul>
297              % endif
298
299            </td> <!-- entry_type -->
300
301            <td class="entry_description">
302            % if prop.description is not None:
303              ${prop.description | md_html, linkify_tags(metadata), wbr}
304            % endif
305            </td>
306
307            <td class="entry_units">
308            % if prop.units is not None:
309              ${prop.units | wbr}
310            % endif
311            </td>
312
313            <td class="entry_range">
314            % if prop.deprecated:
315              <p><span class="entry_range_deprecated">Deprecated</span>. Do not use.</p>
316            % endif
317            % if prop.range is not None:
318              ${prop.range | md_html, linkify_tags(metadata), wbr}
319            % endif
320            </td>
321
322            <td class="entry_tags">
323            % if next(prop.tags, None):
324              <ul class="entry_tags">
325              % for tag in prop.tags:
326                  <li><a href="#tag_${tag.id}">${tag.id}</a></li>
327              % endfor
328              </ul>
329            % endif
330            </td>
331
332          </tr>
333          % if prop.details is not None:
334          <tr class="entries_header">
335            <th class="th_details" colspan="5">Details</th>
336          </tr>
337          <tr class="entry_cont">
338            <td class="entry_details" colspan="5">
339              ${prop.details | md_html, linkify_tags(metadata), wbr}
340            </td>
341          </tr>
342          % endif
343
344          % if prop.hal_details is not None:
345          <tr class="entries_header">
346            <th class="th_details" colspan="5">HAL Implementation Details</th>
347          </tr>
348          <tr class="entry_cont">
349            <td class="entry_details" colspan="5">
350              ${prop.hal_details | md_html, linkify_tags(metadata), wbr}
351            </td>
352          </tr>
353          % endif
354
355          <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
356           <!-- end of entry -->
357        </%def>
358
359        ${insert_body(kind)}
360
361      <!-- end of kind -->
362      </tbody>
363    % endfor # for each kind
364
365  <!-- end of section -->
366  % endfor
367<!-- </namespace> -->
368% endfor
369  </table>
370
371  <div class="tags" id="tag_index">
372    <h2>Tags</h2>
373    <ul>
374    % for tag in metadata.tags:
375      <li id="tag_${tag.id}">${tag.id} - ${tag.description}
376        <ul class="tags_entries">
377        % for prop in tag.entries:
378          <li>${html_anchor(prop)} (${prop.kind})</li>
379        % endfor
380        </ul>
381      </li> <!-- tag_${tag.id} -->
382    % endfor
383    </ul>
384  </div>
385
386  [ <a href="#">top</a> ]
387
388</body>
389</html>
390