()
| 309 | const markdowns = ['readme', 'changelog', 'contributing', 'license', 'todo']; |
| 310 | const numberOfMarkdowns = 5; |
| 311 | const loop = () => { |
| 312 | if (i < numberOfMarkdowns) { |
| 313 | MarkdownEngine.getTraditionalMarkdown(markdowns[i].toUpperCase()) |
| 314 | .then((readmeData: markdownReadedDatas) => { |
| 315 | logger.info(`${markdowns[i].toUpperCase()}.md file found`); |
| 316 | if (markdowns[i] === 'readme') { |
| 317 | Configuration.mainData.readme = true; |
| 318 | // Always create index.html as main page with README content |
| 319 | Configuration.addPage({ |
| 320 | name: 'index', |
| 321 | context: 'readme', |
| 322 | id: 'index', |
| 323 | markdown: readmeData.markdown, |
| 324 | data: readmeData.rawData, |
| 325 | depth: 0, |
| 326 | pageType: COMPODOC_DEFAULTS.PAGE_TYPES.ROOT |
| 327 | }); |
| 328 | |
| 329 | // If overview is not disabled, also create separate overview page |
| 330 | if (!Configuration.mainData.disableOverview) { |
| 331 | Configuration.addPage({ |
| 332 | name: 'overview', |
| 333 | context: 'overview', |
| 334 | id: 'overview', |
| 335 | depth: 0, |
| 336 | pageType: COMPODOC_DEFAULTS.PAGE_TYPES.ROOT |
| 337 | }); |
| 338 | } |
| 339 | } else { |
| 340 | // For other markdown files (changelog, contributing, etc.) |
| 341 | Configuration.addPage({ |
| 342 | name: markdowns[i], |
| 343 | context: markdowns[i], |
| 344 | id: markdowns[i], |
| 345 | markdown: readmeData.markdown, |
| 346 | data: readmeData.rawData, |
| 347 | depth: 0, |
| 348 | pageType: COMPODOC_DEFAULTS.PAGE_TYPES.ROOT |
| 349 | }); |
| 350 | Configuration.mainData.markdowns.push({ |
| 351 | name: markdowns[i], |
| 352 | uppername: markdowns[i].toUpperCase(), |
| 353 | depth: 0, |
| 354 | pageType: COMPODOC_DEFAULTS.PAGE_TYPES.ROOT |
| 355 | }); |
| 356 | } |
| 357 | i++; |
| 358 | loop(); |
| 359 | }) |
| 360 | .catch(errorMessage => { |
| 361 | logger.warn(errorMessage); |
| 362 | logger.warn(`Continuing without ${markdowns[i].toUpperCase()}.md file`); |
| 363 | if (markdowns[i] === 'readme') { |
| 364 | if (!Configuration.mainData.disableOverview) { |
| 365 | Configuration.addPage({ |
| 366 | name: 'index', |
| 367 | id: 'index', |
| 368 | context: 'overview', |
nothing calls this directly
no test coverage detected