Updating generator for multiple files.
This commit is contained in:
parent
996225a9f4
commit
9d55ea8034
|
@ -11,6 +11,8 @@
|
|||
<delete dir="${basedir}/bootstrap"/>
|
||||
<delete dir="${basedir}/screenshots"/>
|
||||
<delete dir="${basedir}/sublimeui"/>
|
||||
<delete dir="${basedir}/xcode"/>
|
||||
<delete dir="${basedir}/highlightjs"/>
|
||||
</target>
|
||||
|
||||
<!-- Generate themes. -->
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue