asciidoctor-bibliography 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +4 -0
- data/lib/asciidoctor-bibliography/citation.rb +3 -1
- data/lib/asciidoctor-bibliography/version.rb +1 -1
- data/spec/nocite_spec.rb +58 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3ef87661528a8d76c3dd46349a4ca163574960fd7485782d15d4130f935e41d
|
4
|
+
data.tar.gz: d67db2e1f2a2c8e0a469b77f07de918ef9c613d03d387b5a94aa8a69dba27cfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e717eb97162f243c779fa3abd3e431b952d961cc96ccba49bfd9ed4315073374304167c8ae5a5c896129cedd9443ca63467d3813c323318684367a4809117b
|
7
|
+
data.tar.gz: a690051fadefc7b4672102d6bccb468940a82f7a364333ad651ad7dc6560a909565cc2fd483acf202bb5d760fad27983bba8c4a5df30aeb3da53321bcdbce495
|
data/README.adoc
CHANGED
@@ -328,9 +328,13 @@ and can be used with a few styles:
|
|
328
328
|
* `citeauthor*`
|
329
329
|
* `citeyear`
|
330
330
|
* `citeyearpar`
|
331
|
+
* `nocite`
|
331
332
|
|
332
333
|
To cite multiple items you can concatenate them just like with `cite`.
|
333
334
|
|
335
|
+
IMPORTANT: The `nocite` macro does not provide an equivalent to the ordinary `TeX`
|
336
|
+
wildcard notation `\nocite{*}` to print all references.
|
337
|
+
|
334
338
|
All macros accept standard locators, `locator`, `suffix` and `prefix`.
|
335
339
|
The behaviour of these parameters is designed to reproduce the one expected
|
336
340
|
from the traditional `TeX` citation macros `\cite...[prefix][suffix]{key}`.
|
@@ -9,7 +9,7 @@ module AsciidoctorBibliography
|
|
9
9
|
TEX_MACROS = %w[citet citet* citealt citealt* citep citep* citealp citealp*
|
10
10
|
citeauthor citeauthor* citeyear citeyearpar].freeze
|
11
11
|
|
12
|
-
MACRO_NAME_REGEXP = TEX_MACROS.dup.concat(%w[cite fullcite]).
|
12
|
+
MACRO_NAME_REGEXP = TEX_MACROS.dup.concat(%w[cite fullcite nocite]).
|
13
13
|
map { |s| Regexp.escape s }.join("|").freeze
|
14
14
|
|
15
15
|
REGEXP = /
|
@@ -78,6 +78,8 @@ module AsciidoctorBibliography
|
|
78
78
|
render_citation_with_csl(bibliographer)
|
79
79
|
when "fullcite"
|
80
80
|
render_fullcite_with_csl(bibliographer)
|
81
|
+
when "nocite"
|
82
|
+
""
|
81
83
|
when *TEX_MACROS
|
82
84
|
render_texmacro_with_csl(bibliographer)
|
83
85
|
end
|
data/spec/nocite_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require "asciidoctor-bibliography"
|
4
|
+
|
5
|
+
describe "a typical usage of nocite" do
|
6
|
+
let(:document) do
|
7
|
+
input = <<~'ASCIIDOC'
|
8
|
+
:bibliography-database: ./spec/fixtures/database.bib
|
9
|
+
:bibliography-style: apa
|
10
|
+
|
11
|
+
== Hidden citations
|
12
|
+
Nothing here: nocite:[Lane12a].
|
13
|
+
Nothing here: nocite:[Erdos65]+special[Einstein35].
|
14
|
+
|
15
|
+
== Default bibliography
|
16
|
+
bibliography::[]
|
17
|
+
|
18
|
+
== Special bibliography
|
19
|
+
bibliography::special[]
|
20
|
+
ASCIIDOC
|
21
|
+
document = ::Asciidoctor::Document.new(input)
|
22
|
+
document.parse
|
23
|
+
document
|
24
|
+
end
|
25
|
+
|
26
|
+
it "hides citations and show references" do
|
27
|
+
expect(document.convert).to eq <<~HTML.rstrip
|
28
|
+
<div class="sect1">
|
29
|
+
<h2 id="_hidden_citations">Hidden citations</h2>
|
30
|
+
<div class="sectionbody">
|
31
|
+
<div class="paragraph">
|
32
|
+
<p>Nothing here: .
|
33
|
+
Nothing here: .</p>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<div class="sect1">
|
38
|
+
<h2 id="_default_bibliography">Default bibliography</h2>
|
39
|
+
<div class="sectionbody">
|
40
|
+
<div class="paragraph">
|
41
|
+
<p><a id="bibliography-default-Erdos65"></a>Erdős, P., Heyting, A., & Brouwer, L. E. (1965). Some very hard sums. <em>Difficult Maths Today</em>, 30.</p>
|
42
|
+
</div>
|
43
|
+
<div class="paragraph">
|
44
|
+
<p><a id="bibliography-default-Lane12a"></a>Lane, P. (2000). <em>Book title</em>. Publisher.</p>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
<div class="sect1">
|
49
|
+
<h2 id="_special_bibliography">Special bibliography</h2>
|
50
|
+
<div class="sectionbody">
|
51
|
+
<div class="paragraph">
|
52
|
+
<p><a id="bibliography-special-Einstein35"></a>Einstein, A., Podolsky, B., & Rosen, N. (1935). Can quantum-mechanical description of physical reality be considered complete? <em>Physical Review</em>, <em>47</em>(10), 777.</p>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
HTML
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-bibliography
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -308,6 +308,7 @@ files:
|
|
308
308
|
- spec/fixtures/database.unk
|
309
309
|
- spec/index_spec.rb
|
310
310
|
- spec/macros_spec.rb
|
311
|
+
- spec/nocite_spec.rb
|
311
312
|
- spec/options_spec.rb
|
312
313
|
- spec/sanity_spec.rb
|
313
314
|
- spec/spec_helper.rb
|