1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[libdom] For parsed document separate function: dump_xhtml

This commit is contained in:
Witold Filipczyk 2023-09-23 19:28:28 +02:00
parent b3e77ef53e
commit 773ac97e1b
3 changed files with 14 additions and 11 deletions

View File

@ -261,11 +261,6 @@ walk_tree(void *mapa, void *mapa_rev, struct string *buf, dom_node *node, bool s
void void
render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer) render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer)
{ {
dom_exception exc; /* returned by libdom functions */
dom_document *doc = NULL; /* document, loaded into libdom */
dom_node *root = NULL; /* root element of document */
void *mapa = NULL;
void *mapa_rev = NULL;
static int initialised = 0; static int initialised = 0;
int first = 0; int first = 0;
@ -292,6 +287,17 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
document->dom = document_parse(document, buffer); document->dom = document_parse(document, buffer);
first = 1; first = 1;
} }
dump_xhtml(cached, document);
}
void
dump_xhtml(struct cache_entry *cached, struct document *document)
{
dom_exception exc; /* returned by libdom functions */
dom_document *doc = NULL; /* document, loaded into libdom */
dom_node *root = NULL; /* root element of document */
void *mapa = NULL;
void *mapa_rev = NULL;
if (!document->dom) { if (!document->dom) {
return; return;
@ -312,7 +318,7 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
return; return;
} }
if (first) { if (1) {
struct string tt; struct string tt;
if (!init_string(&tt)) { if (!init_string(&tt)) {
@ -346,6 +352,4 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
render_html_document(cached, document, &tt); render_html_document(cached, document, &tt);
return; return;
} }
dom_node_unref(root);
render_html_document(cached, document, buffer);
} }

View File

@ -10,7 +10,7 @@ struct document;
struct string; struct string;
void render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer); void render_xhtml_document(struct cache_entry *cached, struct document *document, struct string *buffer);
void dump_xhtml(struct cache_entry *cached, struct document *document);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -309,11 +309,10 @@ static void
delayed_reload(void *data) delayed_reload(void *data)
{ {
struct delayed_rel *rel = (struct delayed_rel *)data; struct delayed_rel *rel = (struct delayed_rel *)data;
struct string buffer = INIT_STRING("", 0);
assert(rel); assert(rel);
reset_document(rel->document); reset_document(rel->document);
render_xhtml_document(rel->cached, rel->document, &buffer); dump_xhtml(rel->cached, rel->document);
sort_links(rel->document); sort_links(rel->document);
draw_formatted(rel->ses, 0); draw_formatted(rel->ses, 0);
mem_free(rel); mem_free(rel);