Permalink
Browse files

Added submodule for jquery plugin and test commit for post.

  • Loading branch information...
1 parent 71a7950 commit 01c10dce6035a8c03968a4183681e800b28d5324 @polarblau committed Apr 14, 2012
Showing with 618 additions and 1 deletion.
  1. +3 −0 .gitmodules
  2. +2 −0 Gemfile
  3. +2 −0 Gemfile.lock
  4. +11 −1 _layouts/default.html
  5. +61 −0 _plugins/comments_tag.rb
  6. +2 −0 _posts/1970-01-01-placeholder-post.md
  7. +1 −0 javascripts/hastie
  8. +536 −0 javascripts/mustache.js
View
@@ -0,0 +1,3 @@
+[submodule "javascripts/hastie"]
+ path = javascripts/hastie
+ url = git@github.com:polarblau/hastie.git
View
@@ -1,3 +1,5 @@
source :rubygems
gem 'jekyll'
+gem 'rdiscount'
+
View
@@ -19,10 +19,12 @@ GEM
maruku (0.6.0)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
+ rdiscount (1.6.8)
syntax (1.0.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll
+ rdiscount
View
@@ -4,10 +4,20 @@
<meta charset="utf-8">
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
+ <script src="http://code.jquery.com/jquery.min.js"></script>
+ <script src="/javascripts/hastie/src/jquery.hastie.js"></script>
+ <script src="/javascripts/mustache.js"></script>
+
+ <script>
+ $(function(){
+ $('#comments').hastie();
+ });
+ </script>
+
<body>
{{ content }}
</body>
</html>
+
@@ -0,0 +1,61 @@
+module Jekyll
+ class Post
+
+ alias :liquid_data :to_liquid
+
+ def to_liquid
+ liquid_data.deep_merge({
+ "file_name" => file_name
+ })
+ end
+
+ private
+
+ def file_name
+ # TODO: use File
+ [@base, @name].join('/')
+ end
+
+ end
+end
+
+module Jekyll
+ class CommentsTag < Liquid::Tag
+
+ def initialize(tag_name, file, tokens)
+ super
+ @file = file
+ end
+
+ def render(context)
+ file_name = context.environments.first["page"]["file_name"]
+
+ cmd = "git log --pretty=format:'%h' --follow #{file_name}"
+ hashes = `#{cmd}`.split('\n')
+
+ puts hashes
+
+ commit_id = '71a7950'
+ #commit_id = `git rev-list -n 1 HEAD"# --`# #{__FILE__}"
+ comments_url = "https://api.github.com/repos/polarblau/hastie-test-blog/commits/#{commit_id}/comments"
+ "<div id='comments' data-comments-url='#{comments_url}'>#{@text}</div>"
+ end
+ end
+
+private
+
+ def caller_method_name
+ parse_caller(caller(2).first).last
+ end
+
+ def parse_caller(at)
+ if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
+ file = Regexp.last_match[1]
+ line = Regexp.last_match[2].to_i
+ method = Regexp.last_match[3]
+ [file, line, method]
+ end
+ end
+end
+
+Liquid::Template.register_tag('comments', Jekyll::CommentsTag)
@@ -4,3 +4,5 @@ title: Placeholder post
---
**{{ page.title }}** written in markdown.
+
+{% comments %}
Submodule hastie added at 18a2a6
Oops, something went wrong. Retry.

0 comments on commit 01c10dc

Please sign in to comment.