Skip to content

Commit

Permalink
Adding to MD docs Yaml meta settings: hidden, noviewall that work. Ad…
Browse files Browse the repository at this point in the history
…ding for future use: order, tags, links. (#137)
  • Loading branch information
EvanLovely authored Oct 12, 2017
1 parent d703ad2 commit 69c5471
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/PatternLab/PatternData/Rules/DocumentationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,24 @@ public function run($depth, $ext, $path, $pathName, $name) {
"meta" => $yaml,
"full" => $doc);

// can set `title: My Cool Pattern` instead of lifting from file name
if (isset($title)) {
$patternStoreData["nameClean"] = $title;
}

if (isset($yaml["state"])) {
$patternStoreData["state"] = $yaml["state"];
$availableKeys = [
'state', // can use `state: inprogress` instead of `[email protected]`
'hidden', // setting to `true`, removes from menu and viewall, which is same as adding `_` prefix
'noviewall', // setting to `true`, removes from view alls but keeps in menu, which is same as adding `-` prefix
'order', // @todo implement order
'tags', // not implemented, awaiting spec approval and integration with styleguide kit. adding to be in sync with Node version.
'links', // not implemented, awaiting spec approval and integration with styleguide kit. adding to be in sync with Node version.
];

foreach ($availableKeys as $key) {
if (isset($yaml[$key])) {
$patternStoreData[$key] = $yaml[$key];
}
}

// if the pattern data store already exists make sure this data overwrites it
Expand Down

0 comments on commit 69c5471

Please sign in to comment.