NetSurf
Data Structures | Enumerations | Functions
save_text.h File Reference

Text export of HTML (interface). More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  save_text_state
 

Enumerations

enum  save_text_whitespace { WHITESPACE_NONE , WHITESPACE_TAB , WHITESPACE_ONE_NEW_LINE , WHITESPACE_TWO_NEW_LINES }
 

Functions

void save_as_text (struct hlcache_handle *c, char *path)
 Extract the text from an HTML content and save it as a text file. More...
 
void save_text_solve_whitespace (struct box *box, bool *first, save_text_whitespace *before, const char **whitespace_text, size_t *whitespace_length)
 Decide what whitespace to place before the next bit of content-related text that is saved. More...
 

Detailed Description

Text export of HTML (interface).

Definition in file save_text.h.

Enumeration Type Documentation

◆ save_text_whitespace

Enumerator
WHITESPACE_NONE 
WHITESPACE_TAB 
WHITESPACE_ONE_NEW_LINE 
WHITESPACE_TWO_NEW_LINES 

Definition at line 37 of file save_text.h.

Function Documentation

◆ save_as_text()

void save_as_text ( struct hlcache_handle c,
char *  path 
)

Extract the text from an HTML content and save it as a text file.

Text is converted to the local encoding.

Parameters
cAn HTML content.
pathPath to save text file too.

Definition at line 57 of file save_text.c.

References save_text_state::block, content_get_type(), CONTENT_HTML, extract_text(), guit, html_get_box_tree(), save_text_state::length, NSERROR_OK, NSLOG, path(), result, netsurf_table::utf8, gui_utf8_table::utf8_to_local, and WHITESPACE_NONE.

Referenced by ami_file_save(), plaintext_button_clicked_cb(), and ro_gui_save_content().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_text_solve_whitespace()

void save_text_solve_whitespace ( struct box box,
bool *  first,
save_text_whitespace before,
const char **  whitespace_text,
size_t *  whitespace_length 
)

Decide what whitespace to place before the next bit of content-related text that is saved.

Any existing whitespace is overridden if the whitespace for this box is more "significant".

Parameters
boxPointer to box.
firstWhether this is before the first bit of content-related text to be saved.
beforeType of whitespace currently intended to be placed before the next bit of content-related text to be saved. Updated if this box is worthy of more significant whitespace.
whitespace_textWhitespace to place before next bit of content-related text to be saved. Updated if this box is worthy of more significant whitespace.
whitespace_lengthLength of whitespace_text. Updated if this box is worthy of more significant whitespace.

Definition at line 125 of file save_text.c.

References BOX_BLOCK, BOX_BR, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, BOX_INLINE, BOX_INLINE_CONTAINER, BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, box::list_marker, box::parent, box::style, box::type, WHITESPACE_NONE, WHITESPACE_ONE_NEW_LINE, WHITESPACE_TAB, and WHITESPACE_TWO_NEW_LINES.

Referenced by extract_text(), and selection_copy().

Here is the caller graph for this function: