Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
astro-wt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
abfc737a
authored
2024-11-22 10:00:08 -0600
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Allow for multiple xpath matches at the top level.
1 parent
82b35ef4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
lib/external.astro
lib/external.astro
View file @
abfc737
...
...
@@ -18,10 +18,10 @@ export const getDocFromProps = async (props, options) => {
return parseHtml(html, { ...options, adjuster })
}
export const getNodeFromProps = async (props, options) => {
export const getNode
s
FromProps = async (props, options) => {
const doc = await getDocFromProps(props, options)
const { xpath } = props
return xpath ? findNode(doc, xpath
) : doc
return xpath ? findNode(doc, xpath
, { single: false }) : [ doc ]
}
export const createAdjuster = (adjustments = {}) => {
...
...
@@ -39,8 +39,8 @@ export const createAdjuster = (adjustments = {}) => {
const { props } = Astro
const { debug, replacers, slotHandler } = props
const node
= await getNode
FromProps(props)
const node
s = await getNodes
FromProps(props)
const nextDebug = debug ? debug - 1 : 0
---
<Match node={node} debug={nextDebug} replacers={replacers} slotHandler={slotHandler} adjuster={adjuster}/>
{nodes.map(node => <Match node={node} debug={nextDebug} replacers={replacers} slotHandler={slotHandler}/>)}
...
...
Please
register
or
sign in
to post a comment