Commit b4404bd8 authored by Sylvester Keil's avatar Sylvester Keil

Merge pull request #6 from hdpatel/master

cite_details
parents 3dd51beb d0bd2541
......@@ -11,5 +11,6 @@ require 'jekyll/scholar/utilities'
require 'jekyll/scholar/converters/bibtex'
require 'jekyll/scholar/tags/bibliography'
require 'jekyll/scholar/tags/cite'
require 'jekyll/scholar/tags/cite_details'
require 'jekyll/scholar/tags/quote'
require 'jekyll/scholar/generators/details'
module Jekyll
class Scholar
class CiteDetailsTag < Liquid::Tag
include Scholar::Utilities
attr_reader :key, :text
def initialize(tag_name, arguments, tokens)
super
@config = Scholar.defaults.dup
@key = arguments.strip.split(/\s+/,2)[0]
@text = arguments.strip.split(/\s+/,2)[1]
end
def render(context)
set_context_to context
cite_details key, text
end
end
end
end
Liquid::Template.register_tag('cite_details', Jekyll::Scholar::CiteDetailsTag)
......@@ -79,6 +79,16 @@ module Jekyll
rescue
"(#{key})"
end
def cite_details(key, text)
entry = bibliography[key]
if bibliography.key?(key)
link_to details_link_for(entry), text
else
"(missing reference)"
end
end
def content_tag(name, content_or_attributes, attributes = {})
if content_or_attributes.is_a?(Hash)
......@@ -108,4 +118,4 @@ module Jekyll
end
end
end
\ No newline at end of file
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment