[][src]Trait html2text::render::Renderer

pub trait Renderer {
    fn add_empty_line(&mut self);
fn new_sub_renderer(&self, width: usize) -> Self;
fn start_block(&mut self);
fn end_block(&mut self);
fn new_line(&mut self);
fn new_line_hard(&mut self);
fn add_horizontal_border(&mut self);
fn start_pre(&mut self);
fn end_pre(&mut self);
fn add_inline_text(&mut self, text: &str);
fn width(&self) -> usize;
fn add_block_line(&mut self, line: &str);
fn append_subrender<'a, I>(&mut self, other: Self, prefixes: I)
    where
        I: Iterator<Item = &'a str>
;
fn append_columns_with_borders<I>(&mut self, cols: I, collapse: bool)
    where
        I: IntoIterator<Item = Self>,
        Self: Sized
;
fn empty(&self) -> bool;
fn text_len(&self) -> usize;
fn start_link(&mut self, target: &str);
fn end_link(&mut self);
fn start_emphasis(&mut self);
fn end_emphasis(&mut self);
fn start_strong(&mut self);
fn end_strong(&mut self);
fn start_strikeout(&mut self);
fn end_strikeout(&mut self);
fn start_code(&mut self);
fn end_code(&mut self);
fn add_image(&mut self, title: &str);
fn record_frag_start(&mut self, fragname: &str); }

A type which is a backend for HTML to text rendering.

Required methods

fn add_empty_line(&mut self)

Add an empty line to the output (ie between blocks).

fn new_sub_renderer(&self, width: usize) -> Self

Create a sub-renderer for nested blocks.

fn start_block(&mut self)

Start a new block.

fn end_block(&mut self)

Mark the end of a block.

fn new_line(&mut self)

Start a new line, if necessary (but don't add a new line).

fn new_line_hard(&mut self)

Start a new line.

fn add_horizontal_border(&mut self)

Add a horizontal table border.

fn start_pre(&mut self)

Begin a preformatted block. Until the corresponding end, whitespace will used verbatim. Pre regions can nest.

fn end_pre(&mut self)

Finish a preformatted block started with start_pre.

fn add_inline_text(&mut self, text: &str)

Add some inline text (which should be wrapped at the appropriate width) to the current block.

fn width(&self) -> usize

Return the current width in character cells

fn add_block_line(&mut self, line: &str)

Add a line to the current block without starting a new one.

fn append_subrender<'a, I>(&mut self, other: Self, prefixes: I) where
    I: Iterator<Item = &'a str>, 

Add a new block from a sub renderer, and prefix every line by the corresponding text from each iteration of prefixes.

fn append_columns_with_borders<I>(&mut self, cols: I, collapse: bool) where
    I: IntoIterator<Item = Self>,
    Self: Sized

Append a set of sub renderers joined left-to-right with a vertical line, and add a horizontal line below. If collapse is true, then merge top/bottom borders of the subrenderer with the surrounding one.

fn empty(&self) -> bool

Returns true if this renderer has no content.

fn text_len(&self) -> usize

Return the length of the contained text.

Start a hyperlink TODO: return sub-builder or similar to make misuse of start/link harder?

Finish a hyperlink started earlier.

fn start_emphasis(&mut self)

Start an emphasised region

fn end_emphasis(&mut self)

Finish emphasised text started earlier.

fn start_strong(&mut self)

Start a strong region

fn end_strong(&mut self)

Finish strong text started earlier.

fn start_strikeout(&mut self)

Start a strikeout region

fn end_strikeout(&mut self)

Finish strikeout text started earlier.

fn start_code(&mut self)

Start a code region

fn end_code(&mut self)

End a code region

fn add_image(&mut self, title: &str)

Add an image

fn record_frag_start(&mut self, fragname: &str)

Record the start of a named HTML fragment

Loading content...

Implementors

impl<D: TextDecorator> Renderer for TextRenderer<D>[src]

Loading content...