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
Commits
a1cace40
Commit
a1cace40
authored
Apr 26, 2012
by
Sylvester Keil
Browse files
added details generator
parent
88df06a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
lib/jekyll/scholar.rb
lib/jekyll/scholar.rb
+8
-0
lib/jekyll/scholar/generators/details.rb
lib/jekyll/scholar/generators/details.rb
+62
-0
No files found.
lib/jekyll/scholar.rb
View file @
a1cace40
...
...
@@ -8,17 +8,25 @@ require 'jekyll/scholar/version'
require
'jekyll/scholar/converters/bibtex'
require
'jekyll/scholar/tags/bibliography'
require
'jekyll/scholar/tags/cite'
require
'jekyll/scholar/generators/details'
module
Jekyll
class
Scholar
@defaults
=
Hash
[
*
%w{
style apa
locale en
sort_by none
order ascending
source ./_bibliography
bibliography references.bib
details_dir ./bibliography
detauls_layout bibtex.html
}
].
freeze
class
<<
self
...
...
lib/jekyll/scholar/generators/details.rb
0 → 100644
View file @
a1cace40
module
Jekyll
class
Scholar
class
Details
<
Page
attr_reader
:config
def
initialize
(
site
,
base
,
dir
,
entry
)
@site
,
@base
,
@dir
=
site
,
base
,
dir
@config
=
Scholar
.
defaults
.
merge
(
site
.
config
[
'scholar'
]
||
{})
@name
=
[
entry
.
key
,
'html'
].
join
(
'.'
)
process
(
@name
)
read_yaml
(
File
.
join
(
base
,
'_layouts'
),
config
[
'details_layout'
])
data
[
'entry'
]
=
entry
end
end
class
DetailsGenerator
<
Generator
safe
true
attr_reader
:config
def
generate
(
site
)
if
site
.
config
[
'scholar'
]
&&
site
.
layouts
.
key?
(
site
.
config
[
'scholar'
][
'details_layout'
])
@config
=
Scholar
.
defaults
.
merge
(
site
.
config
[
'scholar'
]
||
{})
bibliography
[
'@*'
].
each
do
|
entry
|
details
=
Detauls
.
new
(
site
,
site
.
source
,
config
[
'details_dir'
],
entry
)
details
.
render
(
site
.
layouts
,
site
.
site_payload
)
details
.
write
(
site
.
dest
)
site
.
pages
<<
details
end
end
end
private
def
bibliography
@bibliography
||=
BibTeX
.
open
(
extend_path
(
file
),
:filter
=>
:latex
)
end
def
extend_path
(
name
)
if
name
.
nil?
||
name
.
empty?
name
=
config
[
'bibliography'
]
end
p
=
File
.
join
(
config
[
'source'
],
name
)
p
<<
'.bib'
unless
File
.
exists?
(
p
)
p
end
end
end
end
\ No newline at end of file
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