logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject svn commit: r1308262 - in /logging/site/branches/experimental-twig: ./ src/site/pages/
Date Mon, 02 Apr 2012 08:14:06 GMT
Author: ihabunek
Date: Mon Apr  2 08:14:06 2012
New Revision: 1308262

URL: http://svn.apache.org/viewvc?rev=1308262&view=rev
Log:
Renamed templates from .html.twig to .twig. Updated build script.

Added:
    logging/site/branches/experimental-twig/src/site/pages/charter.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/charter.html.twig
    logging/site/branches/experimental-twig/src/site/pages/guidelines.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/guidelines.html.twig
    logging/site/branches/experimental-twig/src/site/pages/index.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/index.html.twig
    logging/site/branches/experimental-twig/src/site/pages/mailing-lists.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/mailing-lists.html.twig
    logging/site/branches/experimental-twig/src/site/pages/privacy-policy.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/privacy-policy.html.twig
    logging/site/branches/experimental-twig/src/site/pages/team-list.twig
      - copied unchanged from r1307356, logging/site/branches/experimental-twig/src/site/pages/team-list.html.twig
Removed:
    logging/site/branches/experimental-twig/src/site/pages/charter.html.twig
    logging/site/branches/experimental-twig/src/site/pages/guidelines.html.twig
    logging/site/branches/experimental-twig/src/site/pages/index.html.twig
    logging/site/branches/experimental-twig/src/site/pages/mailing-lists.html.twig
    logging/site/branches/experimental-twig/src/site/pages/privacy-policy.html.twig
    logging/site/branches/experimental-twig/src/site/pages/team-list.html.twig
Modified:
    logging/site/branches/experimental-twig/build.php

Modified: logging/site/branches/experimental-twig/build.php
URL: http://svn.apache.org/viewvc/logging/site/branches/experimental-twig/build.php?rev=1308262&r1=1308261&r2=1308262&view=diff
==============================================================================
--- logging/site/branches/experimental-twig/build.php (original)
+++ logging/site/branches/experimental-twig/build.php Mon Apr  2 08:14:06 2012
@@ -17,24 +17,26 @@
  * limitations under the License.
  */
 
-require_once 'Twig/Autoloader.php';
-
-Twig_Autoloader::register();
-
-$base = dirname(__FILE__);
+// -- Config ------------------------------------
 
 define('PAGES_DIR', "src/site/pages/");
 define('RESOURCES_DIR', "src/site/resources/");
 define('TEMPLATES_DIR', "src/site/templates/");
 define('TARGET_DIR', "target/site/");
-
 define('POM_PATH', "pom.xml");
 
-$params = parsePOM();
+// -- Init twig ---------------------------------
 
+require 'Twig/Autoloader.php';
+Twig_Autoloader::register();
 $loader = new Twig_Loader_Filesystem(array(TEMPLATES_DIR, PAGES_DIR));
 $twig = new Twig_Environment($loader);
 
+// -- Work --------------------------------------
+
+// Fetch data from pom.xml
+$params = parsePOM();
+
 // Create target dir if needed
 if (!file_exists(TARGET_DIR)) {
 	echo "Creating target directory\n";
@@ -45,11 +47,11 @@ if (!file_exists(TARGET_DIR)) {
 $files = scandir(PAGES_DIR);
 foreach($files as $file) 
 {
-	if (strpos($file, '.twig') !== false) 
+	if (preg_match('/.twig$/', $file)) 
 	{
-		$filename = str_replace('.twig', '', $file);
+		$filename = str_replace('.twig', '.html', $file);
 		$target = TARGET_DIR . $filename;
-		echo "Rendering template: $filename\n";
+		echo "Rendering template: $file\n";
 		
 		$template = $twig->loadTemplate($file);
 		$page = $template->render($params);
@@ -62,6 +64,9 @@ copyDir(RESOURCES_DIR, TARGET_DIR);
 
 echo "Done.\n";
 
+
+// -- Helpers -----------------------------------
+
 /** Extracts information from pom.xml required for rendering the site. */
 function parsePOM()
 {



Mime
View raw message