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
c4532681
Commit
c4532681
authored
May 27, 2012
by
rmrf
Browse files
need to produce *and* conditions in selecting publications
parent
7aa87d54
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
4 deletions
+122
-4
lib/jekyll/scholar/extras.rb
lib/jekyll/scholar/extras.rb
+1
-0
lib/jekyll/scholar/extras/bibliography_bytype.rb
lib/jekyll/scholar/extras/bibliography_bytype.rb
+72
-0
lib/jekyll/scholar/extras/extra_utils.rb
lib/jekyll/scholar/extras/extra_utils.rb
+32
-1
samples/jekyll-template/_publications/custom-hdp.csl
samples/jekyll-template/_publications/custom-hdp.csl
+2
-2
samples/jekyll-template/_publications/test.bib
samples/jekyll-template/_publications/test.bib
+15
-1
No files found.
lib/jekyll/scholar/extras.rb
View file @
c4532681
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'
lib/jekyll/scholar/extras/bibliography_bytype.rb
0 → 100644
View file @
c4532681
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
)
lib/jekyll/scholar/extras/extra_utils.rb
View file @
c4532681
...
...
@@ -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
}
...
...
samples/jekyll-template/_publications/custom-hdp.csl
View file @
c4532681
...
...
@@ -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=
"<i>"
suffix=
"</i>,"
/>
<text
macro=
"locators
"
prefix=
"Technical Report #"
suffix=
", "
/>
<text
variable=
"issue
"
prefix=
"Technical Report #"
suffix=
", "
form=
"numeric"
/>
<text
macro=
"issued"
/>
</group>
</else-if>
...
...
samples/jekyll-template/_publications/test.bib
View file @
c4532681
@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}
}
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