Changeset View
Changeset View
Standalone View
Standalone View
tools/uni2characterwidth/template.example
- This file was added.
1 | «*COMMENT:---------------------------------------------------------------------- | ||||
---|---|---|---|---|---|
2 | | ||||
3 | Tags: | ||||
4 | | ||||
5 | «*anything:comment where everything but closing sequence is allowed:anything*» | ||||
6 | | ||||
7 | «NAME:any content, including other tags. \: have to be escaped. It is processed | ||||
8 | using data passed from code() function under NAME key. It should contain other | ||||
9 | tags, without them this text will be replaced with passed data or removed.» | ||||
10 | | ||||
11 | «NAME» - like before, used when data should replace it, so content is | ||||
12 | unnecessary | ||||
13 | | ||||
14 | EXAMPLE: | ||||
15 | data: Map{ "exampleA", Map{ { "Number", 42 }, { "String", "hello" } } } | ||||
16 | template: «exampleA:number\: «Number», string\: «String»» | ||||
17 | result: number: 42, string: hello | ||||
18 | | ||||
19 | «» - empty anonymous element. Used in named elements which receive lists. | ||||
20 | The element will be replaced with list item, and duplicated if | ||||
21 | | ||||
22 | «:anonymous container. It should contain some elements which receive data. | ||||
23 | The element will disappear when child element will not receive any value. | ||||
24 | Useful to add suffixes/prefixes to data» | ||||
25 | | ||||
26 | EXAMPLE: | ||||
27 | data: Map{ "exampleB", Vector{ 1, 2, 3, 4, 5, 6, 7 } } | ||||
28 | template: «exampleB:«:[«»] »» | ||||
29 | result: [1] [2] [3] [4] [5] [6] [7] | ||||
30 | | ||||
31 | data: Map{ "exampleC", Vector{ "a", "b", "c" } } | ||||
32 | template: «exampleC:«:first = «»»«:, second = «»»«:, third = «»»«:, fourth = «»»» | ||||
33 | result: first = a, second = b, third = c | ||||
34 | | ||||
35 | «!fmt "XXX":a wrapper which sets printf-like format XXX for numbers and | ||||
36 | strings inside it. Starts with %.» | ||||
37 | | ||||
38 | «!repeat N:repeats contents inside N times.» | ||||
39 | | ||||
40 | EXAMPLE: | ||||
41 | data: Map{ "exampleD", Vector{ 1, 2, 3, 4, 10, 11, 12, 13 } } | ||||
42 | template: «exampleD:«!fmt "%#.2x":«!repeat 3:«» »«»; »» | ||||
43 | result: 0x01 0x02 0x03 0x04; 0x0a 0x0b 0x0c 0x0d; | ||||
44 | | ||||
45 | D: «exampleD:«!fmt "%#.2x":«!repeat 3:«» »«»; »» | ||||
46 | ----------------------------------------------------------------------:COMMENT*» | ||||
47 | For available data see code() function. Below are usage examples | ||||
48 | | ||||
49 | Warning about generated file - putting "this is a generated file" text in a | ||||
50 | template file could be misleading. | ||||
51 | «gen-file-warning» | ||||
52 | | ||||
53 | | ||||
54 | Command used to generate the file: | ||||
55 | «cmdline» | ||||
56 | | ||||
57 | | ||||
58 | Direct LUT - widths of the first 256 code points in direct access array: | ||||
59 | {«!fmt "% d":«direct-lut: | ||||
60 | «!repeat 32:«:«»,»» | ||||
61 | »»} | ||||
62 | | ||||
63 | | ||||
64 | Arrays with code point ranges for every width: | ||||
65 | «ranges-luts:«: | ||||
66 | «name» = {«!fmt "%#.6x":«ranges: | ||||
67 | «!repeat 8:«:{«first»,«last»},»» | ||||
68 | »»} | ||||
69 | Number of elements in the array: «size» | ||||
70 | | ||||
71 | »» | ||||
72 | List of array names, sizes, and widths: | ||||
73 | {«ranges-lut-list: | ||||
74 | «:{«!fmt "% d":«width»», «!fmt "%-16s":«name»», «size»},» | ||||
75 | »} | ||||
76 | Number of elements in the array: «ranges-lut-list-size»; | ||||
77 | |