Class HTML::Pipeline::EmailReplyFilter
In: lib/html/pipeline/email_reply_filter.rb
Parent: TextFilter

HTML Filter that converts email reply text into an HTML DocumentFragment. It must be used as the first filter in a pipeline.

Context options:

  None

This filter does not write any additional information to the context hash.

Methods

call  

Included Modules

EscapeUtils

Constants

EMAIL_HIDDEN_HEADER = %(<span class="email-hidden-toggle"><a href="#">&hellip;</a></span><div class="email-hidden-reply" style="display:none">).freeze
EMAIL_QUOTED_HEADER = %(<div class="email-quoted-reply">).freeze
EMAIL_SIGNATURE_HEADER = %(<div class="email-signature-reply">).freeze
EMAIL_FRAGMENT_HEADER = %(<div class="email-fragment">).freeze
EMAIL_HEADER_END = '</div>'.freeze
EMAIL_REGEX = /[^@\s.][^@\s]*@\[?[a-z0-9.-]+\]?/
HIDDEN_EMAIL_PATTERN = '***@***.***'.freeze

Public Instance methods

Scans an email body to determine which bits are quoted and which should be hidden. EmailReplyParser is used to split the comment into an Array of quoted or unquoted Blocks. Now, we loop through them and attempt to add <div> tags around them so we can hide the hidden blocks, and style the quoted blocks differently. Since multiple blocks may be hidden, be sure to keep the "email-hidden-reply" <div>s around "email-quoted-reply" <div> tags. Call this on each comment of a visible thread in the order that they are displayed. Note: all comments are processed so we can maintain a Set of SHAs of paragraphs. Only plaintext comments skip the markdown step.

Returns the email comment HTML as a String

[Validate]