Skip to content

Commit

Permalink
Merge pull request #22 from elyobo/handle-multiple-macros
Browse files Browse the repository at this point in the history
Handle multiple includes calls in one line.
  • Loading branch information
elyobo authored Oct 28, 2022
2 parents cdb0737 + cefe41a commit e929f86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const tablesToDbtModels = async (configs, adjustName) => {

// Replace macro placeholders from above
const replaceMacroPlaceholders = (content) =>
content.replace(/--MACRO (.*) MACRO--/g, (_, macro) => `{{ ${macro} }}`)
content.replace(/--MACRO (.*?) MACRO--/g, (_, macro) => `{{ ${macro} }}`)

const cleanSqlBlock = (block) => {
const trimmed = replaceMacroPlaceholders(block?.trim() || '')
Expand Down

0 comments on commit e929f86

Please sign in to comment.