Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
504f84ec
Commit
504f84ec
authored
Aug 10, 2013
by
Thomas Bachem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed stripping of newlines at the very beginning of block tags
Original issue:
http://bugs.dwoo.org/dwoo/bugs/issue/89
parent
1933f55c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
Compiler.php
lib/Dwoo/Compiler.php
+4
-11
No files found.
lib/Dwoo/Compiler.php
View file @
504f84ec
...
...
@@ -817,17 +817,6 @@ class Dwoo_Compiler implements Dwoo_ICompiler
break
;
}
}
// adds additional line breaks between php closing and opening tags because the php parser removes those if there is just a single line break
if
(
substr
(
$this
->
curBlock
[
'buffer'
],
-
2
)
===
'?>'
&&
preg_match
(
'{^(([\r\n])([\r\n]?))}'
,
substr
(
$tpl
,
$ptr
,
3
),
$m
))
{
if
(
$m
[
3
]
===
''
)
{
$ptr
+=
1
;
$this
->
push
(
$m
[
1
]
.
$m
[
1
],
1
);
}
else
{
$ptr
+=
2
;
$this
->
push
(
$m
[
1
]
.
"
\n
"
,
2
);
}
}
}
}
...
...
@@ -903,6 +892,10 @@ class Dwoo_Compiler implements Dwoo_ICompiler
// handle <?xml tag at the beginning
$output
=
preg_replace
(
'#(/\* template body \*/ \?>\s*)<\?xml#is'
,
'$1<?php echo \'<?xml\'; ?>'
,
$output
);
// add another line break after PHP closing tags that have a line break following,
// as we do not know whether it's intended, and PHP will strip it otherwise
$output
=
preg_replace
(
'/(?<!"|<\?xml)\s*\?>\n/'
,
'$0'
.
"
\n
"
,
$output
);
if
(
$this
->
debug
)
{
echo
'<hr><pre>'
;
$lines
=
preg_split
(
'{\r\n|\n|<br />}'
,
highlight_string
((
$output
),
true
));
...
...
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