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

[test] align.html is displayable

This commit is contained in:
Witold Filipczyk 2021-06-23 20:42:58 +02:00
parent 16c6926990
commit 705cd7f113
3 changed files with 69 additions and 50 deletions

View File

@ -62,13 +62,6 @@ enum link_state {
LINK_STATE_SAME,
};
struct link_state_info {
char *link;
char *target;
char *image;
struct el_form_control *form;
};
struct table_cache_entry_key {
char *start;
char *end;
@ -93,35 +86,6 @@ struct table_cache_entry {
static int table_cache_entries;
static struct hash *table_cache;
struct renderer_context {
int last_link_to_move;
struct tag *last_tag_to_move;
/* All tags between document->tags and this tag (inclusive) should
* be aligned to the next line break, unless some real content follows
* the tag. Therefore, this virtual tags list accumulates new tags as
* they arrive and empties when some real content is written; if a line
* break is inserted in the meanwhile, the tags follow it (ie. imagine
* <a name="x"> <p>, then the "x" tag follows the line breaks inserted
* by the <p> tag). */
struct tag *last_tag_for_newline;
struct link_state_info link_state_info;
struct conv_table *convert_table;
/* Used for setting cache info from HTTP-EQUIV meta tags. */
struct cache_entry *cached;
int g_ctrl_num;
int subscript; /* Count stacked subscripts */
int supscript; /* Count stacked supscripts */
unsigned int empty_format:1;
unsigned int nobreak:1;
unsigned int nosearchable:1;
unsigned int nowrap:1; /* Activated/deactivated by SP_NOWRAP. */
};
struct renderer_context renderer_context;
/* Prototypes */

View File

@ -62,6 +62,44 @@ struct part {
unsigned int begin:1;
};
struct link_state_info {
char *link;
char *target;
char *image;
struct el_form_control *form;
};
struct renderer_context {
int last_link_to_move;
struct tag *last_tag_to_move;
/* All tags between document->tags and this tag (inclusive) should
* be aligned to the next line break, unless some real content follows
* the tag. Therefore, this virtual tags list accumulates new tags as
* they arrive and empties when some real content is written; if a line
* break is inserted in the meanwhile, the tags follow it (ie. imagine
* <a name="x"> <p>, then the "x" tag follows the line breaks inserted
* by the <p> tag). */
struct tag *last_tag_for_newline;
struct link_state_info link_state_info;
struct conv_table *convert_table;
/* Used for setting cache info from HTTP-EQUIV meta tags. */
struct cache_entry *cached;
int g_ctrl_num;
int subscript; /* Count stacked subscripts */
int supscript; /* Count stacked supscripts */
unsigned int empty_format:1;
unsigned int nobreak:1;
unsigned int nosearchable:1;
unsigned int nowrap:1; /* Activated/deactivated by SP_NOWRAP. */
};
extern struct renderer_context renderer_context;
void expand_lines(struct html_context *html_context, struct part *part,
int x, int y, int lines, color_T bgcolor);
void check_html_form_hierarchy(struct part *part);

View File

@ -296,6 +296,13 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
if (!document->dom) {
document->dom = document_parse(document);
}
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) {
@ -313,23 +320,33 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
html_special);
if (!html_context) return;
/// renderer_context.g_ctrl_num = 0;
/// renderer_context.cached = cached;
/// renderer_context.convert_table = get_convert_table(head.source,
/// document->options.cp,
/// document->options.assume_cp,
/// &document->cp,
/// &document->cp_status,
/// document->options.hard_assume);
if (document) {
struct node *node = mem_alloc(sizeof(*node));
struct conv_table *convert_table = get_convert_table(head.source,
if (node) {
int node_width = INT_MAX ;///!html_context->table_level ? INT_MAX : width;
set_box(&node->box, 0 /*x*/, 0 /*y*/, node_width, 1);
add_to_list(document->nodes, node);
}
renderer_context.last_link_to_move = document->nlinks;
renderer_context.last_tag_to_move = (struct tag *) &document->tags;
renderer_context.last_tag_for_newline = (struct tag *) &document->tags;
} else {
renderer_context.last_link_to_move = 0;
renderer_context.last_tag_to_move = (struct tag *) NULL;
renderer_context.last_tag_for_newline = (struct tag *) NULL;
}
renderer_context.g_ctrl_num = 0;
renderer_context.cached = cached;
renderer_context.convert_table = get_convert_table(head.source,
document->options.cp,
document->options.assume_cp,
document->options.assume_cp,
&document->cp,
&document->cp_status,
document->options.hard_assume);;
document->options.hard_assume);
#ifdef CONFIG_UTF8
html_context->options->utf8 = is_cp_utf8(document->options.cp);
@ -339,7 +356,7 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
if (title.length) {
/* CSM_DEFAULT because init_html_parser() did not
* decode entities in the title. */
document->title = convert_string(convert_table,
document->title = convert_string(renderer_context.convert_table,
title.source, title.length,
document->options.cp,
CSM_DEFAULT, NULL, NULL, NULL);