Cache sidebar with a simple caching API
We cache the sidebar once for every user, the downside is that once
the user meets new access criteria, their sidebar does not get
updated. This can be fixed by calling soc.cache.sidebar.flush() when
appropriate.
Patch by: Sverre Rabbelier
%YAML 1.1
---
ascii:
header: "\e[0;1;30;40m"
footer: "\e[0m"
tokens:
stream-start:
stream-end:
directive: { start: "\e[35m", end: "\e[0;1;30;40m" }
document-start: { start: "\e[35m", end: "\e[0;1;30;40m" }
document-end: { start: "\e[35m", end: "\e[0;1;30;40m" }
block-sequence-start:
block-mapping-start:
block-end:
flow-sequence-start: { start: "\e[33m", end: "\e[0;1;30;40m" }
flow-mapping-start: { start: "\e[33m", end: "\e[0;1;30;40m" }
flow-sequence-end: { start: "\e[33m", end: "\e[0;1;30;40m" }
flow-mapping-end: { start: "\e[33m", end: "\e[0;1;30;40m" }
key: { start: "\e[33m", end: "\e[0;1;30;40m" }
value: { start: "\e[33m", end: "\e[0;1;30;40m" }
block-entry: { start: "\e[33m", end: "\e[0;1;30;40m" }
flow-entry: { start: "\e[33m", end: "\e[0;1;30;40m" }
alias: { start: "\e[32m", end: "\e[0;1;30;40m" }
anchor: { start: "\e[32m", end: "\e[0;1;30;40m" }
tag: { start: "\e[32m", end: "\e[0;1;30;40m" }
scalar: { start: "\e[36m", end: "\e[0;1;30;40m" }
replaces:
- "\r\n": "\n"
- "\r": "\n"
- "\n": "\n"
- "\x85": "\n"
- "\u2028": "\n"
- "\u2029": "\n"
html: &html
tokens:
stream-start:
stream-end:
directive: { start: <code class="directive_token">, end: </code> }
document-start: { start: <code class="document_start_token">, end: </code> }
document-end: { start: <code class="document_end_token">, end: </code> }
block-sequence-start:
block-mapping-start:
block-end:
flow-sequence-start: { start: <code class="delimiter_token">, end: </code> }
flow-mapping-start: { start: <code class="delimiter_token">, end: </code> }
flow-sequence-end: { start: <code class="delimiter_token">, end: </code> }
flow-mapping-end: { start: <code class="delimiter_token">, end: </code> }
key: { start: <code class="delimiter_token">, end: </code> }
value: { start: <code class="delimiter_token">, end: </code> }
block-entry: { start: <code class="delimiter_token">, end: </code> }
flow-entry: { start: <code class="delimiter_token">, end: </code> }
alias: { start: <code class="anchor_token">, end: </code> }
anchor: { start: <code class="anchor_token">, end: </code> }
tag: { start: <code class="tag_token">, end: </code> }
scalar: { start: <code class="scalar_token">, end: </code> }
events:
stream-start: { start: <pre class="yaml_stream"> }
stream-end: { end: </pre> }
document-start: { start: <span class="document"> }
document-end: { end: </span> }
sequence-start: { start: <span class="sequence"> }
sequence-end: { end: </span> }
mapping-start: { start: <span class="mapping"> }
mapping-end: { end: </span> }
scalar: { start: <span class="scalar">, end: </span> }
replaces:
- "\r\n": "\n"
- "\r": "\n"
- "\n": "\n"
- "\x85": "\n"
- "\u2028": "\n"
- "\u2029": "\n"
- "&": "&"
- "<": "<"
- ">": ">"
html-page:
header: |
<html>
<head>
<title>A YAML stream</title>
<style type="text/css">
.document { background: #FFF }
.sequence { background: #EEF }
.mapping { background: #EFE }
.scalar { background: #FEE }
.directive_token { color: #C0C }
.document_start_token { color: #C0C; font-weight: bold }
.document_end_token { color: #C0C; font-weight: bold }
.delimiter_token { color: #600; font-weight: bold }
.anchor_token { color: #090 }
.tag_token { color: #090 }
.scalar_token { color: #000 }
.yaml_stream { color: #999 }
</style>
<body>
footer: |
</body>
</html>
<<: *html
# vim: ft=yaml