]> git.quilime.com - plog_bk.git/commitdiff
static generator
authorGabriel Dunne <gdunne@quilime.com>
Wed, 23 Jun 2010 06:15:38 +0000 (23:15 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Wed, 23 Jun 2010 06:15:38 +0000 (23:15 -0700)
14 files changed:
.htaccess
css/style.css
js/js.js [new file with mode: 0644]
js/prettify/prettify.css
lib/data.php
lib/init.php
lib/output.php
lib/scripts/log [new file with mode: 0755]
lib/static.php [new file with mode: 0644]
templates/about.html
templates/index.html
templates/links.html
templates/log.html
templates/nav.html

index bef083f540a74d269188095e2a041b7c131d9b37..a57877b5bb07b5dfb48998d77d239a1520d04548 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -4,6 +4,6 @@
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
-#RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . index.php [L]
 </IfModule>
index 677585e7ba0625a366b24043d8d183e0338a5655..f84fab6c82a6a50010e8451ded45a14d26a7c7a8 100644 (file)
@@ -1,5 +1,6 @@
 body { margin:80px 100px 50px 40px; }
-html, body, table { font-family: times, helvetica, sans; font-size:15px; line-height:1.3em; color:#999; }
+html, body, table { font-family: monaco, monospace; font-size:12px; line-height:1.6em; color:#444; }
+
 
 .nav { position:absolute; z-index:1; top:20px; left:20px;  }
 .nav ul { margin-left:1em; }
@@ -12,18 +13,20 @@ html, body, table { font-family: times, helvetica, sans; font-size:15px; line-he
 ::selection {background: #08f !important; color:#fff;} 
 
 /*links*/
-a { color:#555; border:0; padding:0.2em 0.1em 0.1em 0em; font-weight:bold; text-decoration:none; }
+a { color:#555; border:0; padding:0.2em 0.1em 0 0; font-weight:bold;  }
 a img { border:0; }
-a.mute { }
-a:hover, a.mute:hover { color:#d15; border-bottom:2px solid #d15;  text-decoration:none;  }
+a.mute { text-decoration:none !important; }
+a:hover, a.mute:hover { color:#d15; }
 
 /*headings*/
-h1, h2, h3, h4, h5, h6 {  font-size:1.3em; }
+h1, h2, h3, h4, h5, h6 {  font-size:1.2em; }
 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration:none; }
 h1 { margin:0 0 3em 0; font-size:2em;}
 h2 { margin:4em 0 0.5em 0;  }
 h3 { margin:0 0 0 0; }
 
+ol li { list-style-type:decimal; }
+
 blockquote { font-family:times; background:#000; color:#aaa;
 margin:0; font-size:15px; line-height:1.4em; padding:2em 4em; font-style:italic; line-height:1.45em; max-width:600px;}
 
@@ -52,7 +55,7 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;
     ul.inline_content {}
     ul.inline_content li .content { } 
     ul.inline_content li { margin:0 0 150px 0; }
-    ul.inline_content li h3 { border-bottom:2px solid #ddd; }
+    ul.inline_content li h3 { margin-bottom:1em; border-bottom:1px solid #ddd; padding-bottom:4px; }
     ul.inline_content ol li { margin:0; padding:0; border:0;}
     ul.thumbnails    { }
     ul.thumbnails li { display:inline-block; margin: 0px 60px 60px 0px; }
@@ -67,8 +70,8 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;
     ul.thumbnails .title {  }
     
     .date { color:#ccc;}    
-       .func { margin-bottom:2em; }
-       .func a { background:#daa;  padding:0.2em 1em 0.02em 1em; font-size:9px; text-transform:uppercase;}
+    .func { margin-bottom:2em; }
+    .func a { background:#daa;  padding:0.2em 1em 0.02em 1em; font-size:9px; text-transform:uppercase;}
 
     .text { font-family:serif; font-size:15px; line-height:2.2em;  margin-top:80px;}
     .indent { text-indent:3em; }
@@ -83,5 +86,3 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;
 
 #footer {  margin-top:120px; }    
 #footer .copy a { text-decoration:none; }
-
-
diff --git a/js/js.js b/js/js.js
new file mode 100644 (file)
index 0000000..e69de29
index 87ec1aff7873095fd64f4f326528464c4c2fe40b..f38550c729ddb52ad19be7229cc3564477f93665 100755 (executable)
@@ -1,21 +1,21 @@
 /* Pretty printing styles. Used with prettify.js. */
 
 .str { color: #f26; } 
-.kwd { color: #444; font-weight:bold;  } 
+.kwd { color: #99f; font-weight:bold;  } 
 .com { color: #888; font-style:italic; }
-.typ { color: #606; }
-.lit { color: #066; }
-.pun { color: #660; }
-.pln { color: #444; }
+.typ { color: #f0f; }
+.lit { color: #099; }
+.pun { color: #66d; }
+.pln { color: #ffd; }
 .tag { color: #008; }
 .atn { color: #606; }
 .atv { color: #080; }
 .dec { color: #606; }
-pre.prettyprint, code.prettyprint { font-family:monaco, "Lucida Console", monospace; font-size:11px; line-height:1.6em; padding:0.3em 0.5em; background:#e9e9e9;
--moz-border-radius: 4px;
--webkit-border-radius: 4px;
+pre.prettyprint, code.prettyprint { font-family:monaco, "Lucida Console", monospace; font-size:12px; line-height:2em; padding:0.4em 0.6em; background:#322323;
+-moz-border-radius: 8px;
+-webkit-border-radius: 8px;
 }
-pre.prettyprint { padding:20px; }
+pre.prettyprint { padding:20px; line-height:1.4em; }
 
 @media print {
   .str { color: #060; }
index 6d0f23dfd4baff4a1d7e361ffb2eb01935c17004..df828523baf662e4b5bea0792dee1a08fbd0b32a 100644 (file)
         
         $content = array();
         $glob = glob( CONTENT_DIR . $path . '/*' );
+
         
         foreach ($glob as $c) {
             if (is_file($c . $config) || is_dir($c . $config)) {
                 $config_array = parse_config($c . $config);
                 if ($config_array['title'] && $config_array['hide'] != "true") {
                     $content[] = $config_array;
-                }                    
+                }
             }
-        }                
+        }
         return array(array_reverse($content), count($content));
     }
     
index b7599d4f8cbe6de744532d26279504ad9dc7b98a..7807a1740c922989a1bd7dc9d81077281bb4a30e 100644 (file)
@@ -1,9 +1,18 @@
 <?php 
+
+    putenv("TZ=America/Los_Angeles");
     
-    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . LOCAL_ROOT . '/lib/');
-    
+       ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(realpath(__FILE__)));
+
+       define ('SITE_TITLE', 'quilime');
+       define ('LOCAL_ROOT', '/home/quilime/quilime.com/');
+       define('WEB_ROOT', 'http://quilime.com/');
+       define ('CONTENT_DIR', 'content/');
+       define ('TEMPLATE_DIR', 'templates/');
+       define ('CONFIG_DELIMITER', '--');      
+       
     require_once 'data.php';
-    require_once 'output.php';
+    require_once 'output.php'; 
     
     define_constants();
     
index 14a8673a4b05cdb16235d00081167743e143529d..386713e036c1191f37ae01c28358575fec5eae12 100644 (file)
         $format = empty($format) ? $default : $format;
         return array($format, $types[$format]);
     }
+
+
+       if( !function_exists('parse_ini_string') ) {
+           function parse_ini_string( $string ) {
+               $array = Array();
+               $lines = explode("\n", $string );
+               foreach( $lines as $line ) {
+                   $statement = preg_match("/^(?!;)(?P<key>[\w+\.\-]+?)\s*=\s*(?P<value>.+?)\s*$/", $line, $match );
+                   if( $statement ) {
+                       $key    = $match[ 'key' ];
+                       $value    = $match[ 'value' ];
+                       # Remove quote
+                       if( preg_match( "/^\".*\"$/", $value ) || preg_match( "/^'.*'$/", $value ) ) {
+                           $value = mb_substr( $value, 1, mb_strlen( $value ) - 2 );
+                       }
+                       $array[ $key ] = $value;
+                   }
+               }
+               return $array;
+           }
+       }
     
     
     function get_url_parts()
diff --git a/lib/scripts/log b/lib/scripts/log
new file mode 100755 (executable)
index 0000000..d3f5eb2
--- /dev/null
@@ -0,0 +1,3 @@
+FILE=$(date +%Y"-"%m"-"%d_$1)
+echo -e "title = $1\ndate = `date +%Y"-"%m"-"%d`\nhide = true\n--\n\n" > $FILE
+emacs $FILE
\ No newline at end of file
diff --git a/lib/static.php b/lib/static.php
new file mode 100644 (file)
index 0000000..efb18fa
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+
+       include 'init.php';
+       
+       list($entries, $total_entries) = get_inline_entries(array('log', 'code'));
+
+       echo '<ol>';
+       foreach ($entries as $e)
+       {
+               echo '<li><a href="'.$e['url'].'">'.$e['title'].' - '.$e['date'].'</a></li>';
+       }
+       echo '</ol>';
+       
+       
+       # parse inline content
+       function get_inline_entries( $sources )
+       {
+               $result = array();
+               $result_total = 0;
+               foreach ($sources as $dir) {
+                       $contents = glob(LOCAL_ROOT . CONTENT_DIR . $dir . '/*');
+                       foreach ($contents as $f) {
+                               if (!is_dir($f)) {
+                                       $file_contents = explode("\n", file_get_contents($f, FILE_USE_INCLUDE_PATH));
+                                       $cc = "";
+                                       $content = "";                                  
+                                       $conf = true;
+                                       foreach ( $file_contents as $fc ) {
+                                               if ($fc == CONFIG_DELIMITER) {  
+                                                       $conf = false;
+                                                       continue;
+                                               }
+                                               if ($conf) $cc .= $fc . "\n";
+                                               else $content .= $fc . "\n";
+                                       }
+                                       $config = parse_ini_string($cc);
+                                       
+                                       $config['url'] = WEB_ROOT . $dir . DIRECTORY_SEPARATOR . basename($f);
+                                       $config['timestamp'] = mktime($config['date']);
+                                       $config['category'] = $dir;
+                                       $config['content'] = $content;
+                                       $config['tags'] = explode(' ', $config['tags']);
+                                       
+                                       $result[] = $config;
+                                       $result_total++;
+                               }
+                       }
+               }
+               
+               // order by date
+               foreach ($result as $key => $row) {
+                   $time[$key]  = $row['date'];
+               }
+               array_multisort($time, SORT_DESC, $result);
+               
+               return array($result, $result_total);
+       }
+
+
+
+       $files = glob('../content/log/*');
+       
+       $result = array();
+       $result['count'] = 0;
+       foreach ($files as $f)
+       {
+               if (!is_dir($f)) {
+                       
+                       $config_settings = explode("\n", file_get_contents($f, FILE_USE_INCLUDE_PATH));
+                       
+                       $cc = "";
+                       $content = "";
+                       $past_conf = false;
+               foreach ( $config_settings as $c ) {    
+                               if ($c == CONFIG_DELIMITER) {
+                                       $past_conf = true;
+                                       continue;
+                               }
+                               if ($past_conf) $content .= $c . "\n";
+                               else $cc .= $c . "\n";                          
+                       }
+                       $config = parse_ini_string($cc);
+                       $config['content'] = $content;                  
+                       
+                       if ($config['hide'] == 'true')
+                               continue;
+                                               
+                       $result['count'] += 1;
+                       $result['entries'][] = $config;
+                       
+//                     print_r($cc);
+//                     echo "content: " . $content;
+                       
+//                     echo $config;
+//                     echo "\n";
+               }                       
+       }
+       
+//     echo json_encode($result);
+       
+//     print_r($entries);
+
+
+
+
+
+?>
\ No newline at end of file
index e58377b49a50322cf8e8220ac92128bc859dc542..21784ec2fe3c7d50ff10cc42dc6817a55df99378 100644 (file)
@@ -18,7 +18,7 @@
        
         <p>
                
-                       quilime is a continually growing codification of exploration, resource, and creativity.
+                       quilime is a codification of exploration, resources, and creativity.
                        <br/>
                        <br/>
                        author: gabriel dunne (<a href="&#x6d;&#x61;&#x69;&#108;&#x74;&#111;&#x3a;&#x67;&#x64;&#x75;&#x6e;&#110;&#x65;&#x40;&#x71;&#117;&#105;&#x6c;&#x69;&#x6d;&#101;&#x2e;&#x63;&#111;&#x6d;">email</a>, <a href="http://gabrieldunne.com">www</a>)
index 100c4a0a7dd83e4bf99e43c5a64c752ecd845bec..07d581d7a7c4164649a8f13b591d5b361dc0e8fc 100644 (file)
@@ -13,8 +13,6 @@
     <? include_template('nav.html'); ?>
     
 <div id="content">
-       <--- navigation
-</div>
-    
+<--- nav    
 </body>
 </html>
index 50f7b45052de21052305f7b97b6901d55960a74a..55a769d9083df78d39995444b8d764c97030971f 100644 (file)
@@ -25,7 +25,7 @@
             function linklist($links)
             { ?>
                 <?php foreach($links as $l) : ?>
-                <li><a href="<?php echo $l[0];?>"><?php echo $l[0];?></a></li>
+                <li><a href="http://<?php echo $l[0];?>"><?php echo $l[0];?></a></li>
                 <?php endforeach; ?>
             <?php
             }
index 749647c1ed654f3ab55aedb9cfe959d63aef2236..491c805a8e0880babb8795b6bf87ebc3dc8c1ee1 100644 (file)
@@ -1,4 +1,4 @@
-t<?php
+<?php
 
     $single = false;
     
@@ -41,9 +41,9 @@ t<?php
         <?php if ($single) : ?>
 
                <h1>
-                   <a title="<?php echo get_relative_time($log['timestamp']); ?>" href="<?php echo $log['href'];?>">
+                   <a title="posted <?php echo get_relative_time($log['timestamp']); ?>" href="<?php echo $log['href'];?>">
                        <?php echo $log['title']; ?>
-                               </a><small>[<?=get_relative_time($log['timestamp']);?>]</small>
+                               </a><small>[<?php echo date("Y M d", strtotime($log['date']));?>]</small>
                </h1>
        
                        
index 411f6414ce9dd3621eda2646ecb80c10eba636e3..57688baede8c2097c2edd9f3704028e420d39a8a 100644 (file)
@@ -1,9 +1,8 @@
 <ul class="nav">          
        <li><a href="/">home</a><br/><br/></li>
+    <li><a href="/about/">about</a></li>
     <li><a href="/log/">log</a></li>
-    <li><a href="/projects/">projects</a></li>
+    <li><a href="/agg/">aggregate</a></li>
     <li><a href="/code/">code</a></li>
     <li><a href="/links/">links</a></li>
-    <li><a href="/agg/">aggregate</a></li>
-    <li><a href="/about/">about</a></li>    
 </ul>