fix #78 not use short-tags.
This commit is contained in:
parent
3d41f036da
commit
7c88be3211
@ -43,8 +43,7 @@ func (p *Printer) SetState(s printerState) {
|
|||||||
func (p *Printer) Print(n node.Node) {
|
func (p *Printer) Print(n node.Node) {
|
||||||
_, isRoot := n.(*node.Root)
|
_, isRoot := n.(*node.Root)
|
||||||
_, isInlineHtml := n.(*stmt.InlineHtml)
|
_, isInlineHtml := n.(*stmt.InlineHtml)
|
||||||
_, isEcho := n.(*stmt.Echo)
|
if p.s == HtmlState && !isInlineHtml && !isRoot {
|
||||||
if p.s == HtmlState && !isInlineHtml && !isRoot && !isEcho {
|
|
||||||
if n.GetFreeFloating().IsEmpty() {
|
if n.GetFreeFloating().IsEmpty() {
|
||||||
io.WriteString(p.w, "<?php ")
|
io.WriteString(p.w, "<?php ")
|
||||||
}
|
}
|
||||||
@ -2433,21 +2432,13 @@ func (p *Printer) printStmtDo(n node.Node) {
|
|||||||
|
|
||||||
func (p *Printer) printStmtEcho(n node.Node) {
|
func (p *Printer) printStmtEcho(n node.Node) {
|
||||||
nn := n.(*stmt.Echo)
|
nn := n.(*stmt.Echo)
|
||||||
|
if nn.GetFreeFloating().IsEmpty() {
|
||||||
if p.s == HtmlState {
|
io.WriteString(p.w, "echo")
|
||||||
if nn.GetFreeFloating().IsEmpty() {
|
|
||||||
io.WriteString(p.w, "<?=")
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SetState(PhpState)
|
|
||||||
} else {
|
|
||||||
if nn.GetFreeFloating().IsEmpty() {
|
|
||||||
io.WriteString(p.w, "echo")
|
|
||||||
}
|
|
||||||
if nn.Exprs[0].GetFreeFloating().IsEmpty() {
|
|
||||||
io.WriteString(p.w, " ")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if nn.Exprs[0].GetFreeFloating().IsEmpty() {
|
||||||
|
io.WriteString(p.w, " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
p.printFreeFloating(nn, freefloating.Start)
|
p.printFreeFloating(nn, freefloating.Start)
|
||||||
p.printFreeFloating(nn, freefloating.Echo)
|
p.printFreeFloating(nn, freefloating.Echo)
|
||||||
|
Loading…
Reference in New Issue
Block a user