Skip to content
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c976fa4
making sure pattern type properly loads globalData var
dmolsen Jul 28, 2016
7dd6d48
install assets and save path appropriately
dmolsen Jul 28, 2016
884c995
Updating global data to use `yml` or `yaml`
EvanLovely Oct 31, 2016
44c0dd0
Fixing extra closing parentheses so dev branch works. Addresses https…
bolt-bot Apr 27, 2017
0c30ad1
Merge pull request #1 from drupal-pattern-lab/feature/fix-parse-error
EvanLovely May 9, 2017
d7506a0
Adding in lineage fix for PL when using Twig templates + line by line…
bolt-bot May 10, 2017
a1d3781
Merge pull request #4 from drupal-pattern-lab/patch-4
sghoweri May 19, 2017
a46d571
Merge pull request #6 from drupal-pattern-lab/dev
EvanLovely May 22, 2017
505f32c
updating composer to use Drupal Pattern Lab name
EvanLovely May 24, 2017
8a51a73
updating config path to use our vendor name
EvanLovely May 24, 2017
d45a334
Revert "updating config path to use our vendor name"
EvanLovely May 25, 2017
b6c7409
Revert "updating composer to use Drupal Pattern Lab name"
EvanLovely May 25, 2017
ad10d44
updating info
EvanLovely May 25, 2017
9b31f31
Merge branch 'master' into dev
EvanLovely May 25, 2017
741ebb7
Don't overwrite nameClean if it has already been set
aleksip Jun 19, 2017
4ae8878
Replace possible dots in pattern names with dashes
aleksip Jun 19, 2017
c8428db
Merge pull request #9 from aleksip/replace-pattern-name-dots-with-dashes
EvanLovely Jun 20, 2017
34fa945
Merge branch 'dev'
EvanLovely Jun 20, 2017
407f7bb
Merge pull request #5 from drupal-pattern-lab/feature/fix-pattern-lab…
EvanLovely Jun 20, 2017
5b2a789
Merge pull request #8 from aleksip/pseudo-pattern-nameclean
EvanLovely Jun 20, 2017
2db3557
Merge branch 'dev'
EvanLovely Jun 20, 2017
60fc319
Enabling the ability for Pattern Lab to follow any symlinks that may …
bolt-bot Jul 1, 2017
1fa44ec
Merge pull request #10 from drupal-pattern-lab/feature/follow-symlinks
EvanLovely Jul 12, 2017
49317d6
feature: add ability for Pattern Lab to automatically compile inline …
bolt-bot Sep 3, 2017
2dd2a67
Updating template logic to also merge together global / local data
bolt-bot Sep 3, 2017
0bf6982
Fix: swapping global / local data merge so local data overrides globa…
bolt-bot Sep 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feature: add ability for Pattern Lab to automatically compile inline …
…templates / patterns embedded in markdown files. Living Design System docs FTW
  • Loading branch information
bolt-bot committed Sep 3, 2017
commit 49317d6789f4882bfa917bce0334b3c61bdbbb29
35 changes: 32 additions & 3 deletions src/PatternLab/PatternData/Rules/DocumentationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use \PatternLab\PatternData;
use \PatternLab\Parsers\Documentation;
use \PatternLab\Timer;
use \PatternLab\Data;
use \PatternLab\PatternData\Exporters\PatternPathSrcExporter;
use \PatternLab\PatternEngine;

class DocumentationRule extends \PatternLab\PatternData\Rule {

Expand Down Expand Up @@ -49,8 +52,7 @@ public function run($depth, $ext, $path, $pathName, $name) {

// parse data
$text = file_get_contents($patternSourceDir.DIRECTORY_SEPARATOR.$pathName);
list($yaml,$markdown) = Documentation::parse($text);


// grab the title and unset it from the yaml so it doesn't get duped in the meta
if (isset($yaml["title"])) {
$title = $yaml["title"];
Expand All @@ -73,7 +75,34 @@ public function run($depth, $ext, $path, $pathName, $name) {

$category = ($patternSubtypeDoc) ? "patternSubtype" : "pattern";
$patternStoreKey = ($patternSubtypeDoc) ? $docPartial."-plsubtype" : $docPartial;


/**
* Setup the Pattern Loader so we can pre-render template markup used
* in our markdown files, prior to any markup getting parsed.
* Taken from Builder.php
*/
$ppdExporter = new PatternPathSrcExporter();
$patternPathSrc = $ppdExporter->run();
$options = array();
$options["patternPaths"] = $patternPathSrc;
$patternEngineBasePath = PatternEngine::getInstance()->getBasePath();
$patternLoaderClass = $patternEngineBasePath . "\Loaders\PatternLoader";
$patternLoader = new $patternLoaderClass($options);


// Setup the default pattern data.
$data = Data::getPatternSpecificData($patternStoreKey);

// Render the markdown content as a pattern, piping in the pattern-specific data from above.
$text = $patternLoader->render(array(
"pattern" => $text,
"data" => $data
));

// Finally parse the resulting content as normal markup; continue as usual.
list($yaml,$markdown) = Documentation::parse($text);


$patternStoreData = array("category" => $category,
"desc" => trim($markdown),
"descExists" => true,
Expand Down