Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
ffc3d729
Commit
ffc3d729
authored
Dec 22, 2001
by
Dries
Browse files
- Made some improvements to the line break filter/formater.
parent
9fa8e310
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/node.module
View file @
ffc3d729
...
...
@@ -334,8 +334,15 @@ function node_filter_link($text) {
}
function
node_filter_line
(
$text
)
{
/*
** If HTML mark-up is being used, strip regular mark-up:
** This "line break filter" will try to get the line breaks right
** regardless of the user's input. Its goal aspires a consistent
** mark-up and use of line breaks and paragraphs.
*/
/*
** If HTML mark-up is being used, strip regular line breaks:
*/
if
(
strstr
(
$text
,
"<br />"
)
||
strstr
(
$text
,
"<p>"
))
{
...
...
@@ -349,10 +356,10 @@ function node_filter_line($text) {
$text
=
eregi_replace
(
"<br>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<p>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<
br
/>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<
p
/>"
,
"
\n
"
,
$text
);
/*
** Replace
"
\r\n
"
by
"
\n
"
:
** Replace
'
\r\n
'
by
'
\n
'
:
*/
$text
=
ereg_replace
(
"
\r\n
"
,
"
\n
"
,
$text
);
...
...
@@ -365,6 +372,13 @@ function node_filter_line($text) {
$text
=
ereg_replace
(
"
\n\n\n
"
,
"
\n\n
"
,
$text
);
}
/*
** Replace some common "artifacts":
*/
$list
=
"blockquote|li|ol|ul|table|th|td|tr|pre"
;
$text
=
preg_replace
(
array
(
"/
\n
\s*<([\/])(
$list
)/"
,
"/(
$list
)>\s*
\n
/"
),
array
(
"<$1$2"
,
"$1>"
),
$text
);
return
trim
(
$text
);
}
...
...
modules/node/node.module
View file @
ffc3d729
...
...
@@ -334,8 +334,15 @@ function node_filter_link($text) {
}
function
node_filter_line
(
$text
)
{
/*
** If HTML mark-up is being used, strip regular mark-up:
** This "line break filter" will try to get the line breaks right
** regardless of the user's input. Its goal aspires a consistent
** mark-up and use of line breaks and paragraphs.
*/
/*
** If HTML mark-up is being used, strip regular line breaks:
*/
if
(
strstr
(
$text
,
"<br />"
)
||
strstr
(
$text
,
"<p>"
))
{
...
...
@@ -349,10 +356,10 @@ function node_filter_line($text) {
$text
=
eregi_replace
(
"<br>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<p>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<
br
/>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<
p
/>"
,
"
\n
"
,
$text
);
/*
** Replace
"
\r\n
"
by
"
\n
"
:
** Replace
'
\r\n
'
by
'
\n
'
:
*/
$text
=
ereg_replace
(
"
\r\n
"
,
"
\n
"
,
$text
);
...
...
@@ -365,6 +372,13 @@ function node_filter_line($text) {
$text
=
ereg_replace
(
"
\n\n\n
"
,
"
\n\n
"
,
$text
);
}
/*
** Replace some common "artifacts":
*/
$list
=
"blockquote|li|ol|ul|table|th|td|tr|pre"
;
$text
=
preg_replace
(
array
(
"/
\n
\s*<([\/])(
$list
)/"
,
"/(
$list
)>\s*
\n
/"
),
array
(
"<$1$2"
,
"$1>"
),
$text
);
return
trim
(
$text
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment