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