Improve filtering/buffering documentation.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 459
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Migrated issue, originally created by Cody Taylor (@CodeMan99)
The default_filters argument to a TemplateLookup could use some deeper explaining.
When I added a default HTML filter at work today there was some confusion as to why the template rendered as normal. It required about a hour of thinking and code examples before the light bulb went off. Perhaps we both were being dense, but here are my suggestions.
- Mention in syntax that writing is separate from filtering (unless captured).
- Explain default_filters before
<%page expression_filters="n" />. - Explain that
<%page expression_filters="h" />will append to any existingdefault_filterslist. - (Maybe) state in API documention that default_filters does not apply to
<%block><%def>and<%page>'s unbuffered writes. - Provide an example of a
<%def>that does not buffer in the buffering section. In particular state that the buffered example doesreturn buf.getvalue()instead ofreturn ''.
Relates to #111.
As always willing to implement upon agreement.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with syntax.html#expression-escaping, filtering.html sections on default_filters and buffering, and usage.html#mako.template.Template.params.default_filters. Compare the requested explanations and examples across those sections, including expression_filters ordering, unbuffered writes, and the buffered return value; done means each of the five documentation suggestions is addressed consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100