Commit fa068271 authored by rmrf's avatar rmrf Committed by Hiren Patel

need to produce *and* conditions in selecting publications

parent fe0ff446
require 'jekyll/scholar'
require 'jekyll/scholar/extras/extra_utils'
require 'jekyll/scholar/extras/bibliography_hdp'
require 'jekyll/scholar/extras/bibliography_bytype'
require 'jekyll/scholar/extras/details_hdp'
module Jekyll
class Scholar
class BibliographyHDPByTypeTag < 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 = ['@article','@*[public!=no]']
#references = public_journal_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?(:pptlink1)
reference << "<b> Downloads: </b>"
end
if entry.field?(:pdflink1)
reference << "<a href=\"" + entry[:pdflink1].to_s + "\">PDF</a>"
end
if entry.field?(:pptlink1)
reference << "<a href=\"" + entry[:pptlink1].to_s + "\">PPT</a>"
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_bytype', Jekyll::Scholar::BibliographyHDPByTypeTag)
......@@ -16,10 +16,41 @@ module Jekyll
def bibliography
@bibliography ||= BibTeX.open(bibtex_path, bibtex_options)
end
def get_entries(and_list)
b = bibliography['@*']
and_list.each { |t|
b = bibliography[t] & b
}
puts b.length
unless config['sort_by'] == 'none'
b.sort_by! { |e| e[config['sort_by']].to_s }
b.reverse! if config['order'] =~ /^(desc|reverse)/i
end
b
end
def public_journal_entries
bart = bibliography['@article']
bpub = bibliography['@*[public!=no]']
b = bart & bpub
puts b.class
puts bart.length
puts bpub.length
puts b.length
unless config['sort_by'] == 'none'
b.sort_by! { |e| e[config['sort_by']].to_s }
b.reverse! if config['order'] =~ /^(desc|reverse)/i
end
b
end
def public_entries
b = bibliography['@*[public!=no]']
# b = bibliography[config['query']]
unless config['sort_by'] == 'none'
b.sort_by! { |e| e[config['sort_by']].to_s }
......
......@@ -98,7 +98,7 @@
<number variable="number-of-volumes" form="numeric"/>
<text term="volume" form="short" suffix="." plural="true" strip-periods="true"/>
</group>
<group delimiter=" ">
<group delimiter=", ">
<text term="issue" form="short" suffix="." strip-periods="true"/>
<number variable="issue" form="numeric"/>
</group>
......@@ -240,7 +240,7 @@
<text variable="genre"/>
<text macro="publisher"/>
<text macro="event" prefix="&lt;i&gt;" suffix="&lt;/i&gt;,"/>
<text macro="locators" prefix="Technical Report #" suffix=", "/>
<text variable="issue" prefix="Technical Report #" suffix=", " form="numeric"/>
<text macro="issued"/>
</group>
</else-if>
......
@book{dragon,
Address = {Boston},
Author = {Aho, Alfred V., and Lam, Monica S., and Ullman, Jeffrey D.},
Booktitle = {Compilers: Principles, Techniques, and Tools},
Date-Added = {2010-08-05 09:57:15 +0200},
Date-Modified = {2010-08-05 10:06:32 +0200},
Edition = {second},
Keywords = {compiler, lex, yacc},
Publisher = {Addison Wesley},
Title = {Compilers: Principles, Techniques, and Tools},
Year = {2007},
public ={yes}
}
@book{python,
author={M. Lutz},
year={2001},
......@@ -43,6 +57,6 @@
pages = {674-681},
title = {commentary on action in perception},
volume = {76},
public = {no},
public = {yes},
year = {2008}}
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