You are here

function entity2text_block_hmlt_entities_to_nl in Entity To Text 7

Converts block / line wrapping html elements to breaks.

Parameters

string $text: The text to process.

string $indent_text: The indent text.

Return value

string The processed text.

1 call to entity2text_block_hmlt_entities_to_nl()
entity2text_renderarray_to_text in ./entity2text.module

File

./entity2text.module, line 151

Code

function entity2text_block_hmlt_entities_to_nl($text, $indent_text = '') {

  // Replace tags where nesting should only cause one break.
  $text = preg_replace('/(\\<(\\/\\s*(div|dd|dl|article|figure|aside|footer|ol|output|audio|form|blockquote|canvas|section|hgroup|tfoot|main|nav|video|figcaption))(\\s*)?\\/?\\>)+/i', "\n" . $indent_text, $text);

  // Replace tags where a tag always creates a break.
  $text = preg_replace('/\\<(br|hr|\\/\\s*(fieldset|ul|table|pre|h1|h2|h3|h4|h5|h6))(\\s*)?\\/?\\>/i', "\n" . $indent_text, $text);
  return $text;
}