Package com.google.clearsilver.jsilver.autoescape

Examples of com.google.clearsilver.jsilver.autoescape.EscapeMode


public class AddFunction extends NonEscapingFunction {

  public Value execute(Value... args) {
    Value left = args[0];
    Value right = args[1];
    EscapeMode mode = EscapeMode.combineModes(left.getEscapeMode(), right.getEscapeMode());
    return literalValue(left.asString() + right.asString(), mode, left.isPartiallyEscaped()
        || right.isPartiallyEscaped());
  }
View Full Code Here


          textFilter.filter(in, out);
        } catch (IOException e) {
          throw new JSilverInterpreterException(e.getMessage());
        }

        EscapeMode mode;
        boolean isPartiallyEscaped;
        if (isEscaper) {
          // This function escapes its input. Hence the output is
          // partiallyEscaped.
          mode = EscapeMode.ESCAPE_IS_CONSTANT;
View Full Code Here

  public void caseAAutoescapeCommand(AAutoescapeCommand node) {
    setLastPosition(node.getPosition());
    Value value = expressionEvaluator.evaluate(node.getExpression());
    String escapeStrategy = value.asString();

    EscapeMode mode = EscapeMode.computeEscapeMode(escapeStrategy);

    context.pushAutoEscapeMode(mode);
    node.getCommand().apply(this);
    context.popAutoEscapeMode();
  }
View Full Code Here

   *        on.
   */
  @Override
  public void render(String templateName, Data data, Appendable output,
      ResourceLoader resourceLoader) throws IOException, JSilverException {
    EscapeMode escapeMode = getEscapeMode(data);
    render(templateLoader.load(templateName, resourceLoader, escapeMode), data, output,
        resourceLoader);
  }
View Full Code Here

   *        java.io.Appendable
   */
  @Override
  public void renderFromContent(String content, Data data, Appendable output) throws IOException,
      JSilverException {
    EscapeMode escapeMode = getEscapeMode(data);
    render(templateLoader.createTemp("[renderFromContent]", content, escapeMode), data, output);
  }
View Full Code Here

   *
   * @param data HDF Data to check
   * @return EscapeMode
   */
  public EscapeMode getEscapeMode(Data data) {
    EscapeMode escapeMode =
        EscapeMode.computeEscapeMode(data.getValue(VAR_ESCAPE_MODE_KEY), data
            .getBooleanValue(AUTO_ESCAPE_KEY));
    if (escapeMode.equals(EscapeMode.ESCAPE_NONE)) {
      escapeMode = options.getEscapeMode();
    }

    return escapeMode;
  }
View Full Code Here

    if (!st.hasMoreTokens()) {
      throw new IllegalArgumentException("No class name found in " + templateMapFile + " on line "
          + lineNumber + ": " + line);
    }
    String className = st.nextToken();
    EscapeMode escapeMode;
    if (!st.hasMoreTokens()) {
      escapeMode = EscapeMode.ESCAPE_NONE;
    } else {
      String escapeCmd = st.nextToken();
      try {
View Full Code Here

  private void saveAutoEscapingContext(Node node, PPosition position) {
    setCurrentPosition(position);
    if (skipAutoEscape) {
      return;
    }
    EscapeMode mode = autoEscapeContext.getEscapeModeForCurrentState();
    AStringExpression escapeStrategy =
        new AStringExpression(new TString("\"" + mode.getEscapeCommand() + "\""));
    AAutoescapeCommand command =
        new AAutoescapeCommand(position, escapeStrategy, (PCommand) node.clone());
    node.replaceBy(command);
    autoEscapeContext.insertText();
  }
View Full Code Here

TOP

Related Classes of com.google.clearsilver.jsilver.autoescape.EscapeMode

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.