Package com.google.clearsilver.jsilver.data

Examples of com.google.clearsilver.jsilver.data.Data


  public String render() {
    if (template == null) {
      throw new IllegalStateException("Call parseFile() or parseStr() before " + "render()");
    }

    Data data;
    if (globalHdf != null) {
      // For legacy support we allow users to pass in this option to disable
      // the new modification protection for global HDF.
      data =
          new LocalAndGlobalData(localHdf.getData(), globalHdf.getData(), jSilver.getOptions()
View Full Code Here


    return reference;
  }

  @Override
  protected String value() {
    Data data = getReference();
    return data == null ? null : data.getValue();
  }
View Full Code Here

    return name;
  }

  @Override
  public EscapeMode getEscapeMode() {
    Data data = getReference();
    if (data == null) {
      return super.getEscapeMode();
    }
    return data.getEscapeMode();
  }
View Full Code Here

  public void caseASetCommand(ASetCommand node) {
    setLastPosition(node.getPosition());
    String variableName = variableLocator.getVariableName(node.getVariable());

    try {
      Data variable = dataContext.findVariable(variableName, true);
      Value value = expressionEvaluator.evaluate(node.getExpression());
      variable.setValue(value.asString());
      // TODO: what about nested structures?
      // "set" was used to set a variable to a constant or escaped value like
      // <?cs set: x = "<b>X</b>" ?> or <?cs set: y = html_escape(x) ?>
      // Keep track of this so autoescaping code can take it into account.
      variable.setEscapeMode(value.getEscapeMode());
    } catch (UnsupportedOperationException e) {
      // An error occurred - probably due to trying to modify an UnmodifiableData
      throw new UnsupportedOperationException(createUnsupportedOperationMessage(node, context
          .getIncludedTemplateNames()), e);
    }
View Full Code Here

   */
  @Override
  public void caseANameCommand(ANameCommand node) {
    setLastPosition(node.getPosition());
    String variableName = variableLocator.getVariableName(node.getVariable());
    Data variable = dataContext.findVariable(variableName, false);
    if (variable != null) {
      context.writeEscaped(variable.getSymlink().getName());
    }
  }
View Full Code Here

    setLastPosition(node.getPosition());
    Value expression = expressionEvaluator.evaluate(node.getExpression());

    if (expression instanceof VariableValue) {
      VariableValue variableValue = (VariableValue) expression;
      Data parent = variableValue.getReference();
      if (parent != null) {
        each(node.getVariable(), variableValue.getName(), parent, node.getCommand());
      }
    }
  }
View Full Code Here

    VariableValue arg = (VariableValue) args[0];
    if (arg.getReference() == null) {
      return literalConstant(0, arg);
    }

    Data thisNode = arg.getReference().getSymlink();
    return literalConstant(thisNode.getChildCount(), arg);
  }
View Full Code Here

    VariableValue arg = (VariableValue) args[0];
    if (arg.getReference() == null) {
      return literalConstant(false, arg);
    }

    Data thisNode = arg.getReference().getSymlink();
    return literalConstant(thisNode.isLastSibling(), arg);
  }
View Full Code Here

TOP

Related Classes of com.google.clearsilver.jsilver.data.Data

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.