jekyll-scholar 5.14.2 → 5.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e096212effbee6e337932cea93394ca9c3de363ce20e4a81815d657a17324f83
4
- data.tar.gz: 310894091cec4d9ed8bed29b6e55a973bd39681703d6637884eb07f9d9bb4e9f
3
+ metadata.gz: e0a2e628b1d24021608d99ed8d5dda0e76999df53944a9de3f73f241e7184d84
4
+ data.tar.gz: 3a3289d5444bc07f819ea2705d96f8ad53ea2f62abceb1ba2d60dc4b97d1b5af
5
5
  SHA512:
6
- metadata.gz: bf74296ae5ddbb075f8799710b06af4081df0cd92721b8e97bd10254da987d162467471af99565c4240d5fc10bb16a6b938caf1c468059c5cad20a5f95c843db
7
- data.tar.gz: 8e4801c9afd8151b7e0fb7c84f6bd3e271b2432c79a47e587c8c7b1df612a6340662185c7c9e3e9e8c1b1b21f46847c7c07c31b395eabc31e5bb7086d9ff5213
6
+ metadata.gz: 8d2be39fb58d5bb70a10ffa6736bf155f4b8c84193bd8030abe8ac1ee1327eac4603510d62a33370061b928b7c8934ac2786ea2db45d2d52a87998dd8bae5f13
7
+ data.tar.gz: 76f1963d4fc2af3c5158aff23633db793c21426cab82ba7a939d5af7288624f87c216cc73d5b4c1eedc9cc4e2b0438d5f3b45cef24b425907f62e045437fcde1
data/README.md CHANGED
@@ -69,6 +69,7 @@ description of all options and their defaults, see
69
69
  | `source` | `./_bibliography` | Indicates where your bibliographies are stored. |
70
70
  | `bibliography` | `references.bib` | Indicates the name of your default bibliography. For best results, please ensure that your bibliography is encoded as ASCII or UTF-8. A string that contains a `*` will be passed to `Dir::glob`, so `**/*.bib{,tex}` will find all files named `*.bib` and `*.bibtex` under `source`. |
71
71
  | `use_raw_bibtex_entry` | `true` | When `true`, disables parsing of Liquid tags embedded in the Bibtex fields. This option provides a way to circumvent the problem that (the conflicting syntax of) the double braces functionality of BibTex is accidentally parsed by Liquid, while it was intended to keep the exact capitalization style. |
72
+ | `allow_locale_overrides` | `false` | When `true`, allows the `language` entry in the BibTex to override the `locale` setting for individual entries. When the language is missing it will revert back to `locale`. The language value should be encoded using the two-letter [ISO 639-1](https://www.loc.gov/standards/iso639-2/php/code_list.php) standard. Ex. English = 'en', Spanish = 'es'. |
72
73
  | `sort_by` | `none` | Specifies if and how bibliography entries are sorted. Entries can be sorted on multiple fields, by using a list of keys, e.g. `year,month`. Ordering can be specified per sort level, e.g. `order: descending,ascending` will sort the years descending, but per year the months are ascending. If there are more sort keys than order directives, the last order entry is used for the remaining keys. |
73
74
  | `order` | `ascending` | Specifies order bibliography entries are sorted in. Can be `ascending` or descending. Ordering can be specified per sort level, e.g. `descending,ascending` will sort in descending on the first key then ascending order on the second key. If there are more sort keys than order directives, the last order entry is used for the remaining keys. |
74
75
  | `group_by` | `none` | Specifies how bibliography items are grouped. Grouping can be multi-level, e.g. `type, year` groups entries per publication type, and within those groups per year. |
@@ -540,3 +540,44 @@ Feature: BibTeX
540
540
  When I run jekyll
541
541
  Then the _site directory should exist
542
542
  And I should see "The Ruby Programming Language" in "_site/scholar.html"
543
+
544
+ @tags @bibliography @locale
545
+ Scenario: Non-english reference
546
+ Given I have a scholar configuration with:
547
+ | key | value |
548
+ | source | ./_bibliography |
549
+ | bibliography | my_references |
550
+ | allow_locale_overrides | true |
551
+ | style | chicago-fullnote-bibliography |
552
+ And I have a "_bibliography" directory
553
+ And I have a file "_bibliography/my_references.bib":
554
+ """
555
+ @article{one,
556
+ title = {Ideología y narrativa en el Ramayana de Valmiki},
557
+ number = {22},
558
+ language = {es},
559
+ journal = {Estudios de Asia y Africa},
560
+ author = {Pollock, Sheldon I.},
561
+ year = {1987},
562
+ pages = {336--54}
563
+ }
564
+ @article{two,
565
+ title = {{Ideología y narrativa en el Ramayana de Valmiki}},
566
+ number = {22},
567
+ journal = {Estudios de Asia y Africa},
568
+ author = {Pollock, Sheldon I.},
569
+ year = {1987},
570
+ pages = {336--54}
571
+ }
572
+ """
573
+ And I have a page "scholar.html":
574
+ """
575
+ ---
576
+ ---
577
+ {% bibliography %}
578
+ """
579
+ When I run jekyll
580
+ Then the _site directory should exist
581
+ And the "_site/scholar.html" file should exist
582
+ And I should see "Estudios de Asia y Africa</i>, n.º 22" in "_site/scholar.html"
583
+ And I should see "Estudios De Asia y Africa</i>, no. 22" in "_site/scholar.html"
@@ -7,6 +7,8 @@ module Jekyll
7
7
  # treated as being read-only.
8
8
  STYLES = {}
9
9
 
10
+ LOCALES = {}
11
+
10
12
  # Utility methods used by several Scholar plugins. The methods in this
11
13
  # module may depend on the presence of #config, #bibtex_files, and
12
14
  # #site readers
@@ -113,6 +115,11 @@ module Jekyll
113
115
  end
114
116
  end
115
117
 
118
+ def allow_locale_overrides?
119
+ !!config['allow_locale_overrides']
120
+ end
121
+
122
+
116
123
  def locators
117
124
  @locators ||= []
118
125
  end
@@ -622,8 +629,18 @@ module Jekyll
622
629
  end
623
630
 
624
631
  def render_bibliography(entry, index = nil)
632
+ begin
633
+ original_locale, renderer.locale =
634
+ renderer.locale, locales(entry.language)
635
+ rescue
636
+ # Locale failed to load; just use original one!
637
+ end if allow_locale_overrides? &&
638
+ entry['language'] != renderer.locale.language
639
+
625
640
  renderer.render citation_item_for(entry, index),
626
- styles(style).bibliography
641
+ styles(style).bibliography
642
+ ensure
643
+ renderer.locale = original_locale unless original_locale.nil?
627
644
  end
628
645
 
629
646
  def citation_item_for(entry, citation_number = nil)
@@ -737,6 +754,10 @@ module Jekyll
737
754
  STYLES[style] ||= load_style(style)
738
755
  end
739
756
 
757
+ def locales(lang)
758
+ LOCALES[lang] ||= CSL::Locale.load(lang)
759
+ end
760
+
740
761
  def update_dependency_tree
741
762
  # Add bibtex files to dependency tree
742
763
  if context.registers[:page] and context.registers[:page].key? "path"
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '5.14.2'.freeze
3
+ VERSION = '5.15.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.14.2
4
+ version: 5.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-18 00:00:00.000000000 Z
11
+ date: 2019-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -149,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: 1.3.6
151
151
  requirements: []
152
- rubyforge_project: jekyll-scholar
153
- rubygems_version: 2.7.4
152
+ rubygems_version: 3.0.3
154
153
  signing_key:
155
154
  specification_version: 4
156
155
  summary: Jekyll extensions for the academic blogger.