version bump
[smdp.git] / include / parser.h
1 #if !defined( PARSER_H )
2 #define PARSER_H
3
4 /*
5  * Functions necessary to parse a file and transform its content into
6  * a deck of slides containing lines. All based on markdown formating
7  * rules.
8  * Copyright (C) 2018 Michael Goehler
9  *
10  * This file is part of mdp.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  *
26  * function: markdown_load is the main function which reads a file handle,
27  *           and initializes deck, slides and lines
28  * function: markdown_analyse which is used to identify line wide formating
29  *           rules in given line
30  * function: markdown_debug to print a report of the generated data structure
31  * function: adjust_line_length to calculate line length excluding markup
32  * function: is_utf8 detects multi-byte char
33  * function: length_utf8 calculates the amount of bytes used for a multi-byte
34  *           char
35  * function: next_nonblank, next_blank, next_word to calculate string offset's
36  *
37  */
38
39 #include "common.h"
40 #include "markdown.h"
41 #include "cstack.h"
42
43 #if defined( CYGWIN )
44 #undef WEOF
45 #define WEOF (0xffff)
46 #endif // defined( CYGWIN )
47
48 #define EXPAND_TABS 4
49 #define CODE_INDENT 4
50 #define UNORDERED_LIST_MAX_LEVEL 3
51
52 deck_t *markdown_load(FILE *input, int noexpand);
53 int markdown_analyse(cstring_t *text, int prev);
54 void markdown_debug(deck_t *deck, int debug);
55 void expand_character_entities(line_t *line);
56 void adjust_line_length(line_t *line);
57 int next_nonblank(cstring_t *text, int i);
58 int prev_blank(cstring_t *text, int i);
59 int next_blank(cstring_t *text, int i);
60 int next_word(cstring_t *text, int i);
61 int next_nontilde(cstring_t *text, int i);
62 int next_nonbacktick(cstring_t *text, int i);
63
64 #endif // !defined( PARSER_H )