Skip to content

Commit

Permalink
new publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ivl committed Jun 7, 2011
1 parent 990757d commit 15dc989
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 2011/06/07/first-blog-entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<header>
<h2>my first post</h2>
<time>07.06.2011</time>
<h3>Tags: alpha</h3>
<header>

<p>Test message</p>
Expand All @@ -31,9 +32,12 @@ <h2><a href="/#/2011/06/07/first-blog-entry">Back</a></h2>
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</footer>
</article>

<p>Tag cloud <span style='font-size: 66%'><a href='/tags/beta/'>beta</a></span>
<span style='font-size: 133%'><a href='/tags/alpha/'>alpha</a></span>
</p>
</footer>
</article>

</section>
</body>
Expand Down
44 changes: 44 additions & 0 deletions 2011/06/08/second-blog-entry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
</head>

<body>
<section>
<article>

<header>
<h2>Second post</h2>
<time>08.06.2011</time>
<h3>Tags: alpha</h3>
<header>

<p>Second blog entry</p>

<footer>
<h2><a href="/#/2011/06/08/second-blog-entry">Back</a></h2>
<!-- Disqus comments engine -->
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'ivlgithubblog';
var disqus_title = 'Second post';
var disqus_url = 'http://ivl.github.com' + '/2011/06/08/second-blog-entry.html';
var disqus_id = '/2011/06/08/second-blog-entry';

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<p>Tag cloud <span style='font-size: 66%'><a href='/tags/beta/'>beta</a></span>
<span style='font-size: 133%'><a href='/tags/alpha/'>alpha</a></span>
</p>
</footer>
</article>

</section>
</body>
</html>
74 changes: 74 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

require 'webrick'
require "term/ansicolor"
require "jekyll"

task :default => :tag_cloud

desc 'Generate tags page'
task :tags do
puts "Generating tags..."
require 'rubygems'
require 'jekyll'
include Jekyll::Filters

options = Jekyll.configuration({})
site = Jekyll::Site.new(options)
site.read_posts('')

FileUtils.rm_rf "tags"

site.tags.sort.each do |tag, posts|
html = ''
html << <<-HTML
---
layout: default
title: Postings tagged "#{tag}"
---
<h1 id="#{tag}">Postings tagged "#{tag}"</h1>
HTML

html << '<ul class="posts">'
posts.each do |post|
post_data = post.to_liquid
html << <<-HTML
<li><a href="#{post.url}">#{post_data['title']}</a></li>
HTML
end
html << '</ul>'
FileUtils.mkdir_p("tags/#{tag}");
File.open("tags/#{tag}/index.html", 'w+') do |file|
file.puts html
end
end
puts 'Done.'
end

desc 'Generate tags pages'
task :tag_cloud => :tags do
puts 'Generating tag cloud...'
require 'rubygems'
require 'jekyll'
include Jekyll::Filters

options = Jekyll.configuration({})
site = Jekyll::Site.new(options)
site.read_posts('')

html = ''
max_count = site.tags.map{|t,p| p.count}.max
site.tags.sort.each do |tag, posts|
s = posts.count
font_size = ((20 - 10.0*(max_count-s)/max_count)*2).to_i/2.0
html << "<a href=\"/tags/#{tag.gsub(/ /,"%20")}\" title=\"Postings tagged #{tag}\" style=\"font-size: #{font_size}px; line-height:#{font_size}px\">#{tag}</a> "
end
File.open('_includes/tag_cloud.html', 'w+') do |file|
file.puts html
end
puts 'Done.'
end





4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<body>
IVL

<div id="/2011/06/08/second-blog-entry">
2011 June 08 <a href="/2011/06/08/second-blog-entry.html" >Second post</a>
</div>

<div id="/2011/06/07/first-blog-entry">
2011 June 07 <a href="/2011/06/07/first-blog-entry.html" >my first post</a>
</div>
Expand Down
14 changes: 14 additions & 0 deletions tags/alpha.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
</head>

<body>
<section>
<h1 id="alpha">Postings tagged "alpha"</h1>
<ul class="posts"> <li><a href="/2011/06/07/first-blog-entry.html">my first post</a></li>
</ul>

</section>
</body>
</html>
15 changes: 15 additions & 0 deletions tags/alpha/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
</head>

<body>
<section>
<h1 id="alpha">Postings tagged "alpha"</h1>
<ul class="posts"> <li><a href="/2011/06/07/first-blog-entry.html">my first post</a></li>
<li><a href="/2011/06/08/second-blog-entry.html">Second post</a></li>
</ul>

</section>
</body>
</html>
14 changes: 14 additions & 0 deletions tags/beta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
</head>

<body>
<section>
<h1 id="beta">Postings tagged "beta"</h1>
<ul class="posts"> <li><a href="/2011/06/07/first-blog-entry.html">my first post</a></li>
</ul>

</section>
</body>
</html>
14 changes: 14 additions & 0 deletions tags/beta/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
</head>

<body>
<section>
<h1 id="beta">Postings tagged "beta"</h1>
<ul class="posts"> <li><a href="/2011/06/07/first-blog-entry.html">my first post</a></li>
</ul>

</section>
</body>
</html>

0 comments on commit 15dc989

Please sign in to comment.