Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
caesr-pub
jekyll-scholar-extras
Commits
94c95237
Commit
94c95237
authored
Feb 19, 2016
by
root
Committed by
Hiren Patel
Feb 19, 2016
Browse files
Add acmpdf link for authorizer and separate utlities for extras
parent
6abf1800
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
67 deletions
+70
-67
VERSIONS.md
VERSIONS.md
+1
-1
lib/jekyll/scholar/extras.rb
lib/jekyll/scholar/extras.rb
+1
-3
lib/jekyll/scholar/extras/bibliography_bytype.rb
lib/jekyll/scholar/extras/bibliography_bytype.rb
+8
-25
lib/jekyll/scholar/extras/bibliography_year.rb
lib/jekyll/scholar/extras/bibliography_year.rb
+15
-37
lib/jekyll/scholar/extras_utilities.rb
lib/jekyll/scholar/extras_utilities.rb
+44
-0
lib/jekyll/scholar/version.rb
lib/jekyll/scholar/version.rb
+1
-1
No files found.
VERSIONS.md
View file @
94c95237
0.
1.
0
0.
1.
1
lib/jekyll/scholar/extras.rb
View file @
94c95237
require
'jekyll/scholar'
#
require 'jekyll/scholar/extras/extra_utils'
require
'jekyll/scholar/extras/extra
s
_util
itie
s'
require
'jekyll/scholar/extras/bibliography_year'
require
'jekyll/scholar/extras/bibliography_bytype'
#require 'jekyll/scholar/extras/details_hdp'
#require 'jekyll/scholar/tags/cite_details_dep'
lib/jekyll/scholar/extras/bibliography_bytype.rb
View file @
94c95237
...
...
@@ -3,6 +3,7 @@ module Jekyll
class
BibliographyTagByType
<
Liquid
::
Tag
include
Scholar
::
Utilities
include
ScholarExtras
def
initialize
(
tag_name
,
arguments
,
tokens
)
super
...
...
@@ -23,16 +24,6 @@ module Jekyll
end
def
initialize_prefix_defaults
()
@prefix_defaults
=
Hash
[{
:article
=>
"J"
,
:inproceedings
=>
"C"
,
:incollection
=>
"BC"
,
:techreport
=>
"TR"
,
:book
=>
"B"
}]
end
def
set_type_counts
(
tc
)
@type_counts
=
tc
end
...
...
@@ -45,19 +36,6 @@ module Jekyll
return
idx_html
+
ref
end
def
render_ref_img
(
item
)
css_points
=
Hash
[{
:article
=>
"csl-point-journal-icon"
,
:inproceedings
=>
"csl-point-conference-icon"
,
:incollection
=>
"csl-point-bookchapter-icon"
,
:techreport
=>
"csl-point-techreport-icon"
,
:book
=>
"csl-point-book-icon"
}]
s
=
css_points
[
item
.
type
]
return
s
end
def
render_header
(
y
)
ys
=
content_tag
"h2 class=
\"
csl-year-header
\"
"
,
y
ys
=
content_tag
"div class=
\"
csl-year-icon
\"
"
,
ys
...
...
@@ -106,12 +84,17 @@ module Jekyll
reference
.
insert
(
reference
.
rindex
(
'</div>'
),
ts
.
to_s
)
end
end
# Check if there are ACM PDF links
# Really awkward way of insertion
reference
.
insert
(
reference
.
rindex
(
'</div>'
),
render_acmpdf_link
(
entry
))
# Render links if repository specified
if
repository?
if
repository?
and
not
entry
.
field?
(
:acmpdflink
)
if
not
repository_link_for
(
entry
).
nil?
puts
"link is not null"
puts
repository_link_for
(
entry
)
reference
<<
"<a class=
\"
pure-button
\"
href=
\"
"
+
repository_link_for
(
entry
)
+
"
\"
>PDF</a>"
reference
<<
"<a class=
\"
pure-button
-green
\"
href=
\"
"
+
repository_link_for
(
entry
)
+
"
\"
>PDF</a>"
end
end
...
...
lib/jekyll/scholar/extras/bibliography_year.rb
View file @
94c95237
...
...
@@ -3,6 +3,7 @@ module Jekyll
class
BibliographyTagYear
<
Liquid
::
Tag
include
Scholar
::
Utilities
include
ScholarExtras
def
initialize
(
tag_name
,
arguments
,
tokens
)
super
...
...
@@ -40,28 +41,6 @@ module Jekyll
}]
end
def
initialize_prefix_defaults
()
@prefix_defaults
=
Hash
[{
:article
=>
"J"
,
:inproceedings
=>
"C"
,
:incollection
=>
"BC"
,
:techreport
=>
"TR"
,
:book
=>
"B"
}]
end
def
render_ref_img
(
item
)
css_points
=
Hash
[{
:article
=>
"csl-point-journal-icon"
,
:inproceedings
=>
"csl-point-conference-icon"
,
:incollection
=>
"csl-point-bookchapter-icon"
,
:techreport
=>
"csl-point-techreport-icon"
,
:book
=>
"csl-point-book-icon"
}]
s
=
css_points
[
item
.
type
]
return
s
end
def
get_entries_by_type
(
year
,
type
)
b
=
bibliography
.
query
(
'@*'
)
{
|
item
|
...
...
@@ -75,13 +54,6 @@ module Jekyll
# content_tag "h2", y
end
def
render_index
(
item
,
ref
)
si
=
'['
+
@prefix_defaults
[
item
.
type
].
to_s
+
@type_counts
[
item
.
type
].
to_s
+
']'
@type_counts
[
item
.
type
]
=
@type_counts
[
item
.
type
].
to_i
-
1
idx_html
=
content_tag
"div class=
\"
csl-index
\"
"
,
si
return
idx_html
+
ref
end
def
entries_year
(
year
)
b
=
bibliography
.
query
(
'@*'
)
{
...
...
@@ -118,23 +90,29 @@ module Jekyll
if
entry
.
field?
(
:award
)
# TODO: Awkward -- Find position to insert it. Before the last </div>
ts
=
content_tag
"div class=
\"
csl-award
\"
"
,
entry
.
award
.
to_s
# puts ts
# puts ts.to_s
refPos
=
reference
.
rindex
(
'</div>'
)
if
refPos
.
nil?
# puts "NILL"
else
# puts "INSERT\n"
# puts ts
reference
.
insert
(
reference
.
rindex
(
'</div>'
),
ts
.
to_s
)
end
end
# Render links if repository specified
if
repository?
# There are multiple ways to have PDFs associated.
# Priority is suggested as below.
# 1. ACM links to PDF through authorizer
# 2. Repository links
# 3. Just web links to somewhere else.
#
# Check if there are ACM PDF links
reference
.
insert
(
reference
.
rindex
(
'</div>'
),
render_acmpdf_link
(
entry
))
# Render links if repository specified but not acmpdflink
if
repository?
and
not
entry
.
field?
(
:acmpdflink
)
if
not
repository_link_for
(
entry
).
nil?
puts
"link is not null"
puts
repository_link_for
(
entry
)
reference
<<
"<a
class=
\"
pure-button
\"
href=
\"
"
+
repository_link_for
(
entry
)
+
"
\"
>PDF</a>"
reference
<<
"<a href=
\"
"
+
repository_link_for
(
entry
)
+
"
\"
>PDF</a>"
end
end
# Content tag is dependent on type of article.
...
...
lib/jekyll/scholar/extras_utilities.rb
0 → 100644
View file @
94c95237
module
Jekyll
module
ScholarExtras
def
render_index
(
item
,
ref
)
si
=
'['
+
@prefix_defaults
[
item
.
type
].
to_s
+
@type_counts
[
item
.
type
].
to_s
+
']'
@type_counts
[
item
.
type
]
=
@type_counts
[
item
.
type
].
to_i
-
1
idx_html
=
content_tag
"div class=
\"
csl-index
\"
"
,
si
return
idx_html
+
ref
end
def
render_ref_img
(
item
)
css_points
=
Hash
[{
:article
=>
"csl-point-journal-icon"
,
:inproceedings
=>
"csl-point-conference-icon"
,
:incollection
=>
"csl-point-bookchapter-icon"
,
:techreport
=>
"csl-point-techreport-icon"
,
:book
=>
"csl-point-book-icon"
}]
s
=
css_points
[
item
.
type
]
return
s
end
def
initialize_prefix_defaults
()
@prefix_defaults
=
Hash
[{
:article
=>
"J"
,
:inproceedings
=>
"C"
,
:incollection
=>
"BC"
,
:techreport
=>
"TR"
,
:book
=>
"B"
}]
end
def
render_acmpdf_link
(
entry
)
pdflink
=
""
if
entry
.
field?
(
:acmpdflink
)
pdflink
=
"<div class=
\"
pure-button csl-pdf
\"
><a href=
\"
"
+
entry
.
acmpdflink
.
to_s
+
"
\"
>PDF</a></div>"
end
return
pdflink
end
end
end
lib/jekyll/scholar/version.rb
View file @
94c95237
module
Jekyll
class
ScholarExtras
VERSION
=
'0.1.
0
'
.
freeze
VERSION
=
'0.1.
1
'
.
freeze
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment