Exemple #1
0
 @Override
 void apply(
     Invokation invokation, CharSequence content, @Nullable Templates.Invokable original) {
   boolean hasNonWhitespace = !CharMatcher.WHITESPACE.matchesAllOf(content);
   if (hasNonWhitespace) {
     if (original != null) {
       original.invoke(invokation);
     } else {
       invokation.out(content);
     }
   }
 }
Exemple #2
0
        @Override
        void apply(
            Invokation invokation, CharSequence content, @Nullable Templates.Invokable original) {
          String collapsed = CharMatcher.WHITESPACE.trimAndCollapseFrom(content, ' ');
          int estimatedLimitOnThisLine = LIMIT - invokation.getCurrentIndentation().length();

          if (collapsed.length() < estimatedLimitOnThisLine) {
            invokation.out(collapsed);
          } else {
            if (original != null) {
              original.invoke(invokation);
            } else {
              invokation.out(content);
            }
          }
        }
 protected final void invoke(Templates.Invokable invokable) {
   checkArgument(invokable.arity() == 0, "Entry template fragment should not have parameters");
   invokable.invoke(Templates.Invokation.initial());
 }