troff: escape dots after inline markups
[ctxt.git] / ctxt.h
blob3ea1c09eeda9d7a3c1ddbf23064f8f3b952778fb
1 #ifndef _FMT_H
2 #define _FMT_H
4 struct doc {
5 int fd;
6 int len;
7 int size;
8 char *buf;
9 };
11 #define M_EMPH 1
12 #define M_RAW 2
13 #define M_FOOT 3
14 #define M_MATH 4
15 #define M_LINK 5
17 #define B_RAW 1
18 #define B_PRE 2
19 #define B_MATH 3
21 struct doc *doc_alloc(int fd);
22 void doc_write(struct doc *doc, char *s);
23 void doc_memcat(struct doc *doc, char *s, int n);
24 void doc_free(struct doc *doc);
26 struct fmt_ops {
27 void (*doc_beg)(struct doc *doc);
28 void (*doc_end)(struct doc *doc);
29 void (*head_beg)(struct doc *doc, int level);
30 void (*head_end)(struct doc *doc, int level);
31 void (*par_beg)(struct doc *doc);
32 void (*par_end)(struct doc *doc);
33 void (*list_beg)(struct doc *doc);
34 void (*list_end)(struct doc *doc);
35 void (*item_beg)(struct doc *doc);
36 void (*item_end)(struct doc *doc);
37 void (*table_beg)(struct doc *doc, int columns);
38 void (*table_end)(struct doc *doc);
39 void (*row_beg)(struct doc *doc);
40 void (*row_end)(struct doc *doc);
41 void (*entry_beg)(struct doc *doc);
42 void (*entry_end)(struct doc *doc);
43 void (*block_beg)(struct doc *doc, char *beg, int block);
44 void (*block_end)(struct doc *doc, char *end, int block);
45 void (*put)(struct doc *doc, char *s);
46 void (*put_txt)(struct doc *doc, char *s, int marker);
49 struct txt {
50 char *txt;
51 char **lines;
52 int n;
55 struct txt *txt_alloc(int fd);
56 char *txt_line(struct txt *txt, int line);
57 void txt_free(struct txt *txt);
59 void format(struct doc *doc, struct txt *txt, struct fmt_ops *ops);
61 extern struct fmt_ops troff_ops;
62 extern struct fmt_ops latex_ops;
63 extern struct fmt_ops html_ops;
65 #endif