nl_tokens: Convert typedoc HTML file into Angular component for use in demo app
pl_tokens: function generateComponent ( typedocHtmlFile , relativeTypedocHtmlFile , demoAppDocsModuleDir ) { const directory = path . dirname ( relativeTypedocHtmlFile ) ; mkdirp . <mask> ( path . join ( demoAppDocsModuleDir , directory ) ) ; const fileName = path . basename ( relativeTypedocHtmlFile ) ; const componentHtmlFileName = fileName . replace ( / \.html$ / , '.component.html' ) ; const componentHtmlFile = path . join ( demoAppDocsModuleDir , directory , componentHtmlFileName ) ; const typedocHtmlFileContent = fs . readFileSync ( typedocHtmlFile , { encoding : 'utf8' } ) ; const escapedHtmlFileContent = fixRouterFragments ( fixReadmeMdLinks ( escapeHtmlForAngular ( typedocHtmlFileContent ) ) ) ; fs . writeFileSync ( componentHtmlFile , escapedHtmlFileContent , { encoding : 'utf8' } ) ; const componentFileName = fileName . replace ( / \.html$ / , '.component' ) ; const componentTsFileName = componentFileName + '.ts' ; const componentTsFile = path . join ( demoAppDocsModuleDir , directory , componentTsFileName ) ; const componentName = generateComponentName ( fileName ) ; const componentTsFileContent = ` ${ componentHtmlFileName } ${ componentName } ` ; fs . writeFileSync ( componentTsFile , componentTsFileContent , { encoding : 'utf8' } ) ; // Return metadata for generating module file return { name : componentName , file : path . join ( directory , componentFileName ) , route : relativeTypedocHtmlFile // route is based on original file name } ; }