Commit 915226f2 authored by Sylvester Keil's avatar Sylvester Keil
Browse files

Merge branch 'master' of https://github.com/elotroalex/jekyll-scholar into p137

parents c80e4a0f 1390162a
...@@ -25,18 +25,18 @@ Or add it to your `Gemfile`: ...@@ -25,18 +25,18 @@ Or add it to your `Gemfile`:
gem 'jekyll-scholar' gem 'jekyll-scholar'
### Github Pages ### Github Pages
Note that it is not possible to use this plugin with the Note that it is not possible to use this plugin with the
[default Github pages workflow](https://help.github.com/articles/using-jekyll-with-pages/). [default Github pages workflow](https://help.github.com/articles/using-jekyll-with-pages/).
Github does not allow any but a few select plugins to run for security reasons, Github does not allow any but a few select plugins to run for security reasons,
and Jekyll-Scholar is not among them. and Jekyll-Scholar is not among them.
You will have to generate your site locally and push the results to the `master` resp. `gh-pages` You will have to generate your site locally and push the results to the `master` resp. `gh-pages`
branch of your site repository. branch of your site repository.
You can keep sources, configuration and plugins in a separate branch; see e.g. You can keep sources, configuration and plugins in a separate branch; see e.g.
[here](http://davidensinger.com/2013/07/automating-jekyll-deployment-to-github-pages-with-rake/) [here](http://davidensinger.com/2013/07/automating-jekyll-deployment-to-github-pages-with-rake/)
for details. for details.
Usage Usage
----- -----
...@@ -72,7 +72,7 @@ default configuration is as follows: ...@@ -72,7 +72,7 @@ default configuration is as follows:
replace_strings: true replace_strings: true
join_strings: true join_strings: true
use_raw_bibtex_entry: false use_raw_bibtex_entry: false
bibtex_filters: bibtex_filters:
- superscript - superscript
...@@ -394,9 +394,13 @@ will attempt to read the key `ruby` from file `/home/foo/bar.bib`. It will not ...@@ -394,9 +394,13 @@ will attempt to read the key `ruby` from file `/home/foo/bar.bib`. It will not
fallback to the default BibTeX file. fallback to the default BibTeX file.
#### Citation pointing to another page in your site #### Citation pointing to another page in your site
In some cases, you might want your citation to link to another page on your cite (ex. a separate works cited page). As a solution, Jekyll-Scholar provides the `--relative` tag. For example, if you wanted the link to point to an ID in a bibliography.html page, you would use: In some cases, you might want your citation to link to another page on your cite (ex. a separate works cited page). As a solution, add a relative path to your scholar configurations:
~~~ yaml
scholar:
relative: "/relative/path/file.html"
~~~
{% cite ruby --relative bibliography.html %}
#### Multiple bibliographies within one document (like [multibib.sty](http://www.ctan.org/pkg/multibib)) #### Multiple bibliographies within one document (like [multibib.sty](http://www.ctan.org/pkg/multibib))
......
...@@ -18,7 +18,7 @@ module Jekyll ...@@ -18,7 +18,7 @@ module Jekyll
module Utilities module Utilities
attr_reader :config, :site, :context, :prefix, :text, :offset, :max, :relative attr_reader :config, :site, :context, :prefix, :text, :offset, :max
...@@ -61,10 +61,6 @@ module Jekyll ...@@ -61,10 +61,6 @@ module Jekyll
@prefix = prefix @prefix = prefix
end end
opts.on('-r', '--relative RELATIVE') do |relative|
@relative = relative.to_s.strip
end
opts.on('-t', '--text TEXT') do |text| opts.on('-t', '--text TEXT') do |text|
@text = text @text = text
end end
...@@ -102,7 +98,7 @@ module Jekyll ...@@ -102,7 +98,7 @@ module Jekyll
end end
end end
argv = arguments.split(/(\B-[cCfqrptTsgGOlomA]|\B--(?:cited(_in_order)?|file|query|relative|prefix|text|style|group_(?:by|order)|type_order|template|locator|offset|max|suppress_author|))/) argv = arguments.split(/(\B-[cCfqptTsgGOlomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|offset|max|suppress_author|))/)
parser.parse argv.map(&:strip).reject(&:empty?) parser.parse argv.map(&:strip).reject(&:empty?)
end end
...@@ -400,6 +396,10 @@ module Jekyll ...@@ -400,6 +396,10 @@ module Jekyll
File.join site.source, source File.join site.source, source
end end
def relative
config['relative']
end
def reference_tag(entry, index = nil) def reference_tag(entry, index = nil)
return missing_reference unless entry return missing_reference unless entry
...@@ -560,7 +560,7 @@ module Jekyll ...@@ -560,7 +560,7 @@ module Jekyll
def renderer(force = false) def renderer(force = false)
return @renderer if @renderer && !force return @renderer if @renderer && !force
@renderer = CiteProc::Ruby::Renderer.new :format => 'html', @renderer = CiteProc::Ruby::Renderer.new :format => 'html',
:style => style, :locale => config['locale'] :style => style, :locale => config['locale']
end end
...@@ -598,8 +598,8 @@ module Jekyll ...@@ -598,8 +598,8 @@ module Jekyll
(context['citation_numbers'] ||= {})[key] ||= cited_keys.length (context['citation_numbers'] ||= {})[key] ||= cited_keys.length
end end
def link_target_for key def link_target_for(key)
"#{base_url}#{relative}##{[prefix, key].compact.join('-')}" "#{relative}##{[prefix, key].compact.join('-')}"
end end
def cite(keys) def cite(keys)
......
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