Skip to content

Subsequent sibling combinator not working #201

@stefanoschrs

Description

@stefanoschrs

The Subsequent sibling combinator is not returning anything

$ curl https://github.com/ericchiang/pup | pup '.entry-content h2 ~ p'

$ curl https://github.com/ericchiang/pup | htmlq '.entry-content h2 ~ p'
<p dir="auto">Direct downloads are available through the <a href="https://github.com/EricChiang/pup/releases/latest">releases page</a>.</p>
<p dir="auto">If you have Go installed on your computer just run <code>go get</code>.</p>
<p dir="auto">If you're on OS X, use <a href="http://brew.sh/" rel="nofollow">Homebrew</a> to install (no Go required).</p>
<p dir="auto">Ew, HTML. Let's run that through some pup selectors:</p>
<p dir="auto">Okay, how about only the links?</p>
<p dir="auto">Even better, let's grab the titles too:</p>
<p dir="auto">Download a webpage with wget.</p>
<p dir="auto">By default pup will fill in missing tags and properly indent the page.</p>
<p dir="auto">CSS selectors have a group of specifiers called <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes" rel="nofollow">"pseudo classes"</a>  which are pretty
cool. pup implements a majority of the relevant ones them.</p>
<p dir="auto">Here are some examples.</p>
<p dir="auto">For a complete list, view the <a href="#implemented-selectors">implemented selectors</a>
section.</p>
<p dir="auto">These are intermediate characters that declare special instructions. For
instance, a comma <code>,</code> allows pup to specify multiple groups of selectors.</p>
<p dir="auto">When combining selectors, the HTML nodes selected by the previous selector will
be passed to the next ones.</p>
<p dir="auto">For further examples of these selectors head over to <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference" rel="nofollow">MDN</a>.</p>
<p dir="auto">You can mix and match selectors as you wish.</p>
<p dir="auto">Non-HTML selectors which effect the output type are implemented as functions
which can be provided as a final argument.</p>
<p dir="auto">Print all text from selected nodes and children in depth first order.</p>
<p dir="auto">Print the values of all attributes with a given key from all selected nodes.</p>
<p dir="auto">Print HTML as JSON.</p>
<p dir="auto">Use the <code>-i</code> / <code>--indent</code> flag to control the intent level.</p>
<p dir="auto">If the selectors only return one element the results will be printed as a JSON
object, not a list.</p>
<p dir="auto">Because there is no universal standard for converting HTML/XML to JSON, a
method has been chosen which hopefully fits. The goal is simply to get the
output of pup into a more consumable format.</p>
<p dir="auto">Run <code>pup --help</code> for a list of further options</p>

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