Ver código fonte

v0.8

Added ability to set template in content meta
Gilbert Pellegrom 11 anos atrás
pai
commit
aa59661ff8
3 arquivos alterados com 17 adições e 5 exclusões
  1. 9 0
      changelog.txt
  2. 7 4
      lib/pico.php
  3. 1 1
      plugins/pico_plugin.php

+ 9 - 0
changelog.txt

@@ -1,5 +1,14 @@
 *** Pico Changelog ***
 
+2013.10.23 - version 0.8
+ * [New] Added ability to set template in content meta
+ * [New] Added before_parse_content and after_parse_content hooks
+ * [Changed] content_parsed hook is now depreciated
+ * [Changed] Moved loading the config to nearer the beginning of the class
+ * [Changed] Only append ellipsis in limit_words() when word count exceeds max
+ * [Changed] Made private methods protected for better inheritance
+ * [Fixed] Fixed get_protocol() method to work in more situations
+
 2013.09.04 - version 0.7
  * [New] Added before_read_file_meta and get_page_data plugin hooks to customize page meta data
  * [Changed] Make get_files() ignore dotfiles

+ 7 - 4
lib/pico.php

@@ -7,7 +7,7 @@ use \Michelf\MarkdownExtra;
  * @author Gilbert Pellegrom
  * @link http://pico.dev7studios.com
  * @license http://opensource.org/licenses/MIT
- * @version 0.7
+ * @version 0.8
  */
 class Pico {
 
@@ -101,8 +101,10 @@ class Pico {
 			'next_page' => $next_page,
 			'is_front_page' => $url ? false : true,
 		);
-		$this->run_hooks('before_render', array(&$twig_vars, &$twig));
-		$output = $twig->render('index.html', $twig_vars);
+
+		$template = (isset($meta['template']) && $meta['template']) ? $meta['template'] : 'index';
+		$this->run_hooks('before_render', array(&$twig_vars, &$twig, &$template));
+		$output = $twig->render($template .'.html', $twig_vars);
 		$this->run_hooks('after_render', array(&$output));
 		echo $output;
 	}
@@ -156,7 +158,8 @@ class Pico {
 			'description' 	=> 'Description',
 			'author' 		=> 'Author',
 			'date' 			=> 'Date',
-			'robots'     	=> 'Robots'
+			'robots'     	=> 'Robots',
+			'template'      => 'Template'
 		);
 
 		// Add support for custom headers by hooking into the headers array

+ 1 - 1
plugins/pico_plugin.php

@@ -79,7 +79,7 @@ class Pico_Plugin {
 		
 	}
 	
-	public function before_render(&$twig_vars, &$twig)
+	public function before_render(&$twig_vars, &$twig, &$template)
 	{
 		
 	}