jekyll-scholar 6.6.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 553c6ce018f518f25bb57bd76a547da001554588f947d158db5630ca3a863294
4
- data.tar.gz: 8e18201f73e7157d096d84447c6fc526dbe6094b8bcf4f43a407d91b780ff3b9
3
+ metadata.gz: bf67ce28716d6238d1ba9306450a14c19ba4f9856071373dd05f3796b655bdaf
4
+ data.tar.gz: 96ab65e69d8c14e01e5d802dafe9091458c28eb373d5b37b9479bdd3439bf8ef
5
5
  SHA512:
6
- metadata.gz: 98d42799eb2356464ef26cef26cff2de39e1e3b39352ec4bb77e41c5a70dc9fe39dafc4ad8b4fc0a261c90530ea9bc5152e5b66468c3715f422910bf96061a89
7
- data.tar.gz: '09f0301742a895a3cb8a1d09a604715bf79034cb08f55b946bf3733999700f69d4adc537befd01f376e9bd4d06bb26891f97ef290d1023acf4083c989ba08810'
6
+ metadata.gz: d0629713d0e4f78640df2b32f7c9895726a17db5087eed933f2b7c34b7242b9aeff4ff0bcd6d7e4ae2401ac4c4946d158d454189a7653089b3f44ca2dd373751
7
+ data.tar.gz: 49272efe88a89be98a9f5c9b06ea3b825579c536abc342e6197607340a9aa4a14ae94bf7f324718c100875633506e098ba9bc28554fd2cf5e765e82a0d4789ac
data/README.md CHANGED
@@ -74,6 +74,7 @@ description of all options and their defaults, see
74
74
  | `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. |
75
75
  | `group_order` | `ascending` | Ordering for groups is specified in the same way as the sort order. Publication types -- specified with group key `type`, can be ordered by adding `type_order` to the configuration. For example, `type_order: [article,techreport]` lists journal articles before technical reports. Types not mentioned in `type_order` are considered smaller than types that are mentioned. Types can be merge in one group using the `type_aliases` setting. By default `phdthesis` and `mastersthesis` are grouped as `thesis`. By using, for example, `type_aliases: { inproceedings: article}`, journal and conference articles appear in a single group. The display names for entry types are specified with `type_names`. Names for common types are provided, but they can be extended or overridden. For example, the default name for `article` is *Journal Articles*, but it can be changed to *Papers* using `type_names: { article: Papers }`. |
76
76
  | `bibtex_filters` | `latex,smallcaps,superscript` | Configures which [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby) formatting filters values of entries should be passed through. The default `latex` filter converts LaTeX character escapes into unicode, `smallcaps` converts the `\textsc` command into a HTML `<font style=\"font-variant: small-caps\">` tag, and `superscript` which converts the `\textsuperscript` command into a HTML `<sup>` tag. |
77
+ | `raw_bibtex_filters` | ` ` | Configures which [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby) formatting filters the raw BiBTeX entry (i.e. that available through `{{ entry.bibtex }}`) should be passed through. This can be used to e.g. strip excess newlines by using the `linebreaks` filter. |
77
78
 
78
79
 
79
80
  ### Bibliographies
@@ -609,3 +609,39 @@ Feature: BibTeX
609
609
  And the "_site/scholar.html" file should exist
610
610
  And I should see "This is <span class="tiny">i is tiny</span> to me." in "_site/scholar.html"
611
611
 
612
+ @tags @filters
613
+ Scenario: Apply raw BiBTeX filters
614
+ Given I have a scholar configuration with:
615
+ | key | value |
616
+ | source | ./_bibliography |
617
+ | bibliography_template | bibliography |
618
+ And I have the following raw BibTeX filters:
619
+ | linebreaks |
620
+ And I have a "_bibliography" directory
621
+ And I have a file "_bibliography/references.bib":
622
+ """
623
+ @misc{pickaxe,
624
+ title = {Long
625
+ line},
626
+ series = {Longer
627
+ line}
628
+ }
629
+ """
630
+ And I have a "_layouts" directory
631
+ And I have a file "_layouts/bibliography.html":
632
+ """
633
+ ---
634
+ ---
635
+ {{ entry.bibtex }}
636
+ """
637
+ And I have a page "scholar.html":
638
+ """
639
+ ---
640
+ ---
641
+ {% bibliography %}
642
+ """
643
+ When I run jekyll
644
+ Then the _site directory should exist
645
+ And the "_site/scholar.html" file should exist
646
+ And I should see "@misc{pickaxe,\n title = {Long line},\n series = {Longer line}" in "_site/scholar.html"
647
+
@@ -36,6 +36,15 @@ Given(/^I have the following BibTeX filters:$/) do |table|
36
36
  end
37
37
  end
38
38
 
39
+ Given(/^I have the following raw BibTeX filters:$/) do |table|
40
+ File.open('_config.yml', 'a') do |f|
41
+ f.write(" raw_bibtex_filters:\n")
42
+ table.raw.flatten.each do |row|
43
+ f.write(" - #{row}\n")
44
+ end
45
+ end
46
+ end
47
+
39
48
  Then(/^"(.*)" should come before "(.*)" in "(.*)"$/) do |p1, p2, file|
40
49
  data = File.open(file).readlines.join('')
41
50
 
@@ -37,6 +37,7 @@ module Jekyll
37
37
 
38
38
  'bibtex_options' => { :strip => false, :parse_months => true },
39
39
  'bibtex_filters' => [ :smallcaps, :superscript, :italics, :textit, :lowercase, :textregistered, :tiny, :latex ],
40
+ 'raw_bibtex_filters' => [ ],
40
41
  'bibtex_skip_fields' => [ :abstract, :month_numeric ],
41
42
  'bibtex_quotes' => ['{', '}'],
42
43
 
@@ -165,6 +165,10 @@ module Jekyll
165
165
  config['bibtex_filters'] ||= []
166
166
  end
167
167
 
168
+ def raw_bibtex_filters
169
+ config['raw_bibtex_filters'] ||= []
170
+ end
171
+
168
172
  def bibtex_paths
169
173
  bibtex_files.map { |file|
170
174
  interpolated_file = interpolate file
@@ -548,8 +552,13 @@ module Jekyll
548
552
  e['key'] = entry.key
549
553
  e['type'] = entry.type.to_s
550
554
 
555
+ conv_opts = { quotes: config['bibtex_quotes'] }
556
+ if !raw_bibtex_filters.empty?
557
+ conv_opts[:filter] = *raw_bibtex_filters
558
+ end
559
+
551
560
  if entry.field_names(config['bibtex_skip_fields']).empty?
552
- e['bibtex'] = entry.to_s({ quotes: config['bibtex_quotes'] })
561
+ e['bibtex'] = entry.to_s(conv_opts)
553
562
  else
554
563
  tmp = entry.dup
555
564
 
@@ -557,7 +566,7 @@ module Jekyll
557
566
  tmp.delete name if tmp.field?(name)
558
567
  end
559
568
 
560
- e['bibtex'] = tmp.to_s({ quotes: config['bibtex_quotes'] })
569
+ e['bibtex'] = tmp.to_s(conv_opts)
561
570
  end
562
571
 
563
572
  #e['raw_bibtex'] = "{%raw%}#{e['bibtex']}{%endraw%}"
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '6.6.0'.freeze
3
+ VERSION = '6.6.1'.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: 6.6.0
4
+ version: 6.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll