Create the breadcrumb trail to this page of documentation. Args: path: string, Dot separated name of the resource. root_discovery: Deserialized discovery document. Returns: HTML with links to each of the parent resources of this resource.
(path, root_discovery)
| 267 | |
| 268 | |
| 269 | def breadcrumbs(path, root_discovery): |
| 270 | """Create the breadcrumb trail to this page of documentation. |
| 271 | |
| 272 | Args: |
| 273 | path: string, Dot separated name of the resource. |
| 274 | root_discovery: Deserialized discovery document. |
| 275 | |
| 276 | Returns: |
| 277 | HTML with links to each of the parent resources of this resource. |
| 278 | """ |
| 279 | parts = path.split(".") |
| 280 | |
| 281 | crumbs = [] |
| 282 | accumulated = [] |
| 283 | |
| 284 | for i, p in enumerate(parts): |
| 285 | prefix = ".".join(accumulated) |
| 286 | # The first time through prefix will be [], so we avoid adding in a |
| 287 | # superfluous '.' to prefix. |
| 288 | if prefix: |
| 289 | prefix += "." |
| 290 | display = p |
| 291 | if i == 0: |
| 292 | display = root_discovery.get("title", display) |
| 293 | crumbs.append('<a href="{}.html">{}</a>'.format(prefix + p, display)) |
| 294 | accumulated.append(p) |
| 295 | |
| 296 | return " . ".join(crumbs) |
| 297 | |
| 298 | |
| 299 | def document_collection(resource, path, root_discovery, discovery, css=CSS): |
no test coverage detected
searching dependent graphs…