Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

get-liquid-data-references.js 483 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  1. // This module searches a string for references to data objects
  2. // It finds all references matching {{site.data.*}} and return an array of them
  3. const patterns = require('./patterns')
  4. module.exports = function getLiquidDataReferences (text) {
  5. return (text.match(patterns.dataReference) || [])
  6. .map(ref => {
  7. const cleaned = ref.replace(/\.\.\//g, '')
  8. .replace('{% data', '')
  9. .replace('%}', '')
  10. .trim()
  11. return `site.data.${cleaned}`
  12. })
  13. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...