Commit 81e99c51 authored by rmrf's avatar rmrf

Fix the rendering of repository links

parent bda2d480
......@@ -94,7 +94,8 @@ module Jekyll
if not repository_link_for(entry).nil?
puts "link is not null"
puts repository_link_for(entry)
reference << "<a class=\"pure-button-green\" href=\"" + repository_link_for(entry) + "\">PDF</a>"
pdflink = "<div class=\"pure-button csl-pdf\"><a href=\"" + repository_link_for(entry) + "\">PDF</a></div>"
reference.insert(reference.rindex('</div>'), pdflink.to_s )
end
end
......
module Jekyll
class Scholar
class BibliographyHDPTag < Liquid::Tag
include Scholar::Utilities
include ScholarExtras::Utilities
def initialize(tag_name, arguments, tokens)
super
@config = Scholar.defaults.dup
@bibtex_file = arguments.strip
end
def render(context)
set_context_to context
year_section = ''
opts = ['@*[public!=no]']
#references = public_entries.map do |entry|
references = get_entries(opts).map do |entry|
reference = ''
ref = ''
ref = CiteProc.process entry.to_citeproc, :style => config['style'],
:locale => config['locale'], :format => 'html'
content_tag :span, ref, :id => entry.key
if entry.field?(:year)
if (year_section != entry[:year])
reference << "<h1>"
reference << entry[:year].to_s
reference << "</h1>"
year_section = entry[:year]
end
end
reference << ref
if generate_details?
reference << "<br />"
reference << link_to(details_link_for(entry), config['details_link'])
reference << "."
end
if entry.field?(:pdflink1) or entry.field?(:slides)
reference << "<b> Downloads: </b>"
end
if entry.field?(:pdflink1)
#if config['pdf_logo']
# puts "pdf_logo"
# reference << "<img class=\"alignleft\" title=\"pdf\" src=" + config['pdf_logo'] + "alt=\"\" width=\"50\" height=\"30\" />"
# else
reference << "<a href=\"" + entry[:pdflink1].to_s + "\">PDF</a>"
# end
end
if entry.field?(:slides)
# if config['ppt_logo']
# puts "ppt_logo"
# reference << "<img class=\"alignleft\" title=\"ppt\" src=" + config['ppt_logo'] + "alt=\"\" width=\"50\" height=\"30\" />"
# else
reference << "<a href=\"" + entry[:slides].to_s + "\">, Slides</a>"
# end
end
content_tag :br, reference
end
references.join("\n")
#content_tag :ul, references.join("\n")
#content_tag :li, reference
end
end
end
end
Liquid::Template.register_tag('bibliography_hdp', Jekyll::Scholar::BibliographyHDPTag)
......@@ -112,7 +112,8 @@ module Jekyll
if not repository_link_for(entry).nil?
puts "link is not null"
puts repository_link_for(entry)
reference << "<a href=\"" + repository_link_for(entry) + "\">PDF</a>"
pdflink = "<div class=\"pure-button csl-pdf\"><a href=\"" + repository_link_for(entry) + "\">PDF</a></div>"
reference.insert(reference.rindex('</div>'), pdflink.to_s )
end
end
# Content tag is dependent on type of article.
......
module Jekyll
class Scholar
class Details < Page
include Scholar::Utilities
def initialize(site, base, dir, entry)
@site, @base, @dir = site, base, dir
@config = Scholar.defaults.merge(site.config['scholar'] || {})
@name = details_file_for(entry)
process(@name)
read_yaml(File.join(base, '_layouts'), config['details_layout'])
liquidify(entry)
end
private
def liquidify(entry)
data['entry'] = {}
data['entry']['key'] = entry.key
data['entry']['type'] = entry.type
entry.fields.each do |key, value|
data['entry'][key.to_s] = value.to_s
end
data['entry']['bibtex'] = entry.to_s
# This is to get the CSL style output.
data['entry']['citeproc'] = CiteProc.process entry.to_citeproc, :style => config['style'],
:locale => config['locale'], :format => 'html'
#puts data['entry']['citeproc'].class
if entry.field?(:pdflink1)
data['entry']['pdflink1']= entry[:pdflink1].to_s
end
if entry.field?(:slides)
data['entry']['slides']= entry[:slides].to_s
end
#name = entry.key.to_s.dup
# name.gsub!(/[:\s]+/, '_')
# data['entry']['pdflink'] = '../pdfs/' + name.to_s + '.pdf'
end
end
class DetailsGenerator < Generator
include Scholar::Utilities
safe true
attr_reader :config
def generate(site)
@site, @config = site, Scholar.defaults.merge(site.config['scholar'] || {})
if generate_details?
entries.each do |entry|
details = Details.new(site, site.source, details_path, entry)
details.render(site.layouts, site.site_payload)
details.write(site.dest)
site.pages << details
end
end
end
end
end
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