attribute nobreak_regex

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

A hash which holds the regular expressions on which spaces should not be broken. The hash is set up such that the key is the first word and the value is the second word.

For example, if nobreak_regex contains the following hash:

{ '^Mrs?\.$' => '\S+$', '^\S+$' => '^(?:S|J)r\.$'}

Then “Mr. Jones”, “Mrs. Jones”, and “Jones Jr.” would not be broken. If this simple matching algorithm indicates that there should not be a break at the current end of line, then a backtrack is done until there are two words on which line breaking is permitted. If two such words are not found, then the end of the line will be broken regardless. If there is a single word on the current line, then no backtrack is done and the word is stuck on the end.

Default

{}

Used in

#format, #paragraphs

Type at least 2 characters to search.

↑↓ navigate · open · esc close