Skip to content

chop filter glitches when allowed HTML tags have attributes #15

@michaelrog

Description

@michaelrog

The chop filter appears to have issues when allowed HTML tags have attributes, such as the a tag with title attribute in this example.

Source HTML:

<h2>Do you have what it takes to join our firm?</h2>
<p>We are <a href="http://localhost:8000/about-us#entry:15350:url">looking for students</a> who exhibit the skillsets and ambition to deliver <strong><a href="/about/our-ten-imperatives-of-client-service" title="Our Ten Imperatives of Client Service">The Ten Imperatives of Client Service</a>.</strong></p>

Craft Template Code:

{{ career.basicPageContent|chop(limit=30, unit='w', allowedTags="<em> <p> <h2> <a> <strong>", append="...") }} 

Resulting HTML:

<h2>Do you have what it takes to join our firm?</h2>
<p>We are <a href="http://localhost:8000/about-us#entry:15350:url">looking for students</a> who exhibit the skillsets and ambition to deliver <strong><a href="/about/our-ten-imperatives-of...</a></p>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions