Did you know ... Search Documentation:
html_text.pl -- Render HTML as plain text
PublicShow source

This module renders HTML markup as plain text, just like the open lynx program does. It is (as yet), limited to and spacialized for dealing with the SWI-Prolog documentation. This library first of all supports help/1.

Source html_text(+Input) is det
Source html_text(+Input, +Options) is det
Render HTML from Input to current_output. Input is either an HTML DOM or a valid input for load_html/3. Options defined are:
margin_left(+N)
margin_right(+N)
Initial margins.
width(+N)
Total preceived line width.
text_align(+Align)
One of justify or left. Default is justify.
Source format_dom(+DOM, +State) is det[private]
Format the given HTML DOM to current_output according to State.
Source block_element(+El, +Attrs, -Margin, -ParOPtions, -Style)[private]
Describe a block element
Source block_words(+Content, -RestContent, -Words, +State)[private]
Turn Content into a list of words with attributes and spaces.
Source words(+Tokens, +State)//[private]
Generate a list of w(Word,Len,Attrs) and b(Len,_) terms for words and (breakable) white space.
Source join_whitespace(Elements, Joined)[private]
Join consequtive space elements into a single white space element.
Source update_style(+Style:list, +State0, -State)[private]
Add Style to the current state.
Source add1_style(+New, +Style0, -Style) is det[private]
Modify the current text style.
Source state_par_properties(+State, -ParProps)[private]
Get the paragraph shape properties from State. Eventually these two should be merged!
Source emit_block(+Words, +Options, +State) is det[private]
Format a block given Words inline elements, Options and State. Calls format_paragraph/2 after finalizing the paragraph shape and using the newline logic.
Source init_nl is det[private]
Source init_nl(-State) is det[private]
Source exit_nl(+State) is det[private]
Initialize/finalize the newline logic.
Source emit_code(+Content, +BlockAttrs, +State)[private]
Source format_table(+Content, +Attrs, +BlockAttrs, +State) is det[private]
Source column_widths(+AutoWidths, +MaxTableWidth, -Widths) is det[private]
Establish the widths of the columns. AutoWidths is a list of widths for each of the columns if no folding is applied.
 rows(+Content, -Rows) is det[private]
Source columns(+Rows, -Columns) is det[private]
Transpose the table, filling missing columns with an empty td element as needed.
Source format_row(+ColWidths, +State, +MarginLeft, +Row)[private]
Format a single row.
Source format_cells(+ColWidths, -CWSpanned, +Col0, +Row, +State, -Cells)[private]
Format the cells for Row. The resulting Cells list is a list of cells, where each cell is a list of strings, each representing a line.
Source cell_align(+Cell, -Align) is det[private]
Determine the cell alignment. Currently supports the (deprecated) HTML4 align=Align possibility and very naively parsed CSS text-align:center, etc.
Source format_cell_to_string(+Cell, +ColWidth, +State, -String) is det[private]
Format Cell to a String, given the state and column width.
Source emit_hr(+Attrs, +BlockOptions, +State)[private]
Emit a horizontal rule.

Re-exported predicates

The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.

Source html_text(+Input) is det
Source html_text(+Input, +Options) is det
Render HTML from Input to current_output. Input is either an HTML DOM or a valid input for load_html/3. Options defined are:
margin_left(+N)
margin_right(+N)
Initial margins.
width(+N)
Total preceived line width.
text_align(+Align)
One of justify or left. Default is justify.