Statistics
| Revision:

root / libsylph / html.h @ 3252

History | View | Annotate | Download (1.74 KB)

1
/*
2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19

    
20
#ifndef __HTML_H__
21
#define __HTML_H__
22

    
23
#include <glib.h>
24
#include <stdio.h>
25

    
26
#include "codeconv.h"
27

    
28
typedef enum
29
{
30
        HTML_NORMAL,
31
        HTML_PAR,
32
        HTML_BR,
33
        HTML_HR,
34
        HTML_HREF,
35
        HTML_IMG,
36
        HTML_FONT,
37
        HTML_PRE,
38
        HTML_UNKNOWN,
39
        HTML_CONV_FAILED,
40
        HTML_ERR,
41
        HTML_EOF,
42
        HTML_BLOCKQUOTE
43
} HTMLState;
44

    
45
typedef struct _HTMLParser        HTMLParser;
46
typedef struct _HTMLAttr        HTMLAttr;
47
typedef struct _HTMLTag                HTMLTag;
48

    
49
struct _HTMLParser
50
{
51
        FILE *fp;
52
        CodeConverter *conv;
53

    
54
        GHashTable *symbol_table;
55

    
56
        GString *str;
57
        GString *buf;
58

    
59
        gchar *bufp;
60

    
61
        HTMLState state;
62

    
63
        gchar *href;
64

    
65
        gboolean newline;
66
        gboolean empty_line;
67
        gboolean space;
68
        gboolean pre;
69
        gint blockquote;
70
};
71

    
72
struct _HTMLAttr
73
{
74
        gchar *name;
75
        gchar *value;
76
};
77

    
78
struct _HTMLTag
79
{
80
        gchar *name;
81
        GList *attr;
82
};
83

    
84
HTMLParser *html_parser_new        (FILE                *fp,
85
                                 CodeConverter        *conv);
86
void html_parser_destroy        (HTMLParser        *parser);
87
const gchar *html_parse                (HTMLParser        *parser);
88

    
89
#endif /* __HTML_H__ */