[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> autop.js (summary)

The regular expression for an HTML element.

File Size: 469 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  htmlSplit()
  replaceInHtmlTags()
  autop()
  removep()

Functions
Functions that are not part of a class:

htmlSplit(input)   X-Ref
Separate HTML elements and comments from the text.

param: {string} input The text which has to be formatted.
return: {string[]} The formatted text.

replaceInHtmlTags(haystack, replacePairs)   X-Ref
Replace characters or phrases within HTML elements only.

param: {string}                haystack     The text which has to be formatted.
param: {Record<string,string>} replacePairs In the form {from: 'to', …}.
return: {string} The formatted text.

autop(text, br = true)   X-Ref
Replaces double line-breaks with paragraph elements.

A group of regex replaces used to identify text formatted with newlines and
replace double line-breaks with HTML paragraph tags. The remaining line-
breaks after conversion become `<br />` tags, unless br is set to 'false'.

param: {string}  text The text which has to be formatted.
param: {boolean} br   Optional. If set, will convert all remaining line-
return: {string} Text which has been converted into paragraph tags.

removep(html)   X-Ref
Replaces `<p>` tags with two line breaks. "Opposite" of autop().

Replaces `<p>` tags with two line breaks except where the `<p>` has attributes.
Unifies whitespace. Indents `<li>`, `<dt>` and `<dd>` for better readability.

param: {string} html The content from the editor.
return: {string} The content with stripped paragraph tags.



Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref