Permalink
Browse files

Parse the .details files the get the demo name

  • Loading branch information...
1 parent b10e460 commit 4342d6dc43bf2481089066a6d6b4ca69dcf31dc8 @arian arian committed Dec 21, 2010
Showing with 1,054 additions and 6 deletions.
  1. BIN Source/mootools-more-1.3-full.js
  2. +11 −6 assets/demo.php
  3. +1,024 −0 libs/spyc.php
  4. +19 −0 libs/yaml.php
Binary file not shown.
View
@@ -1,14 +1,18 @@
<?php
-$path = dirname(__FILE__) . '/../demos/' . $_GET['demo'] . '/';
+include dirname(__FILE__) . '/../libs/yaml.php';
+$path = dirname(__FILE__) . '/../demos/' . $_GET['demo'] . '/';
$details = file_get_contents($path . 'demo.details');
-preg_match('/\/\*\s*^---(.*?)^\.\.\.\s*\*\//ms', $details, $matches);
-$header = $matches[1];
-
preg_match('/\/\*\s*^---(.*?)^\.\.\.\s*\*\/(.*)/ms', $details, $matches);
-$description = $matches[2];
+
+$descriptor = array();
+
+if (!empty($matches)){
+ $descriptor = YAML::decode($matches[1]);
+ $description = $matches[2];
+}
$html = file_get_contents($path . 'demo.html');
$css = file_get_contents($path . 'demo.css');
@@ -38,7 +42,8 @@
<button type="submit" class="button">Edit with jsFiddle</button>
<div id="description">
- <?php echo $description; ?>
+ <?php if (!empty($descriptor['name'])): echo '<h2>' . $descriptor['name'] . '</h2>'; endif; ?>
+ <?php if (!empty($description)): echo $description; endif; ?>
</div>
<ul class="tabs">
Oops, something went wrong.

0 comments on commit 4342d6d

Please sign in to comment.