source: pyyaml/trunk/examples/yaml-hl/yaml_hl_html.cfg @ 119

Revision 119, 2.0 KB checked in by xi, 9 years ago (diff)

Add an example: yaml highlight script.

Usage:

$ cat your_yaml_document | ./yaml_hl.py                         # Produces colored ASCII output
$ cat your_yaml_document | ./yaml_hl.py -c yaml_hl_html.cfg     # Produces HTML output.
Line 
1
2tokens:
3    stream-start:
4    stream-end:
5    directive:              { start: <code class="directive-token">, end: </code> }
6    document-start:         { start: <code class="document-start-token">, end: </code> }
7    document-end:           { start: <code class="document-end-token">, end: </code> }
8    block-sequence-start:
9    block-mapping-start:
10    block-end:
11    flow-sequence-start:    { start: <code class="delimiter-token">, end: </code> }
12    flow-mapping-start:     { start: <code class="delimiter-token">, end: </code> }
13    flow-sequence-end:      { start: <code class="delimiter-token">, end: </code> }
14    flow-mapping-end:       { start: <code class="delimiter-token">, end: </code> }
15    key:                    { start: <code class="delimiter-token">, end: </code> }
16    value:                  { start: <code class="delimiter-token">, end: </code> }
17    block-entry:            { start: <code class="delimiter-token">, end: </code> }
18    flow-entry:             { start: <code class="delimiter-token">, end: </code> }
19    alias:                  { start: <code class="anchor-token">, end: </code> }
20    anchor:                 { start: <code class="anchor-token">, end: </code> }
21    tag:                    { start: <code class="tag-token">, end: </code> }
22    scalar:                 { start: <code class="scalar-token">, end: </code> }
23
24events:
25    stream-start:   { start: <pre class="yaml-stream"> }
26    stream-end:     { end: </pre> }
27    document-start: { start: <span class="document"> }
28    document-end:   { end: </span> }
29    sequence:       { start: <span class="sequence"> }
30    mapping:        { start: <span class="mapping"> }
31    collection-end: { end: </span> }
32    scalar:         { start: <span class="scalar">, end: </span> }
33
34replaces: !!pairs
35    - "\r\n":   "\n"
36    - "\r":     "\n"
37    - "\n":     "\n"
38    - "\x85":   "\n"
39    - "\u2028": "\n"
40    - "\u2029": "\n"
41    - "<":      "&lt;"
42    - ">":      "&gt;"
43    - "&":      "&amp;"
44
45# vim: ft=yaml
Note: See TracBrowser for help on using the repository browser.