1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

[xml] missing files

This commit is contained in:
Witold Filipczyk 2021-11-22 09:50:57 +01:00
parent 14e60c35ab
commit 4617d7d8ef
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,64 @@
/* Plain text document renderer */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "bookmarks/bookmarks.h"
#include "cache/cache.h"
#include "config/options.h"
#include "document/docdata.h"
#include "document/document.h"
#include "document/format.h"
#include "document/options.h"
#include "document/plain/renderer.h"
#include "document/xml/renderer.h"
#include "document/renderer.h"
#ifdef CONFIG_ECMASCRIPT
#include "ecmascript/ecmascript.h"
#endif
#include "globhist/globhist.h"
#include "intl/charsets.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "terminal/color.h"
#include "terminal/draw.h"
#include "util/color.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
#include <libxml++/libxml++.h>
#include <string>
void
render_source_document_cxx(struct cache_entry *cached, struct document *document,
struct string *buffer)
{
char *head = empty_string_or_(cached->head);
(void)get_convert_table(head, document->options.cp,
document->options.assume_cp,
&document->cp,
&document->cp_status,
document->options.hard_assume);
if (!document->dom) {
document->dom = document_parse(document);
}
if (document->dom) {
xmlpp::Document *docu = document->dom;
xmlpp::ustring text = docu->write_to_string_formatted(get_cp_mime_name(document->cp));
struct string tt;
init_string(&tt);
add_bytes_to_string(&tt, text.c_str(), text.size());
render_plain_document(cached, document, &tt);
done_string(&tt);
}
}

View File

@ -0,0 +1,18 @@
#ifndef EL__DOCUMENT_XML_RENDERER_H
#define EL__DOCUMENT_XML_RENDERER_H
#ifdef __cplusplus
extern "C" {
#endif
struct cache_entry;
struct document;
struct string;
void render_source_document_cxx(struct cache_entry *cached, struct document *document, struct string *buffer);
#ifdef __cplusplus
}
#endif
#endif