Skip to content

Commit

Permalink
fix: remove <!--s-text--><!--/s-text--> when noDataOutput is true, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
l5oo00 authored and harttle committed Nov 14, 2019
1 parent ce37d16 commit c05ef7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/target-js/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export class ANodeCompiler {
*/
compileText (aNode: ANode, sourceBuffer) {
if (aNode.textExpr.original) {
sourceBuffer.addRaw('if (!noDataOutput) {')
sourceBuffer.joinString('<!--s-text-->')
sourceBuffer.addRaw('}')
}

if (aNode.textExpr.value != null) {
Expand All @@ -68,7 +70,9 @@ export class ANodeCompiler {
}

if (aNode.textExpr.original) {
sourceBuffer.addRaw('if (!noDataOutput) {')
sourceBuffer.joinString('<!--/s-text-->')
sourceBuffer.addRaw('}')
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/target-php/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export class ANodeCompiler {
*/
compileText (aNode: ANode, emitter: PHPEmitter) {
if (aNode.textExpr.original) {
emitter.bufferHTMLLiteral('<!--s-text-->')
emitter.writeIf('!$noDataOutput', () => {
emitter.bufferHTMLLiteral('<!--s-text-->')
emitter.clearStringLiteralBuffer()
})
}

if (aNode.textExpr.value != null) {
Expand All @@ -69,7 +72,10 @@ export class ANodeCompiler {
}

if (aNode.textExpr.original) {
emitter.bufferHTMLLiteral('<!--/s-text-->')
emitter.writeIf('!$noDataOutput', () => {
emitter.bufferHTMLLiteral('<!--/s-text-->')
emitter.clearStringLiteralBuffer()
})
}
}

Expand Down

0 comments on commit c05ef7d

Please sign in to comment.