README.md 8.29 KB
Newer Older
Sylvester Keil's avatar
Sylvester Keil committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Jekyll-Scholar
==============

Jekyll-Scholar is for all the academic bloggers out there. It is a set of
extensions to [Jekyll](http://jekyllrb.com/), the awesome, blog aware, static
site generator; it formats your bibliographies and reading lists for the web
and gives your blog posts citation super-powers.

Installation
------------

    $ [sudo] gem install jekyll-scholar


Usage
-----
Sylvester Keil's avatar
Sylvester Keil committed
17 18 19 20 21 22 23 24

Install and setup a new [Jekyll](http://jekyllrb.com/) directory (see the
[Jekyll-Wiki](https://github.com/mojombo/jekyll/wiki/Usage) for detailed
instructions). To enable the Jekyll-Scholar add the following statement
to a file in your plugin directory (e.g., to `_plugins/ext.rb`):

    require 'jekyll/scholar'

Sylvester Keil's avatar
Sylvester Keil committed
25 26 27 28 29 30 31 32 33 34 35 36
In your configuration you can now adjust the Jekyll-Scholar settings. The
default configuration is as follows:

    scholar:
      style: apa
      locale: en
      
      sort_by: none
      order: ascending
      
      source: ./_bibliography
      bibliography: references.bib
Sylvester Keil's avatar
Sylvester Keil committed
37
      
Sylvester Keil's avatar
Sylvester Keil committed
38 39 40
      details_dir:    bibliography
      details_layout: bibtex.html
      details_link:   Details
Sylvester Keil's avatar
Sylvester Keil committed
41
      
Sylvester Keil's avatar
Sylvester Keil committed
42
      query: "@*"  
Sylvester Keil's avatar
Sylvester Keil committed
43 44 45 46 47 48 49

You can use any style that ships with
[CiteProc-Ruby](https://github.com/inukshuk/citeproc-ruby) by name (e.g.,
apa, mla, chicago-fullnote-bibliography), or else you can add a link
to any CSL style (e.g., you could link to any of the styles available at
the official [CSL style repository](https://github.com/citation-style-language/styles)).

Sylvester Keil's avatar
Sylvester Keil committed
50
The `locale` settings defines what language to use when formatting
Sylvester Keil's avatar
Sylvester Keil committed
51 52 53
your references (this typically applies to localized terms, e.g., 'Eds.' for
editors in English).

Sylvester Keil's avatar
Sylvester Keil committed
54 55 56 57
The `source` option indicates where your bibliographies are stored;
`bibliography` is the name of your default bibliography.


Sylvester Keil's avatar
Sylvester Keil committed
58 59 60 61 62 63 64 65 66 67
### Bibliographies

Once you have loaded Jekyll-Scholar, all files with the extension `.bib` or
`.bibtex` will be converted when you run Jekyll (don't forget to add a YAML
header to the files); the file can contain regular HTML or Markdown and
BibTeX entries; the latter will be formatted by Jekyll-Scholar according to
the citation style and language defined in your configuration file.

For example, if you had a file `bibliography.bib` in your root directory:

Sylvester Keil's avatar
Sylvester Keil committed
68 69 70 71 72 73 74 75 76 77 78
    ---
    ---
    References
    ==========
    
    @book{ruby,
      title     = {The Ruby Programming Language},
      author    = {Flanagan, David and Matsumoto, Yukihiro},
      year      = {2008},
      publisher = {O'Reilly Media}
    }
Sylvester Keil's avatar
Sylvester Keil committed
79 80 81 82 83 84 85

It would be converted to `bibliography.html` with the following content:

    <h1 id='references'>References</h1>

    <p>Flanagan, D., &#38; Matsumoto, Y. (2008). <i>The Ruby Programming Language</i>. O&#8217;Reilly Media.</p>

Sylvester Keil's avatar
Sylvester Keil committed
86
This makes it very easy for you to add your bibliography to your Jekyll-powered
Sylvester Keil's avatar
Sylvester Keil committed
87 88
blog or website.

Sylvester Keil's avatar
Sylvester Keil committed
89 90 91 92 93 94 95 96 97 98 99
If your using other converters to generate your site, don't worry, you can
still generate bibliographies using the `bibliography` tag. In your site
or blog post, simply call:

    {% bibliography %}

This will generate your default bibliography; if you use multiple, you can
also pass in a name to tell Jekyll-Scholar which bibliography it should render.

Let's say you have two bibliographies stored in `_bibliography/books.bib` and
`_bibliography/papers.bib`; you can include the bibliographies on your site
Sylvester Keil's avatar
Sylvester Keil committed
100
by respectively calling `{% bibliography books %}` and
Sylvester Keil's avatar
Sylvester Keil committed
101 102
`{% bibliography papers %}`. For example, you could have a file `references.md`
with several reference lists:
Sylvester Keil's avatar
Sylvester Keil committed
103

Sylvester Keil's avatar
Sylvester Keil committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    ---
    title: My References
    ---

    {{ page.title }}
    ================

    The default Bibliography
    ------------------------

    {% bibliography %}

    Secondary References
    --------------------

    {% bibliography secondary %}
Sylvester Keil's avatar
Sylvester Keil committed
120

Sylvester Keil's avatar
Sylvester Keil committed
121 122 123

### Citations

Sylvester Keil's avatar
Sylvester Keil committed
124 125 126
If you want to reference books or papers from your bibliography in your blog
posts, Jekyll-Scholar can help you, too. Simply use the `cite` tag with
the appropriate key of the item you want to cite and Jekyll-Scholar will
Sylvester Keil's avatar
Sylvester Keil committed
127
create a formatted citation reference for you. For a quick example, take
Sylvester Keil's avatar
Sylvester Keil committed
128
following blog post:
Sylvester Keil's avatar
Sylvester Keil committed
129

Sylvester Keil's avatar
Sylvester Keil committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
    ---
    layout: default
    title: A Blogging Scholar
    ---

    {{ page.title }}
    ================

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
    incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    Duis 'aute irure dolor in reprehenderit in voluptate' {% cite derrida:purveyor %}
    velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
    cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
    laborum' {% cite rabinowitz %}.

    Duis 'aute irure dolor in reprehenderit in voluptate' {% cite breton:surrealism %}
    velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
    cupidatat non proident, 'sunt in culpa qui officia deserunt mollit anim id est
    laborum' {% cite rainey %}.

    References
    ----------

    {% bibliography %}
Sylvester Keil's avatar
Sylvester Keil committed
155

Sylvester Keil's avatar
Sylvester Keil committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
### Detail Pages

If your layouts directory contains a layout file for bibliography details
(the 'details_layout' configuration options), Jekyll-Scholar will generate
a details page for each entry in you main bibliography. That is to say, if
your bibliography contains the following entry:

    @book{ruby,
      title     = {The Ruby Programming Language},
      author    = {Flanagan, David and Matsumoto, Yukihiro},
      year      = {2008},
      publisher = {O'Reilly Media}
    }

Then a page 'bibliography/ruby.html' will be generated according to your
details page layout. In the layout file, you have access to all fields
of your BibTeX entry. Here is an example of a details page layout:

    ---
    ---
    <html>
    <head></head>
    <body>
      <h1>{{ page.entry.title }}</h1>
Sylvester Keil's avatar
Sylvester Keil committed
180 181
      <h2>{{ page.entry.author }}</h2>
      <p>{{ page.entry.abstract }}</p>
Sylvester Keil's avatar
Sylvester Keil committed
182 183 184
    </body>
    </html>

Sylvester Keil's avatar
Sylvester Keil committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
When Jekyll-Scholar generates detail pages, it also adds links to each
entry's detail page to the generated bibliography. You can alter the
name of the link via the 'details_link' configuration option.


### Bibliography Filters

By default, Jekyll-Scholar includes all entries in you main BibTeX file
when generating bibliographies. If you want to include only those entries
matching certain criteria, you can do so by adjusting the 'query'
configuration option. For example:

    query: "@book" #=> includes only books
    query: "@article[year>=2003]" #=> includes only articles published 2003 or later
    query: "@*[url]" #=> includes all entries with a url field
    query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review' 

Please note that some of these queries require bibtex-ruby 2.0.7 or
later versions.
Sylvester Keil's avatar
Sylvester Keil committed
204 205 206 207 208 209 210 211 212 213 214 215 216 217

Contributing
------------

The Jekyll-Scholar source code is
[hosted on GitHub](http://github.com/inukshuk/jekyll-scholar/).
You can check out a copy of the latest code using Git:

    $ git clone https://github.com/inukshuk/jekyll-scholar.git

If you've found a bug or have a question, please open an issue on the
[Jekyll-Scholar issue tracker](http://github.com/inukshuk/jekyll-scholar/issues).
Or, for extra credit, clone the Jekyll-Scholar repository, write a failing
example, fix the bug and submit a pull request.
Sylvester Keil's avatar
Sylvester Keil committed
218

Sylvester Keil's avatar
Sylvester Keil committed
219 220 221 222 223 224

License
-------

Jekyll-Scholar is distributed under the same license as Jekyll.

Sylvester Keil's avatar
Sylvester Keil committed
225
Copyright (c) 2011-2012 [Sylvester Keil](http://sylvester.keil.or.at/)
Sylvester Keil's avatar
Sylvester Keil committed
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.