1LOWDOWN_ODT_FREE(3) BSD Library Functions Manual LOWDOWN_ODT_FREE(3)
2
4 lowdown_odt_free — free a Markdown OpenDocument renderer
5
7 library “liblowdown”
8
10 #include <sys/queue.h>
11 #include <stdio.h>
12 #include <lowdown.h>
13
14 void
15 lowdown_odt_free(void *arg);
16
18 Frees the OpenDocument renderer created with lowdown_odt_new(3). If arg
19 is NULL, the function does nothing.
20
22 The following parses b of length bsz and outputs in “flat” OpenDocument
23 format.
24
25 struct lowdown_buf *out;
26 struct lowdown_doc *doc;
27 struct lowdown_node *n;
28 void *rndr;
29
30 if ((doc = lowdown_doc_new(NULL)) == NULL)
31 err(1, NULL);
32 if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
33 err(1, NULL);
34 if ((out = lowdown_buf_new(256)) == NULL)
35 err(1, NULL);
36 if ((rndr = lowdown_odt_new(NULL)) == NULL)
37 err(1, NULL);
38 if (!lowdown_odt_rndr(out, rndr, n))
39 err(1, NULL);
40
41 fwrite(out->data, 1, out->size, stdout);
42
43 lowdown_odt_free(rndr);
44 lowdown_buf_free(out);
45 lowdown_node_free(n);
46 lowdown_doc_free(doc);
47
49 lowdown(3), lowdown_odt_new(3)
50
52 The referenced OpenDocument standard is 1.3: https://docs.oasis-
53 open.org/office/OpenDocument/v1.3/
54
55BSD December 17, 2023 BSD