diff --git a/build.xml b/build.xml
index f647e83..c60cfd8 100644
--- a/build.xml
+++ b/build.xml
@@ -11,6 +11,8 @@
+
+
diff --git a/build/src/Raincolour/Core/Processor.php b/build/src/Raincolour/Core/Processor.php
index cfb9a85..6e74620 100644
--- a/build/src/Raincolour/Core/Processor.php
+++ b/build/src/Raincolour/Core/Processor.php
@@ -245,7 +245,8 @@ class Processor
$path[] = $pattern->get('directory');
$path[] = $theme->get('theme.dir');
$path[] = $template->get('directory');
- $path[] = $theme->get('theme.slug').$template->get('extension');
+ $name = $this->buildFileName($template->get('name'), $theme);
+ $path[] = $name.$template->get('extension');
// Concatonate paths with a slash.
$path = implode('/', $path);
@@ -253,4 +254,27 @@ class Processor
// Trim extra slashes, just for fun.
return preg_replace('/\/+/', '/', $path);
}
+
+ /**
+ * Replace theme name placeholders.
+ *
+ * @param string $name
+ * @param Raincolor\Containers\Theme $theme
+ * @return string
+ */
+ protected function buildFileName($name, $theme)
+ {
+ if ($name == null) {
+ return $theme->get('theme.slug');
+ }
+ preg_match('/%(.+)%/i', $name, $matches);
+ foreach ($matches as $match) {
+ if (strpos($match, '%') !== false) {
+ $key = trim($match, '%');
+ $value = $theme->get($key);
+ $name = str_replace($match, $value, $name);
+ }
+ }
+ return $name;
+ }
}