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

[dump] Experiment with pre_format_hook in dump. Refs #103

This commit is contained in:
Witold Filipczyk 2021-03-07 22:07:34 +01:00
parent 4b5c9a4e21
commit f351fbcf6a
4 changed files with 11 additions and 2 deletions

View File

@ -80,7 +80,7 @@ script_hook_pre_format_html(va_list ap, void *data)
smjs_ses = ses; smjs_ses = ses;
if (have_location(ses)) { if (ses && have_location(ses)) {
struct view_state *vs = &cur_loc(ses)->vs; struct view_state *vs = &cur_loc(ses)->vs;
view_state_object = smjs_get_view_state_object(vs); view_state_object = smjs_get_view_state_object(vs);

View File

@ -553,7 +553,7 @@ add_questions_entry(void (*callback)(struct session *, void *), void *data)
} }
#ifdef CONFIG_SCRIPTING #ifdef CONFIG_SCRIPTING
static void void
maybe_pre_format_html(struct cache_entry *cached, struct session *ses) maybe_pre_format_html(struct cache_entry *cached, struct session *ses)
{ {
struct fragment *fragment; struct fragment *fragment;

View File

@ -319,6 +319,10 @@ int eat_kbd_repeat_count(struct session *ses);
* highlighting and status bar. */ * highlighting and status bar. */
int set_kbd_repeat_count(struct session *ses, int new_count); int set_kbd_repeat_count(struct session *ses, int new_count);
#ifdef CONFIG_SCRIPTING
void maybe_pre_format_html(struct cache_entry *cached, struct session *ses);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -35,6 +35,7 @@
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/uri.h" #include "protocol/uri.h"
#include "session/download.h" #include "session/download.h"
#include "session/session.h"
#include "terminal/color.h" #include "terminal/color.h"
#include "terminal/hardio.h" #include "terminal/hardio.h"
#include "terminal/terminal.h" #include "terminal/terminal.h"
@ -410,6 +411,10 @@ dump_formatted(int fd, struct download *download, struct cache_entry *cached)
o.links_numbering = get_opt_bool("document.dump.numbering", NULL); o.links_numbering = get_opt_bool("document.dump.numbering", NULL);
o.dump = 1; o.dump = 1;
#ifdef CONFIG_SCRIPTING
maybe_pre_format_html(cached, NULL);
#endif
init_vs(&vs, cached->uri, -1); init_vs(&vs, cached->uri, -1);
render_document(&vs, &formatted, &o); render_document(&vs, &formatted, &o);