1LOWDOWN_ODT_NEW(3)       BSD Library Functions Manual       LOWDOWN_ODT_NEW(3)
2

NAME

4     lowdown_odt_new — allocate a Markdown OpenDocument renderer
5

LIBRARY

7     library “liblowdown”
8

SYNOPSIS

10     #include <sys/queue.h>
11     #include <stdio.h>
12     #include <lowdown.h>
13
14     void *
15     lowdown_odt_new(const struct lowdown_opts *opts);
16

DESCRIPTION

18     Allocates an OpenDocument renderer using opts->flags, or zero if opts is
19     NULL.  This field is documented in lowdown(3).  The returned pointer may
20     be used with multiple invocations of lowdown_odt_rndr(3) and must be
21     freed with lowdown_odt_free(3).
22
23     The bits recognised in opts->oflags are LOWDOWN_ODT_SKIP_HTML and
24     LOWDOWN_STANDALONE.
25
26     The opts->odt.sty field, if not NULL, overrides the default
27     <office:font-face-decls>, <office:scripts>, and <office:styles> elements
28     of the document styles.
29

RETURN VALUES

31     Returns a pointer to the renderer or NULL on memory failure.  The re‐
32     turned pointer must be freed with lowdown_odt_free(3).
33

EXAMPLES

35     The following parses b of length bsz and outputs in “flat” OpenDocument
36     format.
37
38           struct lowdown_buf *out;
39           struct lowdown_doc *doc;
40           struct lowdown_node *n;
41           void *rndr;
42
43           if ((doc = lowdown_doc_new(NULL)) == NULL)
44                   err(1, NULL);
45           if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
46                   err(1, NULL);
47           if ((out = lowdown_buf_new(256)) == NULL)
48                   err(1, NULL);
49           if ((rndr = lowdown_odt_new(NULL)) == NULL)
50                   err(1, NULL);
51           if (!lowdown_odt_rndr(out, rndr, n))
52                   err(1, NULL);
53
54           fwrite(out->data, 1, out->size, stdout);
55
56           lowdown_odt_free(rndr);
57           lowdown_buf_free(out);
58           lowdown_node_free(n);
59           lowdown_doc_free(doc);
60

SEE ALSO

62     lowdown(3), lowdown_odt_free(3), lowdown_odt_rndr(3)
63

STANDARDS

65     The referenced OpenDocument standard is 1.3: https://docs.oasis-
66     open.org/office/OpenDocument/v1.3/
67
68BSD                            December 17, 2023                           BSD
Impressum