Skip to content

Commit

Permalink
Allow text files to have a named prefix
Browse files Browse the repository at this point in the history
ie. project-11.project.txt, where 'project' is used to assign a template, while 'project-11' is ignored. The prefix is useful for managing multiple .txt files within an editor.
  • Loading branch information
kolber committed Feb 19, 2011
1 parent df6d9e2 commit aea2677
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/asset-types/page.inc.php
Expand Up @@ -60,7 +60,7 @@ static function template_type($template_file) {
static function template_name($file_path) {
$txts = array_keys(Helpers::list_files($file_path, '/\.txt$/'));
# return first matched .txt file
return (!empty($txts)) ? preg_replace('/\.txt$/', '', $txts[0]) : false;
return (!empty($txts)) ? preg_replace('/([^.]*\.)?([^.]*)\.txt$/', '\\2', $txts[0]) : false;
}

static function template_file($template_name) {
Expand Down

0 comments on commit aea2677

Please sign in to comment.