0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

[tables] Change of mind. Just render whole document with old renderer.

This commit is contained in:
Witold Filipczyk 2021-07-16 19:52:31 +02:00
parent 33fc1beefd
commit 782b4e00f0
5 changed files with 35 additions and 8 deletions

View File

@ -305,11 +305,6 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
add_to_string(&head, "\r\nContent-Type: text/html; charset=utf-8\r\n");
struct tag *saved_last_tag_to_move = renderer_context.last_tag_to_move;
int saved_empty_format = renderer_context.empty_format;
/// int saved_margin = html_context->margin;
int saved_last_link_to_move = renderer_context.last_link_to_move;
xmlpp::Document *doc = document->dom;
if (!buffer) {
@ -321,6 +316,18 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
start = buffer->source;
end = buffer->source + buffer->length;
mem_free_set(&cached->head, head.source);
render_html_document(cached, document, buffer);
return;
struct tag *saved_last_tag_to_move = renderer_context.last_tag_to_move;
int saved_empty_format = renderer_context.empty_format;
/// int saved_margin = html_context->margin;
int saved_last_link_to_move = renderer_context.last_link_to_move;
html_context = init_html_parser(cached->uri, &document->options,
start, end, &head, &title,
put_chars_conv, line_break,

View File

@ -30,6 +30,7 @@
#include "document/xml/renderer2.h"
#include "document/xml/tables.h"
#include "document/xml/tags.h"
#include "ecmascript/spidermonkey/element.h"
#include "globhist/globhist.h"
#include "intl/charsets.h"
#include "protocol/uri.h"
@ -848,6 +849,19 @@ tags_format_table(struct source_renderer *renderer, void *no)
struct html_element *state;
int indent, margins;
struct string html_string;
init_string(&html_string);
walk_tree(&html_string, no, false);
char *attr = html_string.source + 1;
char *html = html_string.source;
char *eof = html_string.source + html_string.length;
char *end;
format_table(attr, html, eof, &end, html_context);
// done_string(&html_string);
#if 0
html_context->table_level++;
table = tags_parse_table(renderer, no, (part->document || part->box.x));
@ -923,4 +937,6 @@ ret2:
ret0:
html_context->table_level--;
if (!html_context->table_level) free_table_cache();
#endif
}

View File

@ -3766,7 +3766,7 @@ tags_html_table(struct source_renderer *renderer, void *no, unsigned char *attr,
{
struct html_context *html_context = renderer->html_context;
xmlpp::Element *node = no;
if (false && html_context->options->tables
if (html_context->options->tables
&& html_context->table_level < HTML_MAX_TABLE_LEVEL) {
tags_format_table(renderer, no);
ln_break(html_context, 2);

View File

@ -1297,9 +1297,11 @@ dump_element(struct string *buf, xmlpp::Element *element, bool toSort = false)
add_char_to_string(buf, '>');
}
static void
walk_tree(struct string *buf, xmlpp::Node *node, bool start = true, bool toSortAttrs = false)
void
walk_tree(struct string *buf, void *nod, bool start = true, bool toSortAttrs = false)
{
xmlpp::Node *node = nod;
if (!start) {
const auto textNode = dynamic_cast<const xmlpp::ContentNode*>(node);

View File

@ -13,4 +13,6 @@ JSObject *getAttributes(JSContext *ctx, void *node);
JSObject *getAttr(JSContext *ctx, void *node);
JSObject *getNodeList(JSContext *ctx, void *node);
void walk_tree(struct string *buf, void *nod, bool start = true, bool toSortAttrs = false);
#endif