MCPcopy
hub / github.com/iptv-org/iptv / processIncludes

Method processIncludes

scripts/core/markdown.ts:31–44  ·  view source on GitHub ↗
(template: string, baseDir: string)

Source from the content-addressed store, hash-verified

29 }
30
31 private processIncludes(template: string, baseDir: string): string {
32 const includeRegex = /#include\s+"([^"]+)"/g
33
34 return template.replace(includeRegex, (match, includePath) => {
35 try {
36 const fullPath = path.resolve(baseDir, includePath)
37 const includeContent = fs.readFileSync(fullPath, 'utf8')
38 return this.processIncludes(includeContent, baseDir)
39 } catch (error) {
40 console.warn(`Warning: Could not include file ${includePath}: ${error}`)
41 return match
42 }
43 })
44 }
45}

Callers 1

compileMethod · 0.95

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected