Repository navigation
Template limits per article, and templates that give table rows - #50
Merged
Merged
Conversation
The limits (500 calls, 2000 calls and functions, 500,000 characters of output) now count for the whole article, not each call, and a refused call is answered without rendering anything. A template call is rendered as a <template> element so it can sit between table tags, and a template that gives rows or cells is parsed inside a table that is taken off again. #ifexist answers are kept for the request. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes from a review of the template system.
The limits now count for the whole article. The limits of 2000 calls and functions and 500 template calls were reset at each template call, so an article with many calls could do a full render for each. They now count for the whole article, there is a 500,000-character output budget, and once a limit is used up the remaining calls are answered with a "Too many templates" message without rendering anything. A page with 1500 calls of a nested template went from 1.6 s to 0.24 s.
#ifexistanswers are also kept for the request, so repeated checks do not repeat the query.Templates can give table rows and cells.
<table>{{Row|a|1}}{{Row|b|2}}</table>left the braces as text, because the placeholder for a call was a<span>, which cannot sit between table tags. It is now a<template>element, which can. A template whose text starts with<tr>,<tbody>,<td>and so on is parsed inside a table that is then taken off, since rows do not parse on their own. A new migration clears the cached text formatter configuration so existing boards pick up the new tag.Measured (MySQL 8.0 board): about 1 ms for each template call written in an article, and one extra query for the template pages however many calls there are. A cache of rendered articles is still not needed; the TODO plan has the numbers.
Docs. README: template rows and the limits. TODO plan: the measurements.
Tests
#exprand date abuse, loops) with a time limit.Investigated and written by Claude on behalf of William Jacoby (bonelifer).