/* * htmlise.h: * Definitions for htmlise. * * Copyright (c) 2003 Chris Lightfoot. All rights reserved. * Email: chris@ex-parrot.com; WWW: http://www.ex-parrot.com/~chris/ * * $Id: htmlise.h,v 1.2 2003/02/06 23:14:01 chris Exp $ * */ #ifndef __HTMLISE_H_ /* include guard */ #define __HTMLISE_H_ #include /* BULLET_CHARS * Characters we allow to introduce a bulleted list segment. */ #define BULLET_CHARS "-*+." /* TABSIZE * Number of characters between tab stops. 8 is traditional. */ #define TABSIZE 8 /* alloc_struct S P * Make P point to a new struct S, initialised as if in static storage (like * = {0}). */ #define alloc_struct(S, p) do { struct S as__z = {0}; p = malloc(sizeof *p); *p = as__z; } while (0) /* struct paragraph * Definition of a paragraph. */ struct paragraph { size_t nlines; char **lines; size_t indent, ldrindent; /* Paragraph type. Either a paragraph is text with a possible numeric or * bulleted leader, or it's a container for some more paragraphs, for * instance a table cell. */ enum { none, bullet, number } type; char *container; int leader; struct paragraph *prev, *next, *contents; }; /* htmlise.c */ char *get_line(FILE *fp); int is_blank(const char *s); char *expand_tabs(const char *string); void classify_paragraph(struct paragraph *P); struct paragraph *read_paragraph(FILE *fp); int main(int argc, char *argv[]); /* tables.c */ void process_tables(struct paragraph *paras); /* markup.c */ struct paragraph *create_container(char *type, struct paragraph *first, struct paragraph *last, const int unindent); void process_lists(struct paragraph *paras); void process_block_quotes(struct paragraph *paras); void process_markup(struct paragraph *paras); /* inline.c */ void emit_as_html(FILE *fp, const struct paragraph *P); #endif /* __HTMLISE_H_ */