<commit_before>module Blog::Views
  def layout
    if @render_layout == false
      self << yield
      return
    end

    xhtml11 do
      head do
        meta :'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'
        title "Coderplay #{' - ' + @title if @title}"
        link :rel => 'stylesheet', :type => 'text/css', :href => '/style.css'
        link :rel => 'alternate', :type => 'application/rss+xml', :href => "/rss#{"/#@tag" if @tag != 'Index'}"
        script :src => "/tiny_mce/tiny_mce.js"
        script :src => "/js.js"
      end
      body do
        div.wrap! do
          div.header! do
            h1 do
              a(:href => R(Index), :accesskey => 'I') { span "Coderplay" }
            end
            h2 do
              "The good kind of crazy"
            end
          end

          div.content! do
            menu[:top][:visitor] = []
            menu[:top][:admin] << a('New', :href => self / "/new#{"/#@tag" if @tag != 'Index'}") if logged_in?
            menu[:top][:admin] << a('Assets', :href => "/assets") if logged_in?
            menu[:top][:admin] << 'Logout' if logged_in?
            div.bar! { menu :top } if logged_in?

            @state[:flash] = { :success => [], :errors => [] } unless @state.key? :flash
            unless @state[:flash][:success].empty?
              div.success! do
                ul { @state[:flash][:success].each { |s| li { h s } } }
              end
            end
            @state[:flash][:success] = []

            unless @state[:flash][:errors].empty?
              div.errors! do
                p { "There were some errors:" }
                ul { @state[:flash][:errors].each { |s| li { h s } } }
              end
            end
            @state[:flash][:errors] = []
            
            self << yield
          end

          div.sidebar! do
            h2.first 'Tags'
            p { "Use the links below to browse my past works." }
            p { tags.sort.map { |t| a t, :href => self / "/tag/#{t}" }.join("&nbsp; ") }
            h2 'Search'
            form :action => '/search', :method => :post do
              input :type => :text, :name => :query, :value => @search_query || ''
              input :type => :submit, :class => :submit, :value => 'Search'
            end
#            h2 'Popular works'
#            ["arrow-key-control", "json2html", "rss2htmlvideo"].each do |nickname|
#              post = Models::Post.find_by_nickname(nickname)
#              p { }
            h2 'Feeds'
            p { "<a href='/rss'><img src='/images/feed_icon.png'> RSS feed of all posts<br>" +
             "<a href='/rss/Developers'><img src='/images/feed_icon.png'> RSS feed of software development posts</a><br>" +
             "<a href='/rss/Ruby'><img src='/images/feed_icon.png'> RSS feed of Ruby posts" }
            h2 'About me'
            img(:src => '/images/me.jpg')
            p { "I currently hold the position of Ruby on Rails developer with the award-winning <a href='http://www.katalyst.com.au'>Katalyst Interactive</a> in Adelaide, SA, Australia. My work has been mentioned in the media several times, <a href='/tag/Media'>click here</a> to see them all." }
            p { "You can email me at <a href='mailto:&#105;&#064;&#098;&#108;&#111;&#111;&#112;&#108;&#101;&#046;&#110;&#101;&#116;'>&#105;&#064;&#098;&#108;&#111;&#111;&#112;&#108;&#101;&#046;&#110;&#101;&#116;</a>." }
            p { a('More...', :href => '/read/about') }
            h2 'Recent comments'
            Blog::Models::Comment.find(:all, :order => 'created_at DESC', :limit => 5).each do |c|
              h4 { a(ellipsis(c.body), :href => R(Read, c.post.id) + "#comment-#{c.id}") + " on " + a(c.post.title, :href => R(Read, c.post.id)) }
            end
            #h2 'Twitter posts'
            #text '<script id="feed-1250996587956855" type="text/javascript" src="http://rss.bloople.net/?url=http%3A%2F%2Ftwitter.com%2Fstatuses%2Fuser_timeline%2F15440326.rss&detail=-1&limit=5&showtitle=false&type=js&id=1250996587956855"></script>'
            p { a('More...', :href => 'http://twitter.com/bloopletech') }<commit_msg>Fix missing </a><commit_after>module Blog::Views
  def layout
    if @render_layout == false
      self << yield
      return
    end

    xhtml11 do
      head do
        meta :'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'
        title "Coderplay #{' - ' + @title if @title}"
        link :rel => 'stylesheet', :type => 'text/css', :href => '/style.css'
        link :rel => 'alternate', :type => 'application/rss+xml', :href => "/rss#{"/#@tag" if @tag != 'Index'}"
        script :src => "/tiny_mce/tiny_mce.js"
        script :src => "/js.js"
      end
      body do
        div.wrap! do
          div.header! do
            h1 do
              a(:href => R(Index), :accesskey => 'I') { span "Coderplay" }
            end
            h2 do
              "The good kind of crazy"
            end
          end

          div.content! do
            menu[:top][:visitor] = []
            menu[:top][:admin] << a('New', :href => self / "/new#{"/#@tag" if @tag != 'Index'}") if logged_in?
            menu[:top][:admin] << a('Assets', :href => "/assets") if logged_in?
            menu[:top][:admin] << 'Logout' if logged_in?
            div.bar! { menu :top } if logged_in?

            @state[:flash] = { :success => [], :errors => [] } unless @state.key? :flash
            unless @state[:flash][:success].empty?
              div.success! do
                ul { @state[:flash][:success].each { |s| li { h s } } }
              end
            end
            @state[:flash][:success] = []

            unless @state[:flash][:errors].empty?
              div.errors! do
                p { "There were some errors:" }
                ul { @state[:flash][:errors].each { |s| li { h s } } }
              end
            end
            @state[:flash][:errors] = []
            
            self << yield
          end

          div.sidebar! do
            h2.first 'Tags'
            p { "Use the links below to browse my past works." }
            p { tags.sort.map { |t| a t, :href => self / "/tag/#{t}" }.join("&nbsp; ") }
            h2 'Search'
            form :action => '/search', :method => :post do
              input :type => :text, :name => :query, :value => @search_query || ''
              input :type => :submit, :class => :submit, :value => 'Search'
            end
#            h2 'Popular works'
#            ["arrow-key-control", "json2html", "rss2htmlvideo"].each do |nickname|
#              post = Models::Post.find_by_nickname(nickname)
#              p { }
            h2 'Feeds'
            p { "<a href='/rss'><img src='/images/feed_icon.png'> RSS feed of all posts<br>" +
             "<a href='/rss/Developers'><img src='/images/feed_icon.png'> RSS feed of software development posts</a><br>" +
             "<a href='/rss/Ruby'><img src='/images/feed_icon.png'> RSS feed of Ruby posts</a>" }
            h2 'About me'
            img(:src => '/images/me.jpg')
            p { "I currently hold the position of Ruby on Rails developer with the award-winning <a href='http://www.katalyst.com.au'>Katalyst Interactive</a> in Adelaide, SA, Australia. My work has been mentioned in the media several times, <a href='/tag/Media'>click here</a> to see them all." }
            p { "You can email me at <a href='mailto:&#105;&#064;&#098;&#108;&#111;&#111;&#112;&#108;&#101;&#046;&#110;&#101;&#116;'>&#105;&#064;&#098;&#108;&#111;&#111;&#112;&#108;&#101;&#046;&#110;&#101;&#116;</a>." }
            p { a('More...', :href => '/read/about') }
            h2 'Recent comments'
            Blog::Models::Comment.find(:all, :order => 'created_at DESC', :limit => 5).each do |c|
              h4 { a(ellipsis(c.body), :href => R(Read, c.post.id) + "#comment-#{c.id}") + " on " + a(c.post.title, :href => R(Read, c.post.id)) }
            end
            #h2 'Twitter posts'
            #text '<script id="feed-1250996587956855" type="text/javascript" src="http://rss.bloople.net/?url=http%3A%2F%2Ftwitter.com%2Fstatuses%2Fuser_timeline%2F15440326.rss&detail=-1&limit=5&showtitle=false&type=js&id=1250996587956855"></script>'
            p { a('More...', :href => 'http://twitter.com/bloopletech') }
{'fraction_non_alphanumeric': 0.1891075957010023, 'fraction_numerical': 0.034295374954715616, 'mean_word_length': 1.986657050126217, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2784492', 'n_tokens_mistral': 2854, 'n_tokens_neox': 2605, 'n_words': 636}