|  | @@ -43,12 +43,15 @@ import yaml # in debian python-yaml
 | 
	
		
			
				|  |  |  from StringIO import StringIO
 | 
	
		
			
				|  |  |  import codecs
 | 
	
		
			
				|  |  |  from jinja2 import Environment, FileSystemLoader # in debian python-jinja2
 | 
	
		
			
				|  |  | -import markdown as markdown2
 | 
	
		
			
				|  |  | +try:
 | 
	
		
			
				|  |  | +    import markdown2
 | 
	
		
			
				|  |  | +except ImportError:
 | 
	
		
			
				|  |  | +    import markdown as markdown2
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import argparse
 | 
	
		
			
				|  |  |  import sys
 | 
	
		
			
				|  |  |  from distutils import dir_util
 | 
	
		
			
				|  |  |  import shutil
 | 
	
		
			
				|  |  | -import pdb
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  CONFIG = {
 | 
	
		
			
				|  |  |      'content_root': 'content', # where the markdown files are
 | 
	
	
		
			
				|  | @@ -78,6 +81,18 @@ GLOBAL_TEMPLATE_CONTEXT = {
 | 
	
		
			
				|  |  |    <a title="Twitter" href="https://twitter.com/#!/OzNTiram">twitter</a>
 | 
	
		
			
				|  |  |    <a title="Stackoverflow" href="http://stackoverflow.com/users/492620/oz123">stackoverflow</a>
 | 
	
		
			
				|  |  |    <a title="Github" href="https://github.com/oz123">github</a>
 | 
	
		
			
				|  |  | +  <script type="text/javascript"><!--
 | 
	
		
			
				|  |  | +      google_ad_client = "ca-pub-2570499281263620";
 | 
	
		
			
				|  |  | +      /* new_tower_for_oz123githubcom */
 | 
	
		
			
				|  |  | +      google_ad_slot = "8107518414";
 | 
	
		
			
				|  |  | +      google_ad_width = 120;
 | 
	
		
			
				|  |  | +      google_ad_height = 600;
 | 
	
		
			
				|  |  | +      //-->
 | 
	
		
			
				|  |  | +  </script>
 | 
	
		
			
				|  |  | +  <script type="text/javascript"
 | 
	
		
			
				|  |  | +      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
 | 
	
		
			
				|  |  | +  </script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </div>
 | 
	
		
			
				|  |  |      """,
 | 
	
		
			
				|  |  |      'google_analytics':"""
 | 
	
	
		
			
				|  | @@ -203,7 +218,7 @@ class Entry(object):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @property
 | 
	
		
			
				|  |  |      def body_html(self):
 | 
	
		
			
				|  |  | -        return markdown2.markdown(self.body, extras=['code-color'])
 | 
	
		
			
				|  |  | +        return markdown2.markdown(self.body)#, extras=['code-color'])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @property
 | 
	
	
		
			
				|  | @@ -238,7 +253,7 @@ class Entry(object):
 | 
	
		
			
				|  |  |          body = list()
 | 
	
		
			
				|  |  |          for line in file.readlines():
 | 
	
		
			
				|  |  |              body.append(line)
 | 
	
		
			
				|  |  | -        self.body = '\n'.join(body)
 | 
	
		
			
				|  |  | +        self.body = ''.join(body)
 | 
	
		
			
				|  |  |          file.close()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if self.kind == 'link':
 | 
	
	
		
			
				|  | @@ -261,19 +276,13 @@ class Entry(object):
 | 
	
		
			
				|  |  |          except:
 | 
	
		
			
				|  |  |              pass
 | 
	
		
			
				|  |  |          context = GLOBAL_TEMPLATE_CONTEXT.copy()
 | 
	
		
			
				|  |  | -        print "context"
 | 
	
		
			
				|  |  | -        print context
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          context['entry'] = self
 | 
	
		
			
				|  |  | -        print "entry", context['entry']
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          template = jinja_env.get_template("entry.html")
 | 
	
		
			
				|  |  | -        print "template" , template
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  | -        #print dir(template)
 | 
	
		
			
				|  |  | -        #raw_input()
 | 
	
		
			
				|  |  |          html = template.render(context)
 | 
	
		
			
				|  |  | -        print "in render", self.destination
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |          destination = codecs.open(self.destination, 'w', CONFIG['content_encoding'])
 | 
	
		
			
				|  |  |          destination.write(html)
 | 
	
		
			
				|  |  |          destination.close()
 | 
	
	
		
			
				|  | @@ -405,14 +414,12 @@ def build():
 | 
	
		
			
				|  |  |      print
 | 
	
		
			
				|  |  |      print " site wide index"
 | 
	
		
			
				|  |  |      entries = _sort_entries(entries)
 | 
	
		
			
				|  |  | -    #render_index(_sort_entries(entries))
 | 
	
		
			
				|  |  |      render_index(entries)
 | 
	
		
			
				|  |  |      print "................done"
 | 
	
		
			
				|  |  |      print " archive index"
 | 
	
		
			
				|  |  |      render_archive(entries)
 | 
	
		
			
				|  |  |      print "................done"
 | 
	
		
			
				|  |  |      print " site wide atom feeds"
 | 
	
		
			
				|  |  | -    #render_atom_feed(_sort_entries(entries))
 | 
	
		
			
				|  |  |      render_atom_feed(entries)
 | 
	
		
			
				|  |  |      print "...........done"
 | 
	
		
			
				|  |  |      print
 | 
	
	
		
			
				|  | @@ -462,11 +469,9 @@ if __name__== '__main__':
 | 
	
		
			
				|  |  |      if len(sys.argv) < 2 :
 | 
	
		
			
				|  |  |          parser.print_help()
 | 
	
		
			
				|  |  |          sys.exit()
 | 
	
		
			
				|  |  | -    #import pdb; pdb.set_trace()
 | 
	
		
			
				|  |  |      if args.clean:
 | 
	
		
			
				|  |  |          clean()
 | 
	
		
			
				|  |  |      if args.build:
 | 
	
		
			
				|  |  | -        #pdb.set_trace()
 | 
	
		
			
				|  |  |          build()
 | 
	
		
			
				|  |  |      if args.preview:
 | 
	
		
			
				|  |  |          preview()
 |