Class: Jekyll::Scholar::BibliographyTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Scholar::BibliographyTag
show all
- Includes:
- Utilities
- Defined in:
- lib/jekyll/scholar/tags/bibliography.rb
Instance Attribute Summary
Attributes included from Utilities
#config, #context, #max, #offset, #prefix, #site, #text
Instance Method Summary
collapse
Methods included from Utilities
#allow_locale_overrides?, #base_url, #bibliography, #bibliography_list_tag, #bibliography_stale?, #bibliography_tag, #bibliography_template, #bibtex_file, #bibtex_files, #bibtex_filters, #bibtex_options, #bibtex_path, #bibtex_paths, #citation_item_for, #citation_number, #cite, #cite_details, #cited_entries, #cited_keys, #cited_only?, #cited_references, #clear?, #content_tag, #csl_renderer, #details_link, #details_link_for, #details_path, #details_path_for, #entries, #extend_path, #generate_details?, #generate_details_link?, #group, #group?, #group_by, #group_compare, #group_keys, #group_name, #group_order, #group_order=, #group_tags, #group_value, #grouper, #interpolate, #join_strings?, #keys, #labels, #limit_entries?, #link_target_for, #link_to, #liquid_template, #liquidify, #load_repository, #load_style, #locales, #locators, #match_fields, #missing_reference, #month_names, #nocite, #optparse, #query, #raw_bibtex_filters, #reference_data, #reference_tag, #reference_tagname, #relative, #remove_duplicates?, #render_bibliography, #render_citation, #replace_strings?, #repository, #repository?, #repository_file_delimiter, #repository_link_for, #repository_links_for, #repository_path, #scholar_source, #set_context_to, #skip_sort?, #sort, #sort_keys, #sort_order, #split_arguments, #style, #styles, #suppress_author?, #type_aliases, #type_names, #type_order, #update_dependency_tree
Constructor Details
#initialize(tag_name, arguments, tokens) ⇒ BibliographyTag
Returns a new instance of BibliographyTag.
6
7
8
9
10
11
12
|
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 6
def initialize(tag_name, arguments, tokens)
super
@config = Scholar.defaults.dup
optparse(arguments)
end
|
Instance Method Details
#group_renderer(groupsOrItems, keys, order, tags) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 34
def group_renderer(groupsOrItems,keys,order,tags)
if keys.count == 0
csl_renderer(true)
render_items(groupsOrItems)
else
groupsOrItems
.sort do |e1,e2|
if (order.first || group_order.last) =~ /^(desc|reverse)/i
group_compare(keys.first,e2[0],e1[0])
else
group_compare(keys.first,e1[0],e2[0])
end
end
.map do |e|
bibhead = content_tag(tags.first || group_tags.last,
group_name(keys.first, e[0]),
:class => config['bibliography_class'])
bibentries = group_renderer(e[1], keys.drop(1), order.drop(1), tags.drop(1))
bibhead + "\n" + bibentries
end
.join("\n")
end
end
|
#render(context) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 14
def render(context)
set_context_to context
update_dependency_tree
items = cited_entries
if group?
groups = group(items)
bibliography = render_groups(groups)
else
items = items[offset..max] if limit_entries?
bibliography = render_items(items)
end
bibliography
end
|
#render_groups(groups) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 33
def render_groups(groups)
def group_renderer(groupsOrItems,keys,order,tags)
if keys.count == 0
csl_renderer(true)
render_items(groupsOrItems)
else
groupsOrItems
.sort do |e1,e2|
if (order.first || group_order.last) =~ /^(desc|reverse)/i
group_compare(keys.first,e2[0],e1[0])
else
group_compare(keys.first,e1[0],e2[0])
end
end
.map do |e|
bibhead = content_tag(tags.first || group_tags.last,
group_name(keys.first, e[0]),
:class => config['bibliography_class'])
bibentries = group_renderer(e[1], keys.drop(1), order.drop(1), tags.drop(1))
bibhead + "\n" + bibentries
end
.join("\n")
end
end
group_renderer(groups,group_keys,group_order,group_tags)
end
|
#render_items(items) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/jekyll/scholar/tags/bibliography.rb', line 60
def render_items(items)
bibliography = items.compact.each_with_index.map { |entry, index|
reference = bibliography_tag(entry, index + 1)
if generate_details? && generate_details_link?
reference << link_to(details_link_for(entry),
config['details_link'], :class => config['details_link_class'])
end
content_tag config['bibliography_item_tag'], reference, config['bibliography_item_attributes']
}.join("\n")
content_tag bibliography_list_tag, bibliography,
{ :class => config['bibliography_class'] }.merge(config['bibliography_list_attributes'])
end
|