Package com.google.template.soy.data.SanitizedContent

Examples of com.google.template.soy.data.SanitizedContent.ContentKind


     */
    private ContentKind getCommonContentKindIfStrict(List<TemplateNode> templates) {
      if (templates == null || templates.isEmpty()) {
        return null;
      }
      ContentKind contentKind = templates.get(0).getContentKind();
      for (TemplateNode template : templates) {
        Preconditions.checkArgument(template.getContentKind() == contentKind);
      }
      return contentKind;
    }
View Full Code Here


    private Pair<String, Context> inferCallSite(
        CallNode callNode, Context startContext, String templateName, Inferences inferences)
        throws SoyAutoescapeException {
      inferences.recordTemplateChecked(templateName);
      List<TemplateNode> targets = inferences.lookupTemplates(templateName);
      ContentKind calleeStrictContentKind = getCommonContentKindIfStrict(targets);

      if (autoescapeMode == AutoescapeMode.STRICT) {
        // We're currently in a strict mode template. Check what kind of template is being called.
        if (calleeStrictContentKind != null || targets == null || targets.isEmpty()) {
          // If a strict template calls another strict template (or an unknown extern), the result
View Full Code Here

    this.templateName = commandTextInfo.templateName;
    this.partialTemplateName = commandTextInfo.partialTemplateName;
    this.isPrivate = commandTextInfo.isPrivate;
    this.autoescapeMode = commandTextInfo.autoescapeMode;
    ContentKind contentKind = commandTextInfo.contentKind;
    if (contentKind == null && autoescapeMode == AutoescapeMode.STRICT) {
      // Default mode is HTML.
      contentKind = ContentKind.HTML;
    } else if (contentKind != null && autoescapeMode != AutoescapeMode.STRICT) {
      // TODO: Perhaps this could imply strict escaping?
View Full Code Here

        // but if there are SanitizedContentOperators at the end, then make sure that their input
        // is of the appropriate type since we know that they will not change the content type.
        int newPrintDirectiveIndex = printNode.numChildren();
        while (newPrintDirectiveIndex > 0) {
          String printDirectiveName = printNode.getChild(newPrintDirectiveIndex - 1).getName();
          ContentKind contentKind = sanitizedContentOperators.get(printDirectiveName);
          if (contentKind == null || contentKind != escapingMode.contentKind) {
            break;
          }
          --newPrintDirectiveIndex;
        }
View Full Code Here

    for (List<DelegateTemplateDivision> divisions : delTemplatesMap.values()) {

      TemplateDelegateNode firstDelTemplate = null;
      String firstDelPackageName = null;
      Set<SoyDocParam> firstSoyDocParamsSet = null;
      ContentKind firstContentKind = null;

      for (DelegateTemplateDivision division : divisions) {
        for (TemplateDelegateNode delTemplate : division.delPackageNameToDelTemplateMap.values()) {
          String currDelPackageName =  (delTemplate.getDelPackageName() != null) ?
              delTemplate.getDelPackageName() : "<default>";
View Full Code Here

      autoescapeMode = AutoescapeMode.forAttributeValue(autoescapeModeStr);
    } else {
      autoescapeMode = soyFileHeaderInfo.defaultAutoescapeMode;  // Inherit from containing file.
    }

    ContentKind contentKind = (attributes.get("kind") != null) ?
        NodeContentKinds.forAttributeValue(attributes.get("kind")) : null;

    return buildCommandTextInfoHelper(
        id, soyFileHeaderInfo, commandText, delTemplateName, delTemplateVariant, delPriority,
        autoescapeMode, contentKind);
View Full Code Here

          "Invalid value expression in 'let' command text \"" + commandText + "\".");
    } else {
      valueExpr = null;
    }

    ContentKind contentKind;
    if (matcher.group(3 /* optional attributes */) != null) {
      Preconditions.checkState(matcher.group(2) == null,
          "Match groups for value expression and optional attributes should be mutually exclusive");
      // Parse optional attributes
      Map<String, String> attributes = ATTRIBUTES_PARSER.parse(matcher.group(3));
View Full Code Here

      autoescapeMode = AutoescapeMode.forAttributeValue(autoescapeModeStr);
    } else {
      autoescapeMode = soyFileHeaderInfo.defaultAutoescapeMode;  // Inherit from containing file.
    }

    ContentKind contentKind = (attributes.get("kind") != null) ?
        NodeContentKinds.forAttributeValue(attributes.get("kind")) : null;

    return new CommandTextInfo(
        commandText, templateName, partialTemplateName, isOverride, isPrivate, autoescapeMode,
        contentKind, syntaxVersion);
View Full Code Here

    if (nctMatcher.matches() && (nctMatcher.group(2) != null)) {
      valueExprText = nctMatcher.group(2);
    } else {
      valueExprText = attributes.get("value");
    }
    ContentKind contentKind =
        (attributes.get("kind") != null) ?
        NodeContentKinds.forAttributeValue(attributes.get("kind")) :
        null;

    // Check the validity of the key name.
View Full Code Here

TOP

Related Classes of com.google.template.soy.data.SanitizedContent.ContentKind

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.