2 .\" # Copyright (c) 2014, Juniper Networks, Inc.
3 .\" # All rights reserved.
4 .\" # This SOFTWARE is licensed under the LICENSE provided in the
5 .\" # ../Copyright file. By downloading, installing, copying, or
6 .\" # using the SOFTWARE, you agree to be bound by the terms of that
8 .\" # Phil Shafer, July 2014
15 .Nd emit formatted output based on format string and arguments
21 .Fn xo_set_info "xo_handle_t *handle" "xo_info_t *info" "int count"
23 HTML data can include additional information in attributes that
24 begin with "data-". To enable this, three things must occur:
26 First the application must build an array of xo_info_t structures,
27 one per tag. The array must be sorted by name, since
30 binary search to find the entry that matches names from format
35 structure is defined in
37 .Bd -literal -offset indent
38 typedef struct xo_info_s {
39 const char *xi_name; /* Name of the element */
40 const char *xi_type; /* Type of field */
41 const char *xi_help; /* Description of field */
45 Second, the application must inform
47 about this information using the
49 call. Like other libxo calls, passing NULL for the handle tells
51 to use the default handle.
57 will count the elements of
60 must be an empty element at the end. More typically, the number is
61 known to the application:
62 .Bd -literal -offset indent
64 { "in-stock", "number", "Number of items in stock" },
65 { "name", "string", "Name of the item" },
66 { "on-order", "number", "Number of items on order" },
67 { "sku", "string", "Stock Keeping Unit" },
68 { "sold", "number", "Number of items sold" },
70 int info_count = (sizeof(info) / sizeof(info[0]));
72 xo_set_info(NULL, info, info_count);
75 Third, the emitting of info must be triggered with the
82 command line argument.
84 The type and help values, if present, are emitted as the "data-type"
85 and "data-help" attributes:
86 .Bd -literal -offset indent
87 <div class="data" data-tag="sku" data-type="string"
88 data-help="Stock Keeping Unit">GRO-000-533</div>
90 .Sh ADDITIONAL DOCUMENTATION
92 Complete documentation can be found on github:
93 .Bd -literal -offset indent
94 http://juniper.github.io/libxo/libxo-manual.html
97 libxo lives on github as:
98 .Bd -literal -offset indent
99 https://github.com/Juniper/libxo
102 The latest release of libxo is available at:
103 .Bd -literal -offset indent
104 https://github.com/Juniper/libxo/releases
111 library was added in FreeBSD 11.0.