Skip to content

Feature Request: strip tags that match a selector #74

Open

Description

@hughrawlinson

Similar to grep's -v (inverse grep), I'd love an 'inverse select' option for pup. Something like:

$ echo '<div><h1>Yes</h1><p>No</p></div>' | pup -v 'p'
<div><h1>Yes</h1></div>

Activity

  1. ericchiang commented on Apr 13, 2017

    @ericchiang
    Owner

    Yea this would be a welcome addition.

  2. nick-bull commented on Sep 27, 2019

    @nick-bull

    Progress on this? Best I could come up with in the meantime:

    html="<h1>hi</h1><h2>there</h2>"
    diff --unchanged-group-format="" \
      <(echo "$html" - | pup --indent 0 'h2') \
      <(echo "$html" - | pup --indent 0 '*')` | pup
    

    --indent 0 is redundant in this example, but in multiline html changing indents will create no match, so I guess you could say... it makes a diff (sorry). The final pup pipe will re-indent the html for ya

  3. wolfgang42 commented on Sep 27, 2019

    @wolfgang42

    @nick-bull #81 implements this. I see that Eric has just started making commits again, hopefully he'll merge the open PRs soon and make a new release. In the meantime pulling and building my branch should get you what you need.

  4. frioux commented on Jan 24, 2022

    @frioux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions