1. Stephen McKamey
  2. duel

Commits

Stephen McKamey  committed cdbc3aa

- cleaning up DuelView/DuelContext interfaces
- improving encapsulation and naming

  • Participants
  • Parent commits ca2967c
  • Branches default

Comments (0)

Files changed (9)

File src/org/duelengine/duel/DuelContext.java

View file
  • Ignore whitespace
  * Maintains context state for a single request/response cycle.
  * DuelContext is not thread-safe and not intended to be reusable.
  */
-public class DuelContext implements Appendable, ClientIDStrategy {
+public class DuelContext implements Appendable {
 
 	private final Appendable output;
 	private final ClientIDStrategy clientID;
 	private boolean encodeNonASCII = true;
-	private boolean globalDataPending;
-	private SparseMap globalData;
+	private boolean globalsPending;
+	private SparseMap globals;
 
 	public DuelContext(Appendable output) {
 		this(output, new IncClientIDStrategy());
 		this.encodeNonASCII = value;
 	}
 
-	public Object getGlobalData(String ident) {
+	public void putGlobal(String ident, Object value) {
 		if (ident == null) {
 			throw new NullPointerException("ident");
 		}
 
-		if (this.globalData == null || !this.globalData.containsKey(ident)) {
-			return null;
+		if (this.globals == null) {
+			this.globals = new SparseMap();
 		}
 
-		return this.globalData.get(ident);
+		this.globalsPending = true;
+		this.globals.putSparse(ident, value);
 	}
 
-	public void putGlobalData(String ident, Object value) {
-		if (ident == null) {
-			throw new NullPointerException("ident");
-		}
-
-		if (this.globalData == null) {
-			this.globalData = new SparseMap();
-		}
-
-		this.globalDataPending = true;
-		this.globalData.putSparse(ident, value);
-	}
-
-	public boolean hasGlobalData(String... idents) {
-		if (this.globalData == null) {
+	boolean hasGlobals(String... idents) {
+		if (this.globals == null) {
 			return false;
 		}
 
 		if (idents != null) {
 			for (String ident : idents) {
-				if (!this.globalData.containsKey(ident)) {
+				if (!this.globals.containsKey(ident)) {
 					return false;
 				}
 			}
 		return true;
 	}
 
-	SparseMap getGlobalData() {
-		return this.globalData;
+	Object getGlobal(String ident) {
+		if (ident == null) {
+			throw new NullPointerException("ident");
+		}
+
+		if (this.globals == null || !this.globals.containsKey(ident)) {
+			return null;
+		}
+
+		return this.globals.get(ident);
 	}
 
-	boolean isGlobalDataPending() {
-		return this.globalDataPending;
+	SparseMap getGlobals() {
+		return this.globals;
 	}
 
-	void setGlobalDataPending(boolean value) {
-		this.globalDataPending = value;
+	boolean isGlobalsPending() {
+		return this.globalsPending;
 	}
 
+	void setGlobalsPending(boolean value) {
+		this.globalsPending = value;
+	}
+
+	Appendable getOutput() {
+		return this.output;
+	}
+	
+	String nextID() {
+		return this.clientID.nextID();
+	}
+	
 	@Override
 	public Appendable append(CharSequence csq)
 		throws IOException {
 
 		return this.output.append(csq, start, end);
 	}
-
-	@Override
-	public String nextID() {
-		return this.clientID.nextID();
-	}
 }

File src/org/duelengine/duel/DuelView.java

View file
  • Ignore whitespace
 	/**
 	 * Renders a named partial view
 	 * @param partName
-	 * @param output
+	 * @param context
 	 * @param data
 	 * @param index
 	 * @param count
 	 * @param key
 	 */
-	protected void renderPart(String partName, DuelContext output, Object data, int index, int count, String key)
+	protected void renderPart(DuelContext context, String partName, Object data, int index, int count, String key)
 		throws IOException {
 
 		if (this.parts == null || !this.parts.containsKey(partName)) {
 			return;
 		}
 
-		part.render(output, data, index, count, key);
+		part.render(context, data, index, count, key);
 	}
 
 	/**
 	 * Allows one view to render another
 	 * @param view
-	 * @param output
+	 * @param context
 	 * @param data
 	 * @param index
 	 * @param count
 	 * @param key
 	 */
-	protected void renderView(DuelView view, DuelContext output, Object data, int index, int count, String key)
+	protected void renderView(DuelContext context, DuelView view, Object data, int index, int count, String key)
 		throws IOException {
 
-		view.render(output, data, index, count, key);
+		view.render(context, data, index, count, key);
 	}
 
 	/**
 
 	/**
 	 * The entry point into the view tree
-	 * @param output
+	 * @param context
 	 * @param data
 	 * @param index
 	 * @param count
 	 * @param key
 	 */
-	protected abstract void render(DuelContext output, Object data, int index, int count, String key)
+	protected abstract void render(DuelContext context, Object data, int index, int count, String key)
 		throws IOException;
 
 	/**
 
 		return a.equals(b);
 	}
-	
+
 	/**
 	 * Writes the value to the output
-	 * @param output
+	 * @param context
 	 * @param value
 	 * @throws IOException
 	 */
-	protected void write(DuelContext output, Object value)
+	protected void write(DuelContext context, Object value)
 		throws IOException {
 
 		if (value == null) {
 			return;
 		}
 
-		output.append(DuelData.coerceString(value));
+		context.getOutput().append(DuelData.coerceString(value));
+	}
+
+	/**
+	 * Writes the value to the output
+	 * @param context
+	 * @param value
+	 * @throws IOException
+	 */
+	protected void write(DuelContext context, String value)
+		throws IOException {
+
+		context.getOutput().append(value);
+	}
+
+	/**
+	 * Writes the value to the output
+	 * @param context
+	 * @param value
+	 * @throws IOException
+	 */
+	protected void write(DuelContext context, char value)
+		throws IOException {
+
+		context.getOutput().append(value);
 	}
 
 	/**
 	 * Ensures the value is properly encoded as HTML text
-	 * @param output
+	 * @param context
 	 * @param value
 	 * @throws IOException
 	 */
-	protected void htmlEncode(DuelContext output, Object value)
+	protected void htmlEncode(DuelContext context, Object value)
 		throws IOException {
 
 		if (value == null) {
 
 		if (value instanceof Boolean || value instanceof Number) {
 			// no need to encode non-text primitives
-			output.append(DuelData.coerceString(value));
+			context.append(DuelData.coerceString(value));
 
 		} else {
-			formatter.writeLiteral(output, DuelData.coerceString(value), output.getEncodeNonASCII());
+			formatter.writeLiteral(context, DuelData.coerceString(value), context.getEncodeNonASCII());
 		}
 	}
 
-	protected void writeGlobalData(DuelContext output, DataEncoder encoder, boolean needsTags)
+	protected Object getGlobal(DuelContext context, String ident) {
+		return context.getGlobal(ident);
+	}
+
+	protected Object hasGlobals(DuelContext context, String... idents) {
+		return context.hasGlobals(idents);
+	}
+
+	protected void writeGlobals(DuelContext context, DataEncoder encoder, boolean needsTags)
 		throws IOException {
 
-		if (!output.isGlobalDataPending()) {
+		if (!context.isGlobalsPending()) {
 			return;
 		}
 
 		if (needsTags) {
-			formatter.writeOpenElementBeginTag(output, "script");
-			formatter.writeAttribute(output, "type", "text/javascript");
-			formatter.writeCloseElementBeginTag(output);
+			formatter.writeOpenElementBeginTag(context, "script");
+			formatter.writeAttribute(context, "type", "text/javascript");
+			formatter.writeCloseElementBeginTag(context);
 		}
-		encoder.writeVars(output, output.getGlobalData());
+		encoder.writeVars(context, context.getGlobals());
 		if (needsTags) {
-			formatter.writeElementEndTag(output, "script");
+			formatter.writeElementEndTag(context, "script");
 		}
-		output.setGlobalDataPending(false);
+		context.setGlobalsPending(false);
 	}
-	
+
+	protected String nextID(DuelContext context) {
+		return context.nextID();
+	}
+
 	/**
 	 * A work-around for dynamic post-inc/dec operators
 	 * @param value

File src/org/duelengine/duel/codegen/CodeDOMBuilder.java

View file
  • Ignore whitespace
 			Void.class,
 			this.viewType.nextIdent("render_"),
 			new CodeParameterDeclarationExpression[] {
-				new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+				new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 				new CodeParameterDeclarationExpression(Object.class, "data"),
 				new CodeParameterDeclarationExpression(int.class, "index"),
 				new CodeParameterDeclarationExpression(int.class, "count"),
 			Void.class,
 			new CodeThisReferenceExpression(),
 			"renderView",
+			new CodeVariableReferenceExpression(DuelContext.class, "context"),
 			new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), field),
-			new CodeVariableReferenceExpression(DuelContext.class, "output"),
 			dataExpr,
 			indexExpr,
 			countExpr,
 			Void.class,
 			new CodeThisReferenceExpression(),
 			"renderPart",
+			new CodeVariableReferenceExpression(DuelContext.class, "context"),
 			new CodePrimitiveExpression(part.getName()),
-			new CodeVariableReferenceExpression(DuelContext.class, "output"),
 			new CodeVariableReferenceExpression(Object.class, "data"),
 			new CodeVariableReferenceExpression(int.class, "index"),
 			new CodeVariableReferenceExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						innerBind.getName(),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(dataDecl),
 						new CodeVariableReferenceExpression(indexDecl),
 						new CodeVariableReferenceExpression(countDecl),
 						innerBind.getReturnType(),
 						new CodeThisReferenceExpression(),
 						innerBind.getName(),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeMethodInvokeExpression(
 							Object.class,
 							new CodeVariableReferenceExpression(entryDecl),
 						innerBind.getReturnType(),
 						new CodeThisReferenceExpression(),
 						innerBind.getName(),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeMethodInvokeExpression(
 							Map.Entry.class,
 							new CodeVariableReferenceExpression(iteratorDecl),
 					method.getReturnType(),
 					new CodeThisReferenceExpression(),
 					method.getName(),
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(Object.class, "data"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					new CodeVariableReferenceExpression(int.class, "count"),
 				members.get(0).getUserData(ScriptTranslator.EXTERNAL_IDENTS) instanceof Object[]) {
 
 				Object[] idents = (Object[])members.get(0).getUserData(ScriptTranslator.EXTERNAL_IDENTS);
-				CodeExpression[] identArgs = new CodeExpression[idents.length];
-				for (int i=0, length=identArgs.length; i<length; i++) {
-					identArgs[i] = new CodePrimitiveExpression(idents[i]);
+				CodeExpression[] args = new CodeExpression[idents.length+1];
+				args[0] = new CodeVariableReferenceExpression(DuelContext.class, "context");
+				for (int i=0, length=idents.length; i<length; i++) {
+					args[i+1] = new CodePrimitiveExpression(idents[i]);
 				}
 
 				// if data present, then run server-side, else defer execution to client
 				CodeConditionStatement runtimeCheck = new CodeConditionStatement(
 					new CodeMethodInvokeExpression(
 						boolean.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"hasGlobalData",
-						identArgs),
+						new CodeThisReferenceExpression(),
+						"hasGlobals",
+						args),
 					new CodeMethodReturnStatement(expression));
 
 				CodeMethod runtimeCheckMethod = new CodeMethod(
 					Object.class,
 					this.viewType.nextIdent("hybrid_"),
 					new CodeParameterDeclarationExpression[] {
-						new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+						new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 						new CodeParameterDeclarationExpression(Object.class, "data"),
 						new CodeParameterDeclarationExpression(int.class, "index"),
 						new CodeParameterDeclarationExpression(int.class, "count"),
 					runtimeCheckMethod.getReturnType(),
 					new CodeThisReferenceExpression(),
 					runtimeCheckMethod.getName(),
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(Object.class, "data"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					new CodeVariableReferenceExpression(int.class, "count"),
 				Void.class,
 				encoderVar,
 				"write",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				new CodeVariableReferenceExpression(Object.class, "data"),
 				CodePrimitiveExpression.ONE));
 
 					Void.class,
 					encoderVar,
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE));
 
 						Void.class,
 						encoderVar,
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 						CodePrimitiveExpression.ONE));
 
 							Void.class,
 							encoderVar,
 							"write",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeVariableReferenceExpression(String.class, "key"),
 							CodePrimitiveExpression.ONE));
 					}
 				Void.class,
 				encoderVar,
 				"write",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				new CodeVariableReferenceExpression(idVar),
 				CodePrimitiveExpression.ONE));
 		} else {
 				Void.class,
 				encoderVar,
 				"write",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				new CodeVariableReferenceExpression(Object.class, "data"),
 				CodePrimitiveExpression.ONE));
 
 					Void.class,
 					encoderVar,
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE));
 
 						Void.class,
 						encoderVar,
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 						CodePrimitiveExpression.ONE));
 
 							Void.class,
 							encoderVar,
 							"write",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeVariableReferenceExpression(String.class, "key"),
 							CodePrimitiveExpression.ONE));
 					}
 			Void.class,
 			encoderVar,
 			"write",
-			new CodeVariableReferenceExpression(DuelContext.class, "output"),
+			new CodeVariableReferenceExpression(DuelContext.class, "context"),
 			new CodeVariableReferenceExpression(idVar),
 			CodePrimitiveExpression.ONE));
 		this.buffer.append(',');
 				Void.class,
 				encoderVar,
 				"write",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				new CodeVariableReferenceExpression(Object.class, "data"),
 				CodePrimitiveExpression.ONE));
 
 					Void.class,
 					encoderVar,
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE));
 
 						Void.class,
 						encoderVar,
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 						CodePrimitiveExpression.ONE));
 
 							Void.class,
 							encoderVar,
 							"write",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeVariableReferenceExpression(String.class, "key"),
 							CodePrimitiveExpression.ONE));
 					}
 			new CodeMethodInvokeExpression(
 				Void.class,
 				new CodeThisReferenceExpression(),
-				"writeGlobalData",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				"writeGlobals",
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), encoder),
 				new CodePrimitiveExpression(needsTags)));
 
 		// might prevent this from being emitted. if found do not mark.
 		// there is a runtime check as well which will prevent multiple.
 		for (CodeStatementCollection scope : this.scopeStack) {
-
 			// TODO: this is too naive. doesn't work with hybrid methods
 			if (!(scope.getOwner() instanceof CodeMethod)) {
 				return;

File src/org/duelengine/duel/codegen/CodeDOMUtility.java

View file
  • Ignore whitespace
 	}
 
 	public static CodeVariableDeclarationStatement nextID(IdentifierScope scope) {
-		// String id_XXX = output.nextID();
+		// String id_XXX = this.nextID(context);
 		return new CodeVariableDeclarationStatement(
 			String.class,
 			scope.nextIdent("id_"),
 			new CodeMethodInvokeExpression(
 				String.class,
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
-				"nextID"));
+				new CodeThisReferenceExpression(),
+				"nextID",
+				new CodeVariableReferenceExpression(DuelContext.class, "context")));
 	}
 
 	public static CodeStatement emitLiteralValue(String literal) {
-		// output.append("literal");
-		return new CodeExpressionStatement(
-			new CodeMethodInvokeExpression(
-				Void.class,
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
-				"append",
-				new CodePrimitiveExpression((literal.length() == 1) ? literal.charAt(0) : literal)));
+		// this.write(context, "literal");
+		return emitExpression(new CodePrimitiveExpression((literal.length() == 1) ? literal.charAt(0) : literal));
 	}
 
 	public static CodeStatement emitVarValue(CodeVariableDeclarationStatement localVar) {
-		// output.append(varName);
+		// this.write(context, varName);
 		return emitExpression(new CodeVariableReferenceExpression(localVar));
 	}
 
 				Void.class,
 				new CodeThisReferenceExpression(),
 				"htmlEncode",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				expression));
 	}
 
 	public static CodeStatement emitExpression(CodeExpression expression) {
-		if (String.class.equals(expression.getResultType())) {
-			// output.append(expression);
+		Class<?> exprType = expression.getResultType();
+		if (String.class.equals(exprType) ||
+			Character.class.equals(exprType)) {
+
+			// this.write(output, expression);
 			return new CodeExpressionStatement(
 				new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					expression));
 
 		}
 				Void.class,
 				new CodeThisReferenceExpression(),
 				"write",
-				new CodeVariableReferenceExpression(DuelContext.class, "output"),
+				new CodeVariableReferenceExpression(DuelContext.class, "context"),
 				expression));
 	}
 
 	public static CodeExpression lookupExternalVar(String ident) {
 		return new CodeMethodInvokeExpression(
 			Object.class,
-			new CodeVariableReferenceExpression(DuelContext.class, "output"),
-			"getGlobalData",
+			new CodeThisReferenceExpression(),
+			"getGlobal",
+			new CodeVariableReferenceExpression(DuelContext.class, "context"),
 			new CodePrimitiveExpression(ident));
 	}
 

File src/org/duelengine/duel/codegen/ScriptTranslator.java

View file
  • Ignore whitespace
 			null);
 
 		if (node.depth() == 1) {
-			method.addParameter(DuelContext.class, "output");
+			method.addParameter(DuelContext.class, "context");
 			method.addParameter(Object.class, "data");
 			method.addParameter(int.class, "index");
 			method.addParameter(int.class, "count");

File test/org/duelengine/duel/codegen/CodeDOMBuilderTests.java

View file
  • Ignore whitespace
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("A JSON payload should be an object or array, not a string.")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("\\&#x0008;&#x000C;\n\r\t&#x0123;&#x4567;&#x89AB;&#xCDEF;&#xABCD;&#xEF4A;\"")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "count").withParens()))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"htmlEncode",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(Object.class, "data").withParens()))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(Object.class, "data").withParens()))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"htmlEncode",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePropertyReferenceExpression(
 							new ScriptVariableReferenceExpression("Math"),
 							new CodePrimitiveExpression("PI"))))
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div>"))),
 				new CodeConditionStatement(
 					new CodeBinaryOperatorExpression(
 						new CodeExpressionStatement(
 							new CodeMethodInvokeExpression(
 								Void.class,
-								new CodeVariableReferenceExpression(DuelContext.class, "output"),
-								"append",
+								new CodeThisReferenceExpression(),
+								"write",
+								new CodeVariableReferenceExpression(DuelContext.class, "context"),
 								new CodePrimitiveExpression("zero")))
 					},
 					new CodeStatement[] {
 								new CodeExpressionStatement(
 									new CodeMethodInvokeExpression(
 										Void.class,
-										new CodeVariableReferenceExpression(DuelContext.class, "output"),
-										"append",
+										new CodeThisReferenceExpression(),
+										"write",
+										new CodeVariableReferenceExpression(DuelContext.class, "context"),
 										new CodePrimitiveExpression("one")))
 							},
 							new CodeStatement[] {
 								new CodeExpressionStatement(
 									new CodeMethodInvokeExpression(
 										Void.class,
-										new CodeVariableReferenceExpression(DuelContext.class, "output"),
-										"append",
+										new CodeThisReferenceExpression(),
+										"write",
+										new CodeVariableReferenceExpression(DuelContext.class, "context"),
 										new CodePrimitiveExpression("many")))
 							})
 					}),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div>"))),
 				new CodeConditionStatement(
 					new CodeBinaryOperatorExpression(
 					new CodeExpressionStatement(
 						new CodeMethodInvokeExpression(
 							Void.class,
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
-							"append",
+							new CodeThisReferenceExpression(),
+							"write",
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodePrimitiveExpression("zero")))),
 				new CodeConditionStatement(
 					new CodeBinaryOperatorExpression(
 					new CodeExpressionStatement(
 						new CodeMethodInvokeExpression(
 							Void.class,
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
-							"append",
+							new CodeThisReferenceExpression(),
+							"write",
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodePrimitiveExpression("one")))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("many"))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div>"))),
 				new CodeVariableDeclarationStatement(
 					Collection.class,
 							Void.class,
 							new CodeThisReferenceExpression(),
 							"render_2",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeMethodInvokeExpression(
 								Map.Entry.class,
 								new CodeVariableReferenceExpression(Iterator.class, "iterator_4"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 			).withOverride().withThrows(IOException.class),
 			new CodeMethod(
 				Void.class,
 				"render_2",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("item "))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "index").withParens()))
 			).withThrows(IOException.class));
 
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div>"))),
 				new CodeVariableDeclarationStatement(
 					Collection.class,
 							Void.class,
 							new CodeThisReferenceExpression(),
 							"render_2",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeMethodInvokeExpression(
 								Object.class,
 								new CodeVariableReferenceExpression(Map.Entry.class, "entry_5"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 			).withOverride().withThrows(IOException.class),
 			new CodeMethod(
 				Void.class,
 				"render_2",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("item "))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "index").withParens()))
 				).withThrows(IOException.class));
 
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div>"))),
 				new CodeVariableDeclarationStatement(
 					Object.class,
 							Void.class,
 							new CodeThisReferenceExpression(),
 							"render_2",
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodeVariableReferenceExpression(Object.class, "data_1"),
 							new CodeVariableReferenceExpression(int.class, "index_2"),
 							new CodeVariableReferenceExpression(int.class, "count_3"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 			).withOverride().withThrows(IOException.class),
 			new CodeMethod(
 				Void.class,
 				"render_2",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("item "))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeVariableReferenceExpression(int.class, "index").withParens()))
 			).withThrows(IOException.class));
 
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div foo=\"&amp;&lt;&gt;&quot;\">&amp;&lt;&gt;\""))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeThisReferenceExpression(),
-					"writeGlobalData",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					"writeGlobals",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_2"),
 					new CodePrimitiveExpression(true))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("<script type=\"text/javascript\">&<>\"</script>&amp;&lt;&gt;\"</div>")))
 				).withOverride().withThrows(IOException.class),
 			new CodeField(
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div></div>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"renderView",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeFieldReferenceExpression(
 							new CodeThisReferenceExpression(),
 							org.duelengine.duel.DuelView.class,
 							"view_2"),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
 						new CodePropertyReferenceExpression(
 							new CodeVariableReferenceExpression(Object.class, "data"),
 							new CodePrimitiveExpression("foo")).withParens(),
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"renderView",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeFieldReferenceExpression(
 							new CodeThisReferenceExpression(),
 							org.duelengine.duel.DuelView.class,
 							"view_2"),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
 						new CodeVariableReferenceExpression(Object.class, "data").withParens(),
 						new CodeVariableReferenceExpression(int.class, "index"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 					Void.class,
 					"render",
 					new CodeParameterDeclarationExpression[] {
-						new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+						new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 						new CodeParameterDeclarationExpression(Object.class, "data"),
 						new CodeParameterDeclarationExpression(int.class, "index"),
 						new CodeParameterDeclarationExpression(int.class, "count"),
 					new CodeExpressionStatement(
 						new CodeMethodInvokeExpression(
 							Void.class,
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
-							"append",
+							new CodeThisReferenceExpression(),
+							"write",
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodePrimitiveExpression("<div>Lorem ipsum.</div>")))
 					).withOverride().withThrows(IOException.class)),
 			new CodeMethod(
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div class=\"dialog\">"))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"renderPart",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("header"),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
 						new CodeVariableReferenceExpression(Object.class, "data"),
 						new CodeVariableReferenceExpression(int.class, "index"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<hr />"))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"renderPart",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("body"),
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
 						new CodeVariableReferenceExpression(Object.class, "data"),
 						new CodeVariableReferenceExpression(int.class, "index"),
 						new CodeVariableReferenceExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("</div>")))
 			).withOverride().withThrows(IOException.class),
 			CodeDOMUtility.createPartType(
 					Void.class,
 					"render",
 					new CodeParameterDeclarationExpression[] {
-						new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+						new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 						new CodeParameterDeclarationExpression(Object.class, "data"),
 						new CodeParameterDeclarationExpression(int.class, "index"),
 						new CodeParameterDeclarationExpression(int.class, "count"),
 					new CodeExpressionStatement(
 						new CodeMethodInvokeExpression(
 							Void.class,
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
-							"append",
+							new CodeThisReferenceExpression(),
+							"write",
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodePrimitiveExpression("<h2>Warning</h2>")))
 					).withOverride().withThrows(IOException.class)),
 			new CodeMethod(
 					Void.class,
 					"render",
 					new CodeParameterDeclarationExpression[] {
-						new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+						new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 						new CodeParameterDeclarationExpression(Object.class, "data"),
 						new CodeParameterDeclarationExpression(int.class, "index"),
 						new CodeParameterDeclarationExpression(int.class, "count"),
 					new CodeExpressionStatement(
 						new CodeMethodInvokeExpression(
 							Void.class,
-							new CodeVariableReferenceExpression(DuelContext.class, "output"),
-							"append",
+							new CodeThisReferenceExpression(),
+							"write",
+							new CodeVariableReferenceExpression(DuelContext.class, "context"),
 							new CodePrimitiveExpression("<div>Lorem ipsum.</div>")))
 					).withOverride().withThrows(IOException.class)));
 
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("Hello world.<!--Comment Here-->Lorem ipsum.")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("Hello world.<!--Comment<br>with<hr>some--&gt;markup-->Lorem ipsum.")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("Hello world."))),
 				new CodeCommentStatement("Code Comment Here"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("Lorem ipsum.")))
 			).withOverride().withThrows(IOException.class));
 
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<!doctype html><html><head><title>The head.</title></head><body><h1>The body.</h1></body></html>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"append",
+						new CodeThisReferenceExpression(),
+						"write",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("<div class=\"foo\" style=\"color:red\"><ul class=\"bar\"><li>one</li><li>two</li><li>three</li></ul></div>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				},
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("<div class=\""))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"htmlEncode",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodePrimitiveExpression("foo").withParens())),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("\" style=\""))),
 				new CodeExpressionStatement(
 					new CodeMethodInvokeExpression(
 						Void.class,
 						new CodeThisReferenceExpression(),
 						"write",
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
+						new CodeVariableReferenceExpression(DuelContext.class, "context"),
 						new CodeBinaryOperatorExpression(
 							CodeBinaryOperatorType.ADD,
 							new CodePrimitiveExpression("color:"),
 						)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("\"><ul class=\"bar\"><li>one</li><li>two</li><li>three</li></ul></div>")))
 				).withOverride().withThrows(IOException.class)
 			);
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				},
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("<div id=\""))),
 				new CodeVariableDeclarationStatement(
 					String.class,
 					"id_1",
 					new CodeMethodInvokeExpression(
 						String.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"nextID")),
+						new CodeThisReferenceExpression(),
+						"nextID",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_1"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("\"><p id=\""))),
 				new CodeVariableDeclarationStatement(
 					String.class,
 					"id_2",
 					new CodeMethodInvokeExpression(
 						String.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"nextID")),
+						new CodeThisReferenceExpression(),
+						"nextID",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_2"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("\">Lorem ipsum.</p><script type=\"text/javascript\">"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeThisReferenceExpression(),
-					"writeGlobalData",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					"writeGlobals",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					new CodePrimitiveExpression(false))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("duel.attr("))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_2"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", { \"class\" : function(data, index, count, key) { return (barCSS(key)); } }, "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(Object.class, "data"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "count"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "key"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(");</script></div><script type=\"text/javascript\">duel.attr("))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_1"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", {\n\t\t\"class\" : function(data, index) { return (fooCSS(index)); },\n\t\tstyle : function(data) { return (customStyle(data)); }\n\t}, "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(Object.class, "data"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_5"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(");</script>")))
 			).withOverride().withThrows(IOException.class),
 			new CodeField(
 				Void.class,
 				"render",
 				new CodeParameterDeclarationExpression[] {
-					new CodeParameterDeclarationExpression(DuelContext.class, "output"),
+					new CodeParameterDeclarationExpression(DuelContext.class, "context"),
 					new CodeParameterDeclarationExpression(Object.class, "data"),
 					new CodeParameterDeclarationExpression(int.class, "index"),
 					new CodeParameterDeclarationExpression(int.class, "count"),
 				},
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("<div><script type=\"text/javascript\" id=\""))),
 				new CodeVariableDeclarationStatement(
 					String.class,
 					"id_1",
 					new CodeMethodInvokeExpression(
 						String.class,
-						new CodeVariableReferenceExpression(DuelContext.class, "output"),
-						"nextID")),
+						new CodeThisReferenceExpression(),
+						"nextID",
+						new CodeVariableReferenceExpression(DuelContext.class, "context"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_1"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("\">"))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeThisReferenceExpression(),
-					"writeGlobalData",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					"writeGlobals",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_3"),
 					new CodePrimitiveExpression(false))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression("duel.replace("))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_3"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(String.class, "id_1"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", function(data, index) { return (foo(index)); }, "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_3"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(Object.class, "data"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(", "))),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
 					new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataEncoder.class, "encoder_3"),
 					"write",
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodeVariableReferenceExpression(int.class, "index"),
 					CodePrimitiveExpression.ONE)),
 				new CodeExpressionStatement(new CodeMethodInvokeExpression(
 					Void.class,
-					new CodeVariableReferenceExpression(DuelContext.class, "output"),
-					"append",
+					new CodeThisReferenceExpression(),
+					"write",
+					new CodeVariableReferenceExpression(DuelContext.class, "context"),
 					new CodePrimitiveExpression(");</script></div>")))