Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/elotroalex/jekyll-scholar
Browse files Browse the repository at this point in the history
…into p137
  • Loading branch information
inukshuk committed Feb 8, 2016
2 parents c80e4a0 + 1390162 commit 915226f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Or add it to your `Gemfile`:
gem 'jekyll-scholar'

### 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/).
Github does not allow any but a few select plugins to run for security reasons,
and Jekyll-Scholar is not among them.
Github does not allow any but a few select plugins to run for security reasons,
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`
branch of your site repository.
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/)
for details.



Usage
-----
Expand Down Expand Up @@ -72,7 +72,7 @@ default configuration is as follows:

replace_strings: true
join_strings: true

use_raw_bibtex_entry: false
bibtex_filters:
- superscript
Expand Down Expand Up @@ -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.

#### 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))

Expand Down
18 changes: 9 additions & 9 deletions lib/jekyll/scholar/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Scholar
module Utilities


attr_reader :config, :site, :context, :prefix, :text, :offset, :max, :relative
attr_reader :config, :site, :context, :prefix, :text, :offset, :max



Expand Down Expand Up @@ -61,10 +61,6 @@ def optparse(arguments)
@prefix = prefix
end

opts.on('-r', '--relative RELATIVE') do |relative|
@relative = relative.to_s.strip
end

opts.on('-t', '--text TEXT') do |text|
@text = text
end
Expand Down Expand Up @@ -102,7 +98,7 @@ def optparse(arguments)
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?)
end
Expand Down Expand Up @@ -400,6 +396,10 @@ def scholar_source
File.join site.source, source
end

def relative
config['relative']
end

def reference_tag(entry, index = nil)
return missing_reference unless entry

Expand Down Expand Up @@ -560,7 +560,7 @@ def details_path

def renderer(force = false)
return @renderer if @renderer && !force

@renderer = CiteProc::Ruby::Renderer.new :format => 'html',
:style => style, :locale => config['locale']
end
Expand Down Expand Up @@ -598,8 +598,8 @@ def citation_number(key)
(context['citation_numbers'] ||= {})[key] ||= cited_keys.length
end

def link_target_for key
"#{base_url}#{relative}##{[prefix, key].compact.join('-')}"
def link_target_for(key)
"#{relative}##{[prefix, key].compact.join('-')}"
end

def cite(keys)
Expand Down

0 comments on commit 915226f

Please sign in to comment.