jekyll-scholar 7.2.3 → 7.3.0
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 +4 -4
- data/README.md +16 -1
- data/features/citation.feature +35 -0
- data/features/grouping.feature +95 -0
- data/features/sorting.feature +102 -0
- data/lib/jekyll/scholar/defaults.rb +8 -2
- data/lib/jekyll/scholar/utilities.rb +69 -4
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a25fc2a0dd6f5d888094afeff216e143e388bdb0b2c87c3df58b4b8da8898a9
|
|
4
|
+
data.tar.gz: 0d9a23dae92cbade063caed08ba5db363b345a8c13e4823284c881ad1b0b4f6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5817e586d946392c4632e48c9d39f4bb8cb68ca0296641a1e370a8ee0eb305d795b8d506883df006c7dfcb3997fcbd31a3af6b3bb97690812c9f1d116ecb5d9b
|
|
7
|
+
data.tar.gz: 4bc025bd07d25bc68727f8e718b8356317bb97afe35d7968c3670928d60bcbd1e744c2b90cd2fff6b404b9be78650e36a613adf7abe7f526a750482ec239d59c
|
data/README.md
CHANGED
|
@@ -67,12 +67,13 @@ description of all options and their defaults, see
|
|
|
67
67
|
| `source` | `./_bibliography` | Indicates where your bibliographies are stored. |
|
|
68
68
|
| `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`. |
|
|
69
69
|
| `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'. |
|
|
70
|
-
| `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. |
|
|
70
|
+
| `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. Special field `name` provides a fallback chain across named entities: `author` → `editor` → `institution` → `organization` → `publisher`, useful for bibliographies where all entries should be alphabetized together regardless of entity type. |
|
|
71
71
|
| `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. |
|
|
72
72
|
| `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. |
|
|
73
73
|
| `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 }`. |
|
|
74
74
|
| `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. |
|
|
75
75
|
| `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. |
|
|
76
|
+
| `separate_links` | `false` | Experimental: If `true`, render each in-text citation in a citation group as a separate link (e.g. `[1, 2, 3]` would have 3 links, one to each citation). Otherwise, only render a single link to the first citation (default). May not work with citation styles that abbreviate ranges of citations, e.g. `[1-3]`. |
|
|
76
77
|
|
|
77
78
|
|
|
78
79
|
### Bibliographies
|
|
@@ -156,6 +157,20 @@ For more details about filters, see the corresponding section below or
|
|
|
156
157
|
consult the [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby)
|
|
157
158
|
documentation.
|
|
158
159
|
|
|
160
|
+
To create bibliographies where all entries are alphabetized together
|
|
161
|
+
regardless of whether they have authors, editors, or institutional
|
|
162
|
+
publishers, you can use the special `name` sort field in your configuration:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
scholar:
|
|
166
|
+
sort_by: name
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This will sort entries by their primary named entity, using the fallback chain:
|
|
170
|
+
`author` → `editor` → `institution` → `organization` → `publisher`. For example,
|
|
171
|
+
a book by an author, an edited volume, and a technical report would all be
|
|
172
|
+
sorted alphabetically together.
|
|
173
|
+
|
|
159
174
|
If you need to limit the number of entries in your bibliography, you can
|
|
160
175
|
use the `--max` option:
|
|
161
176
|
|
data/features/citation.feature
CHANGED
|
@@ -554,3 +554,38 @@ Feature: Citations
|
|
|
554
554
|
And I should see "Flanagan" in "_site/scholar.html"
|
|
555
555
|
And I should see "Gamma" in "_site/scholar.html"
|
|
556
556
|
|
|
557
|
+
@tags @cite
|
|
558
|
+
Scenario: Multiple Citations with separate links
|
|
559
|
+
Given I have a scholar configuration with:
|
|
560
|
+
| key | value |
|
|
561
|
+
| source | ./_bibliography |
|
|
562
|
+
| bibliography | my_references |
|
|
563
|
+
| separate_links | true |
|
|
564
|
+
And I have a "_bibliography" directory
|
|
565
|
+
And I have a file "_bibliography/my_references.bib":
|
|
566
|
+
"""
|
|
567
|
+
@book{ruby,
|
|
568
|
+
title = {The Ruby Programming Language},
|
|
569
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
|
570
|
+
year = {2008},
|
|
571
|
+
publisher = {O'Reilly Media}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
@book{microscope,
|
|
575
|
+
title = {Ruby Under a Microscope},
|
|
576
|
+
author = {Pat Shaughnessy},
|
|
577
|
+
year = {2013},
|
|
578
|
+
publisher = {No Starch Press}
|
|
579
|
+
}
|
|
580
|
+
"""
|
|
581
|
+
And I have a page "scholar.html":
|
|
582
|
+
"""
|
|
583
|
+
---
|
|
584
|
+
---
|
|
585
|
+
{% cite ruby microscope %}
|
|
586
|
+
"""
|
|
587
|
+
When I run jekyll
|
|
588
|
+
Then the _site directory should exist
|
|
589
|
+
And the "_site/scholar.html" file should exist
|
|
590
|
+
And I should see "\(<a.*href=\"#ruby\".*</a>; <a.*href=\"#microscope\".*</a>\)" in "_site/scholar.html"
|
|
591
|
+
|
data/features/grouping.feature
CHANGED
|
@@ -376,3 +376,98 @@ Feature: Grouping BibTeX Bibliographies
|
|
|
376
376
|
Then I should see "<h2 class=\"bibliography\">2007</h2>" in "_site/scholar.html"
|
|
377
377
|
And I should see "<h2 class=\"bibliography\">2008</h2>" in "_site/scholar.html"
|
|
378
378
|
And "2008" should come before "2007" in "_site/scholar.html"
|
|
379
|
+
|
|
380
|
+
@tags @grouping
|
|
381
|
+
Scenario: Group By Name
|
|
382
|
+
Given I have a scholar configuration with:
|
|
383
|
+
| key | value |
|
|
384
|
+
| group_by | name |
|
|
385
|
+
And I have a "_bibliography" directory
|
|
386
|
+
And I have a file "_bibliography/references.bib":
|
|
387
|
+
"""
|
|
388
|
+
@book{book_by_author,
|
|
389
|
+
title = {First Book by Adams},
|
|
390
|
+
author = {Adams, Alice},
|
|
391
|
+
year = {2020}
|
|
392
|
+
}
|
|
393
|
+
@book{another_by_author,
|
|
394
|
+
title = {Second Book by Adams},
|
|
395
|
+
author = {Adams, Alice},
|
|
396
|
+
year = {2021}
|
|
397
|
+
}
|
|
398
|
+
@book{edited_volume,
|
|
399
|
+
title = {Edited Collection},
|
|
400
|
+
editor = {Baker, Bob},
|
|
401
|
+
year = {2020}
|
|
402
|
+
}
|
|
403
|
+
@techreport{tech_report,
|
|
404
|
+
title = {Technical Report},
|
|
405
|
+
institution = {MIT},
|
|
406
|
+
year = {2020}
|
|
407
|
+
}
|
|
408
|
+
"""
|
|
409
|
+
And I have a page "scholar.html":
|
|
410
|
+
"""
|
|
411
|
+
---
|
|
412
|
+
---
|
|
413
|
+
{% bibliography -f references %}
|
|
414
|
+
"""
|
|
415
|
+
When I run jekyll
|
|
416
|
+
Then the _site directory should exist
|
|
417
|
+
And the "_site/scholar.html" file should exist
|
|
418
|
+
Then I should see "<h2 class=\"bibliography\">Adams, Alice</h2>" in "_site/scholar.html"
|
|
419
|
+
And I should see "<h2 class=\"bibliography\">Baker, Bob</h2>" in "_site/scholar.html"
|
|
420
|
+
And I should see "<h2 class=\"bibliography\">MIT</h2>" in "_site/scholar.html"
|
|
421
|
+
And "Adams, Alice" should come before "Baker, Bob" in "_site/scholar.html"
|
|
422
|
+
And "Baker, Bob" should come before "MIT" in "_site/scholar.html"
|
|
423
|
+
|
|
424
|
+
@tags @grouping
|
|
425
|
+
Scenario: Group By Name With Sorting Within Groups
|
|
426
|
+
Given I have a scholar configuration with:
|
|
427
|
+
| key | value |
|
|
428
|
+
| group_by | name |
|
|
429
|
+
| sort_by | year |
|
|
430
|
+
And I have a "_bibliography" directory
|
|
431
|
+
And I have a file "_bibliography/references.bib":
|
|
432
|
+
"""
|
|
433
|
+
@book{adams_2021,
|
|
434
|
+
title = {Second Book by Adams},
|
|
435
|
+
author = {Adams, Alice},
|
|
436
|
+
year = {2021}
|
|
437
|
+
}
|
|
438
|
+
@book{adams_2019,
|
|
439
|
+
title = {First Book by Adams},
|
|
440
|
+
author = {Adams, Alice},
|
|
441
|
+
year = {2019}
|
|
442
|
+
}
|
|
443
|
+
@book{adams_2020,
|
|
444
|
+
title = {Third Book by Adams},
|
|
445
|
+
author = {Adams, Alice},
|
|
446
|
+
year = {2020}
|
|
447
|
+
}
|
|
448
|
+
@book{baker_2022,
|
|
449
|
+
title = {Recent Edited Collection},
|
|
450
|
+
editor = {Baker, Bob},
|
|
451
|
+
year = {2022}
|
|
452
|
+
}
|
|
453
|
+
@book{baker_2018,
|
|
454
|
+
title = {Earlier Edited Collection},
|
|
455
|
+
editor = {Baker, Bob},
|
|
456
|
+
year = {2018}
|
|
457
|
+
}
|
|
458
|
+
"""
|
|
459
|
+
And I have a page "scholar.html":
|
|
460
|
+
"""
|
|
461
|
+
---
|
|
462
|
+
---
|
|
463
|
+
{% bibliography -f references %}
|
|
464
|
+
"""
|
|
465
|
+
When I run jekyll
|
|
466
|
+
Then the _site directory should exist
|
|
467
|
+
And the "_site/scholar.html" file should exist
|
|
468
|
+
Then I should see "<h2 class=\"bibliography\">Adams, Alice</h2>" in "_site/scholar.html"
|
|
469
|
+
And I should see "<h2 class=\"bibliography\">Baker, Bob</h2>" in "_site/scholar.html"
|
|
470
|
+
And "Adams, Alice" should come before "Baker, Bob" in "_site/scholar.html"
|
|
471
|
+
And "2019" should come before "2020" in "_site/scholar.html"
|
|
472
|
+
And "2020" should come before "2021" in "_site/scholar.html"
|
|
473
|
+
And "2018" should come before "2022" in "_site/scholar.html"
|
data/features/sorting.feature
CHANGED
|
@@ -299,3 +299,105 @@ Feature: Sorting BibTeX Bibliographies
|
|
|
299
299
|
And the "_site/scholar.html" file should exist
|
|
300
300
|
Then "March 08" should come before "December 08" in "_site/scholar.html"
|
|
301
301
|
And "December 08" should come before "August 07" in "_site/scholar.html"
|
|
302
|
+
|
|
303
|
+
@tags @sorting
|
|
304
|
+
Scenario: Sort By Name (Author/Editor/Institution/Organization/Publisher Fallback)
|
|
305
|
+
Given I have a scholar configuration with:
|
|
306
|
+
| key | value |
|
|
307
|
+
| sort_by | name |
|
|
308
|
+
And I have a "_bibliography" directory
|
|
309
|
+
And I have a file "_bibliography/references.bib":
|
|
310
|
+
"""
|
|
311
|
+
@book{has_author,
|
|
312
|
+
title = {Book by Author},
|
|
313
|
+
author = {Zulu, Zebra},
|
|
314
|
+
year = {2020}
|
|
315
|
+
}
|
|
316
|
+
@book{has_editor,
|
|
317
|
+
title = {Book by Editor},
|
|
318
|
+
editor = {Alpha, Andrew},
|
|
319
|
+
year = {2020}
|
|
320
|
+
}
|
|
321
|
+
@book{has_both,
|
|
322
|
+
title = {Book with Both},
|
|
323
|
+
author = {Meyer, Maria},
|
|
324
|
+
editor = {Yankee, Yellow},
|
|
325
|
+
year = {2020}
|
|
326
|
+
}
|
|
327
|
+
@techreport{has_institution,
|
|
328
|
+
title = {Technical Report},
|
|
329
|
+
institution = {MIT},
|
|
330
|
+
year = {2020}
|
|
331
|
+
}
|
|
332
|
+
@manual{has_organization,
|
|
333
|
+
title = {Standards Document},
|
|
334
|
+
organization = {OECD},
|
|
335
|
+
year = {2020}
|
|
336
|
+
}
|
|
337
|
+
@misc{has_publisher,
|
|
338
|
+
title = {Anonymous Work},
|
|
339
|
+
publisher = {Publisher House},
|
|
340
|
+
year = {2020}
|
|
341
|
+
}
|
|
342
|
+
@misc{has_none,
|
|
343
|
+
title = {No Named Entity},
|
|
344
|
+
year = {2020}
|
|
345
|
+
}
|
|
346
|
+
"""
|
|
347
|
+
And I have a page "scholar.html":
|
|
348
|
+
"""
|
|
349
|
+
---
|
|
350
|
+
---
|
|
351
|
+
{% bibliography -f references %}
|
|
352
|
+
"""
|
|
353
|
+
When I run jekyll
|
|
354
|
+
Then the _site directory should exist
|
|
355
|
+
And the "_site/scholar.html" file should exist
|
|
356
|
+
Then "No Named Entity" should come before "Book by Editor" in "_site/scholar.html"
|
|
357
|
+
And "Book by Editor" should come before "Book with Both" in "_site/scholar.html"
|
|
358
|
+
And "Book with Both" should come before "Technical Report" in "_site/scholar.html"
|
|
359
|
+
And "Technical Report" should come before "Standards Document" in "_site/scholar.html"
|
|
360
|
+
And "Standards Document" should come before "Anonymous Work" in "_site/scholar.html"
|
|
361
|
+
And "Anonymous Work" should come before "Book by Author" in "_site/scholar.html"
|
|
362
|
+
|
|
363
|
+
@tags @sorting
|
|
364
|
+
Scenario: Sort By Name With Corporate Authors (Double Braces)
|
|
365
|
+
Given I have a scholar configuration with:
|
|
366
|
+
| key | value |
|
|
367
|
+
| sort_by | name |
|
|
368
|
+
And I have a "_bibliography" directory
|
|
369
|
+
And I have a file "_bibliography/references.bib":
|
|
370
|
+
"""
|
|
371
|
+
@book{personal_author,
|
|
372
|
+
title = {Book by Personal Author},
|
|
373
|
+
author = {Smith, John},
|
|
374
|
+
year = {2020}
|
|
375
|
+
}
|
|
376
|
+
@misc{corporate_double_brace,
|
|
377
|
+
title = {Annual Vegetable Report},
|
|
378
|
+
author = {{Cauliflower Appreciation Society}},
|
|
379
|
+
year = {2020}
|
|
380
|
+
}
|
|
381
|
+
@book{personal_early,
|
|
382
|
+
title = {Book by Early Author},
|
|
383
|
+
author = {Baker, Bob},
|
|
384
|
+
year = {2020}
|
|
385
|
+
}
|
|
386
|
+
@misc{corporate_early,
|
|
387
|
+
title = {Used Kar Price Guide},
|
|
388
|
+
author = {{Aardvark Kar Korp LTD}},
|
|
389
|
+
year = {2020}
|
|
390
|
+
}
|
|
391
|
+
"""
|
|
392
|
+
And I have a page "scholar.html":
|
|
393
|
+
"""
|
|
394
|
+
---
|
|
395
|
+
---
|
|
396
|
+
{% bibliography -f references %}
|
|
397
|
+
"""
|
|
398
|
+
When I run jekyll
|
|
399
|
+
Then the _site directory should exist
|
|
400
|
+
And the "_site/scholar.html" file should exist
|
|
401
|
+
Then "Used Kar Price Guide" should come before "Book by Early Author" in "_site/scholar.html"
|
|
402
|
+
And "Book by Early Author" should come before "Annual Vegetable Report" in "_site/scholar.html"
|
|
403
|
+
And "Annual Vegetable Report" should come before "Book by Personal Author" in "_site/scholar.html"
|
|
@@ -60,11 +60,11 @@ module Jekyll
|
|
|
60
60
|
# Valid template parameters:
|
|
61
61
|
# ":details_dir" The value of the details_dir field in the scholar config
|
|
62
62
|
# ":key" The bibtex citation key.
|
|
63
|
-
# ":doi" The DOI. If the DOI is missing or blank, this returns the citation key.
|
|
63
|
+
# ":doi" The DOI. If the DOI is missing or blank, this returns the citation key.
|
|
64
64
|
# ":extension" Either of ".html" or "/index.html" depending upon the global permalink setting.
|
|
65
65
|
# Template parameters can also include any key defined in the bibtex file, e.g. ":year", ":title", etc.
|
|
66
66
|
# Bibtex keys such as 'title' are slugified in the same way as Jekyll treats blog post titles.
|
|
67
|
-
'details_permalink' => '/:details_dir/:key:extension',
|
|
67
|
+
'details_permalink' => '/:details_dir/:key:extension',
|
|
68
68
|
|
|
69
69
|
'bibliography_class' => 'bibliography',
|
|
70
70
|
'bibliography_template' => '{{reference}}',
|
|
@@ -78,6 +78,12 @@ module Jekyll
|
|
|
78
78
|
|
|
79
79
|
'cite_class' => 'citation',
|
|
80
80
|
|
|
81
|
+
# If true, render in-page links from in-text citations to references as separate links (one link per citation).
|
|
82
|
+
# If false, render as only one link to the first citation.
|
|
83
|
+
# Note: This feature may not work with citation styles that group in-text citations
|
|
84
|
+
# like `[1-3]` rather than `[1, 2, 3]`
|
|
85
|
+
'separate_links' => false,
|
|
86
|
+
|
|
81
87
|
'type_names' => {
|
|
82
88
|
'article' => 'Journal Articles',
|
|
83
89
|
'book' => 'Books',
|
|
@@ -236,14 +236,29 @@ module Jekyll
|
|
|
236
236
|
!offset.nil? || !max.nil?
|
|
237
237
|
end
|
|
238
238
|
|
|
239
|
+
def resolve_sort_value(entry, key)
|
|
240
|
+
case key
|
|
241
|
+
when 'name'
|
|
242
|
+
# Fallback chain: author → editor → institution → organization → publisher
|
|
243
|
+
# Convert to lowercase string for case-insensitive cross-type comparison
|
|
244
|
+
# Strip leading/trailing braces and whitespace (for corporate authors like {{Name}})
|
|
245
|
+
value = entry[:author] || entry[:editor] || entry[:institution] ||
|
|
246
|
+
entry[:organization] || entry[:publisher]
|
|
247
|
+
normalized = value ? value.to_s.gsub(/\A[{\s]+|[}\s]+\z/, '').downcase : ''
|
|
248
|
+
BibTeX::Value.new(normalized)
|
|
249
|
+
else
|
|
250
|
+
entry[key].nil? ? BibTeX::Value.new : entry[key]
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
239
254
|
def sort(unsorted)
|
|
240
255
|
return unsorted if skip_sort?
|
|
241
256
|
|
|
242
257
|
sorted = unsorted.sort do |e1, e2|
|
|
243
258
|
sort_keys
|
|
244
259
|
.map.with_index do |key, idx|
|
|
245
|
-
v1 = e1
|
|
246
|
-
v2 = e2
|
|
260
|
+
v1 = resolve_sort_value(e1, key)
|
|
261
|
+
v2 = resolve_sort_value(e2, key)
|
|
247
262
|
if (sort_order[idx] || sort_order.last) =~ /^(desc|reverse)/i
|
|
248
263
|
v2 <=> v1
|
|
249
264
|
else
|
|
@@ -350,6 +365,10 @@ module Jekyll
|
|
|
350
365
|
else
|
|
351
366
|
value.to_s
|
|
352
367
|
end
|
|
368
|
+
when 'name'
|
|
369
|
+
value = item[:author] || item[:editor] || item[:institution] ||
|
|
370
|
+
item[:organization] || item[:publisher] || BibTeX::Value.new
|
|
371
|
+
value.to_s
|
|
353
372
|
else
|
|
354
373
|
value = item[key]
|
|
355
374
|
if value.numeric?
|
|
@@ -501,6 +520,30 @@ module Jekyll
|
|
|
501
520
|
interpolate(@style)|| config['style']
|
|
502
521
|
end
|
|
503
522
|
|
|
523
|
+
# The citation layout object for the currently selected style
|
|
524
|
+
# @return [CSL::Style::Layout]
|
|
525
|
+
def layout
|
|
526
|
+
styles(style).citation.layout
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
# Prefix string before citations. If style has no prefix, return empty string
|
|
530
|
+
# @return [String]
|
|
531
|
+
def csl_prefix
|
|
532
|
+
layout.attributes.prefix.nil? ? '' : layout.attributes.prefix
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
# Suffix string after citations. If style has no suffix, return empty string
|
|
536
|
+
# @return [String]
|
|
537
|
+
def csl_suffix
|
|
538
|
+
layout.attributes.suffix.nil? ? '' : layout.attributes.suffix
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
# Delimiter between citations in a citation group
|
|
542
|
+
# @return [String]
|
|
543
|
+
def delimiter
|
|
544
|
+
layout.delimiter
|
|
545
|
+
end
|
|
546
|
+
|
|
504
547
|
def missing_reference
|
|
505
548
|
config['missing_reference']
|
|
506
549
|
end
|
|
@@ -742,14 +785,33 @@ module Jekyll
|
|
|
742
785
|
if bibliography.key?(key)
|
|
743
786
|
entry = bibliography[key]
|
|
744
787
|
cite_cache.getset(key) do
|
|
745
|
-
entry.convert(*bibtex_filters) unless bibtex_filters.empty?
|
|
788
|
+
entry = entry.convert(*bibtex_filters) unless bibtex_filters.empty?
|
|
789
|
+
|
|
790
|
+
if config['separate_links']
|
|
791
|
+
## Render each citation in the group as a separate link
|
|
792
|
+
# Render the single citation, stripping delimiting characters
|
|
793
|
+
rendered = render_citation([entry])
|
|
794
|
+
.sub(/^#{Regexp.escape(csl_prefix)}/, '')
|
|
795
|
+
.sub(/#{Regexp.escape(csl_suffix)}$/, '')
|
|
796
|
+
|
|
797
|
+
# Then render to HTML with the link to this specific citation
|
|
798
|
+
link_to link_target_for(key), rendered, {class: config['cite_class']}
|
|
799
|
+
else
|
|
800
|
+
entry
|
|
801
|
+
end
|
|
746
802
|
end
|
|
747
803
|
else
|
|
748
804
|
return missing_reference
|
|
749
805
|
end
|
|
750
806
|
end
|
|
751
807
|
|
|
752
|
-
|
|
808
|
+
if config['separate_links']
|
|
809
|
+
# Combine individual linkified items
|
|
810
|
+
csl_prefix + items.join(delimiter) + csl_suffix
|
|
811
|
+
else
|
|
812
|
+
# Render as a single link
|
|
813
|
+
link_to link_target_for(keys[0]), render_citation(items), {class: config['cite_class']}
|
|
814
|
+
end
|
|
753
815
|
end
|
|
754
816
|
|
|
755
817
|
def nocite(keys)
|
|
@@ -828,6 +890,7 @@ module Jekyll
|
|
|
828
890
|
self
|
|
829
891
|
end
|
|
830
892
|
|
|
893
|
+
# @return [CSL::Style]
|
|
831
894
|
def load_style(uri)
|
|
832
895
|
begin
|
|
833
896
|
style = CSL::Style.load uri
|
|
@@ -847,6 +910,8 @@ module Jekyll
|
|
|
847
910
|
end
|
|
848
911
|
end
|
|
849
912
|
|
|
913
|
+
# Access or load style by style URI or relative path
|
|
914
|
+
# @return [CSL::Style]
|
|
850
915
|
def styles(style)
|
|
851
916
|
STYLES[style] ||= load_style(style)
|
|
852
917
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-scholar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sylvester Keil
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: jekyll
|