protected String renderTag(String tag) {

		if (tag.equals("")) {
			return tag;
		}

		// Get token
		char token = tag.charAt(0);

		// Comment, returns empty string
		if (token == COMMENT_TOKEN) {
			return "";
		}

		// Escape token, returns full tag
		if (token == ESCAPE_TOKEN) {
			return "<"+tag+"%>";
		}

		// Get variable/element identifier
		String identifier = tag.substring(1).trim();

		// Render element
		if (token == ELEMENT_TOKEN) {
			return this.getElement(identifier);
		}

		// Render
		if (token == VARIABLE_TOKEN) {
			// Default value
			String def = null;

			// Check for default value separator
			if (identifier.contains("|")) {
				// Get default value
				def = identifier.substring(identifier.indexOf("|") + 1).trim();

				// Get variable identifier
				identifier = identifier.substring(0, identifier.indexOf("|")).trim();
			}

			// Render variable
			return this.getVariable(identifier, def);
		}

		// Token not known, return message if debug mode
		if ( debugMode ) {
			return "Token " + token + " unknown";
		}

		// Token not known, return empty string if debug mode off
		return "" ;
	}