A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.rubydoc.info/github/teamcapybara/capybara/Capybara/Node/WhitespaceNormalizer below:

WhitespaceNormalizer – Documentation for teamcapybara/capybara (master) – RubyDoc.info

Module: Capybara::Node::WhitespaceNormalizer Overview

WhitespaceNormalizer provides methods that help to normalize the spacing of text content inside of Elements by removing various unicode spacing and directional markings.

Constant Summary collapse
NON_BREAKING_SPACE =
"\u00a0"
LINE_SEPERATOR =
"\u2028"
PARAGRAPH_SEPERATOR =
"\u2029"
BREAKING_SPACES =

All spaces except for NBSP

"[[:space:]&&[^#{NON_BREAKING_SPACE}]]".freeze
SQUEEZED_SPACES =

Whitespace we want to substitute with plain spaces

" \n\f\t\v#{LINE_SEPERATOR}#{PARAGRAPH_SEPERATOR}".freeze
LEADING_SPACES =

Any whitespace at the front of text

/\A#{BREAKING_SPACES}+/
TRAILING_SPACES =

Any whitespace at the end of text

/#{BREAKING_SPACES}+\z/
ZERO_WIDTH_SPACE =

"Invisible" space character

"\u200b"
LEFT_TO_RIGHT_MARK =

Signifies text is read left to right

"\u200e"
RIGHT_TO_LEFT_MARK =

Signifies text is read right to left

"\u200f"
REMOVED_CHARACTERS =

Characters we want to truncate from text

[ZERO_WIDTH_SPACE, LEFT_TO_RIGHT_MARK, RIGHT_TO_LEFT_MARK].join
EMPTY_LINES =

Matches multiple empty lines

/[\ \n]*\n[\ \n]*/
Instance Method Summary collapse Instance Method Details #normalize_spacing(text) ⇒ String

Normalizes the spacing of a node's text to be similar to what matchers might expect.

#normalize_visible_spacing(text) ⇒ String

Variant on Normalizer#normalize_spacing that targets the whitespace of visible elements only.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4