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