Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove <!--s-text--><!--/s-text--> when noDataOutput is true #23

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: remove <!--s-text--><!--/s-text--> when noDataOutput is true, fixes
  • Loading branch information
l5oo00 committed Nov 13, 2019
commit 4f5132c2c90e9caa927ca74e68741050f94d46fb
4 changes: 4 additions & 0 deletions src/target-js/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
@@ -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) {
@@ -68,7 +70,9 @@ export class ANodeCompiler {
}

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

10 changes: 8 additions & 2 deletions src/target-php/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
@@ -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) {
@@ -69,7 +72,10 @@ export class ANodeCompiler {
}

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