7575public class JinjavaInterpreter implements PyishSerializable {
7676 public static final String IGNORED_OUTPUT_FROM_EXTENDS_NOTE =
7777 "ignored_output_from_extends" ;
78- public static final long NO_LIMIT = -1 ;
79-
8078 private final Multimap <String , BlockInfo > blocks = ArrayListMultimap .create ();
8179 private final LinkedList <Node > extendParentRoots = new LinkedList <>();
8280 private final Map <String , RevertibleObject > revertibleObjects = new HashMap <>();
@@ -261,7 +259,7 @@ public String renderFlat(String template) {
261259 * @return rendered result
262260 */
263261 public String render (String template ) {
264- return render (template , NO_LIMIT );
262+ return render (template , config . getMaxOutputSize () );
265263 }
266264
267265 public String render (String template , long renderLimit ) {
@@ -276,7 +274,7 @@ public String render(String template, long renderLimit) {
276274 * @return rendered result
277275 */
278276 public String render (Node root ) {
279- return render (root , true , NO_LIMIT );
277+ return render (root , true , config . getMaxOutputSize () );
280278 }
281279
282280 /**
@@ -288,7 +286,7 @@ public String render(Node root) {
288286 * @return
289287 */
290288 public String render (Node root , boolean processExtendRoots ) {
291- return render (root , processExtendRoots , NO_LIMIT );
289+ return render (root , processExtendRoots , config . getMaxOutputSize () );
292290 }
293291
294292 /**
@@ -315,11 +313,7 @@ public String render(Node root, long renderLimit) {
315313 * @return rendered result
316314 */
317315 public String render (Node root , boolean processExtendRoots , long renderLimit ) {
318- long maxOutput = (renderLimit == NO_LIMIT )
319- ? config .getMaxOutputSize ()
320- : (Math .min (renderLimit , config .getMaxOutputSize ()));
321- OutputList output = new OutputList (maxOutput );
322-
316+ OutputList output = new OutputList (renderLimit );
323317 for (Node node : root .getChildren ()) {
324318 lineNumber = node .getLineNumber ();
325319 position = node .getStartPosition ();
@@ -375,8 +369,8 @@ public String render(Node root, boolean processExtendRoots, long renderLimit) {
375369 return output .getValue ();
376370 }
377371 }
378- StringBuilder ignoredOutput = new StringBuilder ();
379372
373+ StringBuilder ignoredOutput = new StringBuilder ();
380374 // render all extend parents, keeping the last as the root output
381375 if (processExtendRoots ) {
382376 Set <String > extendPaths = new HashSet <>();
@@ -441,6 +435,7 @@ public String render(Node root, boolean processExtendRoots, long renderLimit) {
441435 }
442436
443437 resolveBlockStubs (output );
438+
444439 if (ignoredOutput .length () > 0 ) {
445440 return (
446441 EagerReconstructionUtils .labelWithNotes (
@@ -456,7 +451,6 @@ public String render(Node root, boolean processExtendRoots, long renderLimit) {
456451 output .getValue ()
457452 );
458453 }
459-
460454 return output .getValue ();
461455 }
462456
0 commit comments