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
......@@ -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))
......
......@@ -18,7 +18,7 @@ module Jekyll
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
@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
......@@ -102,7 +98,7 @@ module Jekyll
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
......@@ -400,6 +396,10 @@ module Jekyll
File.join site.source, source
end
def relative
config['relative']
end
def reference_tag(entry, index = nil)
return missing_reference unless entry
......@@ -598,8 +598,8 @@ module Jekyll
(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)
......
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