Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
b8ab73c2
Commit
b8ab73c2
authored
Aug 17, 2009
by
Richard Mansfield
Browse files
Fix for blockquote line breaks
parent
913a9122
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/htmltotext/htmltotext.php
View file @
b8ab73c2
...
...
@@ -43,8 +43,7 @@ class HtmltoText {
$doc
->
loadHTML
(
$html
);
$this
->
body
=
$doc
->
getElementsByTagName
(
'html'
)
->
item
(
0
)
->
getElementsByTagName
(
'body'
)
->
item
(
0
);
$this
->
lines
=
array
();
$this
->
line
=
(
object
)
array
(
'text'
=>
''
,
'wrap'
=>
true
);
$this
->
prefix
=
''
;
$this
->
line
=
(
object
)
array
(
'text'
=>
''
,
'wrap'
=>
true
,
'prefix'
=>
"
\n
"
);
$this
->
pre
=
0
;
$this
->
indent
=
array
();
$this
->
baseurl
=
$baseurl
;
...
...
@@ -82,7 +81,7 @@ class HtmltoText {
private
function
wrap_line
()
{
if
(
$this
->
line
->
wrap
)
{
$this
->
lines
[]
=
wordwrap
(
$this
->
line
->
text
,
75
,
$this
->
prefix
);
$this
->
lines
[]
=
wordwrap
(
$this
->
line
->
text
,
75
,
$this
->
line
->
prefix
);
}
else
{
$this
->
lines
[]
=
$this
->
line
->
text
;
...
...
@@ -105,18 +104,19 @@ class HtmltoText {
private
function
output
(
$str
,
$wrap
=
true
)
{
if
(
$this
->
newlines
)
{
$this
->
wrap_line
();
$this
->
prefix
=
"
\n
"
;
$this
->
line
=
(
object
)
array
(
'text'
=>
str_repeat
(
"
\n
"
,
$this
->
newlines
-
1
),
'wrap'
=>
$wrap
);
$this
->
line
=
(
object
)
array
(
'text'
=>
''
,
'wrap'
=>
$wrap
,
'prefix'
=>
"
\n
"
);
$totalindents
=
count
(
$this
->
indent
);
if
(
$totalindents
)
{
$this
->
prefix
.
=
' '
;
$this
->
line
->
text
.
=
' '
;
for
(
$i
=
0
;
$i
<
$totalindents
-
1
;
$i
++
)
{
$this
->
line
->
text
.
=
$this
->
indentchar
[
$this
->
indent
[
$i
]];
}
$this
->
prefix
.
=
$this
->
line
->
text
.
$this
->
indentchar
[
$this
->
indent
[
$i
]];
$this
->
line
->
prefix
.
=
$this
->
line
->
text
.
$this
->
indentchar
[
$this
->
indent
[
$i
]];
$this
->
line
->
text
.
=
$this
->
indentfirstchar
[
$this
->
indent
[
$i
]];
}
if
(
$this
->
newlines
==
2
)
{
$this
->
line
->
text
=
"
\n
"
.
$this
->
line
->
text
;
}
$this
->
newlines
=
0
;
}
$this
->
line
->
text
.
=
$str
;
...
...
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