2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "libxml/HTMLparser.h"
|
|
|
|
#include "netsurf/render/html.h"
|
|
|
|
#include "netsurf/render/textplain.h"
|
2003-03-15 18:53:20 +03:00
|
|
|
#include "netsurf/utils/log.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
static const char header[] = "<html><body><pre>";
|
|
|
|
static const char footer[] = "</pre></body></html>";
|
|
|
|
|
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
void textplain_create(struct content *c, const char *params[])
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
2003-12-27 23:15:23 +03:00
|
|
|
html_create(c, params);
|
2003-03-15 18:53:20 +03:00
|
|
|
htmlParseChunk(c->data.html.parser, header, sizeof(header) - 1, 0);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void textplain_process_data(struct content *c, char *data, unsigned long size)
|
|
|
|
{
|
|
|
|
html_process_data(c, data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int textplain_convert(struct content *c, unsigned int width, unsigned int height)
|
|
|
|
{
|
2003-03-15 18:53:20 +03:00
|
|
|
htmlParseChunk(c->data.html.parser, footer, sizeof(footer) - 1, 0);
|
2003-02-26 00:00:27 +03:00
|
|
|
c->type = CONTENT_HTML;
|
2003-02-09 15:58:15 +03:00
|
|
|
return html_convert(c, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void textplain_revive(struct content *c, unsigned int width, unsigned int height)
|
|
|
|
{
|
2003-02-26 00:00:27 +03:00
|
|
|
assert(0);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void textplain_reformat(struct content *c, unsigned int width, unsigned int height)
|
|
|
|
{
|
2003-02-26 00:00:27 +03:00
|
|
|
assert(0);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void textplain_destroy(struct content *c)
|
|
|
|
{
|
2003-09-22 02:46:17 +04:00
|
|
|
html_destroy(c);
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|