Closed
Description
In the code, the snipped at the end could be found. This behavior is not working as expected and will lead to issues following in our implementation. The intention was to document pattern groups and subgroups. We have no way to show this documentation, and also the group or subgroup will not be rendered when higher order documentation is available.
We will need a new approach to this special case.
First of all, we need to implement something similar to the pattern documentation but just for the groups and subgroups. Afterward, we need to implement a method to gather this data and place it in the correct position.
For not the code snipped will be removed in #1252 and can be implemented again.
// loadPattern.js : 55
const mp = require('./markdown_parser');
const markdown_parser = new mp();
if (fileObject.ext === '.md') {
try {
const proposedDirectory = path.resolve(
patternlab.config.paths.source.patterns,
fileObject.dir,
fileObject.name
);
const proposedDirectoryStats = fs.statSync(proposedDirectory);
if (proposedDirectoryStats.isDirectory()) {
const subgroupMarkdownFileContents = fs.readFileSync(
proposedDirectory + '.md',
'utf8'
);
const subgroupMarkdown = markdown_parser.parse(
subgroupMarkdownFileContents
);
const subgroupPattern = new Pattern(relPath, null, patternlab);
subgroupPattern.patternSectionSubgroup = true;
subgroupPattern.patternDesc = subgroupMarkdown
? subgroupMarkdown.markdown
: '';
subgroupPattern.flatPatternPath =
subgroupPattern.flatPatternPath + '-' + subgroupPattern.fileName;
subgroupPattern.isPattern = false;
subgroupPattern.engine = null;
patternlab.subgroupPatterns[
subgroupPattern.patternPartial
] = subgroupPattern;
return subgroupPattern;
}
} catch (err) {
// no file exists, meaning it's a pattern markdown file
if (err.code !== 'ENOENT') {
logger.warning(err);
}
}
}