Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filters: proper escaping for |linebreaks and friends #77

Merged
merged 4 commits into from
Jul 13, 2024

Commits on Jul 13, 2024

  1. filter: HtmlSafeOutput is safe for all display types

    Fix copy-and-paste mishap.
    Kijewski committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    b5d1332 View commit details
    Browse the repository at this point in the history
  2. filter: (Maybe)Safe is (maybe) safe for references, too

    The generator often takes references to the values it wants to display.
    A bare `(Maybe)Safe<T>` won't likely be encountered.
    Kijewski committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    31a18f2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fba8476 View commit details
    Browse the repository at this point in the history
  4. filters: proper escaping for |linebreaks and friends

    The filters `|linebreaks`, `|linebreaksbr` and `|paragraphbreaks`
    generate HTML code to be embedded in a page. Having to specify that the
    output of these filters is `|safe` is cumbersome. Also, these filters
    need to operate on already escaped HTML data. This could be done by
    writing `{{ s|escape|linebreaks|safe }}`.
    
    This PR does the input and output formatting escaping for the user. The
    input gets escaped for HTML (invariant of the selected escaper), and the
    output gets marked as HTML safe.
    Kijewski committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    5163e38 View commit details
    Browse the repository at this point in the history