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
|
2004-03-11 05:19:14 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libxml/HTMLparser.h"
|
2004-03-11 05:19:14 +03:00
|
|
|
#include "netsurf/content/content.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
#include "netsurf/render/html.h"
|
|
|
|
#include "netsurf/render/textplain.h"
|
|
|
|
|
|
|
|
|
|
|
|
static const char header[] = "<html><body><pre>";
|
|
|
|
static const char footer[] = "</pre></body></html>";
|
|
|
|
|
|
|
|
|
2004-06-11 00:41:26 +04:00
|
|
|
bool textplain_create(struct content *c, const char *params[])
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
2004-06-11 00:41:26 +04:00
|
|
|
if (!html_create(c, params))
|
|
|
|
/* html_create() must have broadcast MSG_ERROR already, so we
|
|
|
|
* don't need to. */
|
|
|
|
return false;
|
2003-03-15 18:53:20 +03:00
|
|
|
htmlParseChunk(c->data.html.parser, header, sizeof(header) - 1, 0);
|
2004-06-11 00:41:26 +04:00
|
|
|
return true;
|
2003-02-09 15:58:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-11 00:41:26 +04:00
|
|
|
bool textplain_convert(struct content *c, int width, int height)
|
2003-02-09 15:58:15 +03:00
|
|
|
{
|
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);
|
|
|
|
}
|