csl 1.6.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb03f0268591576f09ecfcdae39744460bc1b9d35b9b63f186e1c5dee8e131d8
4
- data.tar.gz: b633824d0f2bc138f74a8747a1785edf2194a6eb2013daa3bac57469474de1c4
3
+ metadata.gz: fc5ceeb1aaf835b313d9f3ecf27add61c0aaf6affdbcdbe4061e92020619e7f1
4
+ data.tar.gz: 994ffcf72cffe05d02b80896fab5d766c4c101a73b35b9c1626f8969851404f5
5
5
  SHA512:
6
- metadata.gz: 41a71ce9c56b13f24c1713c237e90a555113c5a06ec0800e71c53750aa3c9048c1582b1aa3f09ce86d9b964dd84bdca94a9439f84cbc51f35654b1abc6b5a5e1
7
- data.tar.gz: 4fbe146239c6afc00e3f52768a09758549e0c6c92ed386a9a4c7b97dc1e784564773bca261f4bf848e202ccce31406604db8560fc3573c2b6746e4817c84637a
6
+ metadata.gz: 880d27b5adb8e6048e919c8c43dd5a3ca32ddf99751a6dddc7cc121c4561b730da786a01694caeb03578132625e2c1a529a16f4ec02e4b70904c141609141aee
7
+ data.tar.gz: 90571a1c4eafa52e8eaea2d7541e132113e19759623943b2021418dcc6eda3f0a9a8d734b9629f01940f2db237233ca6f14adc45afd071bdae13081952bbe0c4
@@ -14,13 +14,20 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  ruby-version:
17
- - 3.0
18
- - 2.7
19
- - 2.6
17
+ - 3.4
18
+ - 3.3
19
+ - 3.2
20
+ - 3.1
20
21
  steps:
21
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v4
22
23
  - uses: ruby/setup-ruby@v1
23
24
  with:
24
25
  ruby-version: ${{ matrix.ruby-version }}
25
26
  bundler-cache: true
26
27
  - run: bundle exec rake
28
+ - name: Upload coverage results
29
+ if: matrix.ruby-version == '3.3'
30
+ continue-on-error: true
31
+ uses: coverallsapp/github-action@v2
32
+ with:
33
+ github-token: ${{ github.token }}
data/BSDL CHANGED
@@ -1,7 +1,7 @@
1
1
  CSL-Ruby. A Ruby CSL parser and library.
2
2
 
3
3
  Copyright 2012 President and Fellows of Harvard College.
4
- Copyright 2009-2020 Sylvester Keil. All rights reserved.
4
+ Copyright 2009-2025 Sylvester Keil. All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
7
7
  modification, are permitted provided that the following conditions are met:
data/Gemfile CHANGED
@@ -4,11 +4,12 @@ gemspec
4
4
  group :development, :test do
5
5
  gem 'rake'
6
6
  gem 'rspec'
7
+ gem 'stringio'
7
8
  gem 'cucumber'
8
9
  end
9
10
 
10
11
  group :debug do
11
- gem 'byebug', require: false, platforms: :mri
12
+ gem 'debug', '>= 1.0.0', require: false, platforms: :mri
12
13
  gem 'ruby-debug', require: false, platforms: :jruby
13
14
  end
14
15
 
@@ -25,6 +26,7 @@ end
25
26
 
26
27
  group :coverage do
27
28
  gem 'simplecov', require: false
29
+ gem 'simplecov-lcov', require: false
28
30
  end
29
31
 
30
32
  # vim: syntax=ruby
data/README.md CHANGED
@@ -135,7 +135,7 @@ this project as part of [Google Summer of Code](https://developers.google.com/op
135
135
 
136
136
  Copyright
137
137
  ---------
138
- Copyright 2009-2020 Sylvester Keil. All rights reserved.
138
+ Copyright 2009-2025 Sylvester Keil. All rights reserved.
139
139
 
140
140
  Copyright 2012 President and Fellows of Harvard College.
141
141
 
data/csl.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.authors = ['Sylvester Keil']
20
20
  s.email = ['http://sylvester.keil.or.at']
21
21
  s.homepage = 'https://github.com/inukshuk/csl-ruby'
22
- s.licenses = ['AGPL-3.0','BSD-2-Clause']
22
+ s.licenses = ['BSD-2-Clause']
23
23
  s.date = Time.now.strftime('%Y-%m-%d')
24
24
  s.summary = 'A Ruby CSL parser and library'
25
25
  s.description = <<~EOS
@@ -30,8 +30,13 @@ Gem::Specification.new do |s|
30
30
 
31
31
 
32
32
  s.required_ruby_version = '>= 2.2'
33
- s.add_runtime_dependency('namae', ['~>1.0'])
34
- s.add_runtime_dependency('rexml')
33
+ s.add_dependency('namae', ['~> 1.2'])
34
+ s.add_dependency('rexml', '~> 3.0')
35
+ s.add_dependency('forwardable', '~> 1.3')
36
+ s.add_dependency('open-uri', '< 1.0')
37
+ s.add_dependency('singleton', '< 1.0')
38
+ s.add_dependency('set', '~> 1.1')
39
+ s.add_dependency('time', '< 1.0')
35
40
 
36
41
  s.files = `git ls-files`.split("\n") - EXCLUDES
37
42
  s.require_path = 'lib'
data/lib/csl/schema.rb CHANGED
@@ -2,46 +2,172 @@ module CSL
2
2
 
3
3
  class Schema
4
4
 
5
- @version = '1.0.1'.freeze
5
+ @version = '1.0.2'.freeze
6
6
  @major_version = '1.0'.freeze
7
7
 
8
8
  @namespace = 'http://purl.org/net/xbiblio/csl'.freeze
9
9
  @preamble = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".freeze
10
10
 
11
- @default_license = 'http://creativecommons.org/licenses/by-sa/3.0/'
11
+ @default_license = 'https://creativecommons.org/licenses/by-sa/4.0/'
12
12
  @default_rights_string =
13
- 'This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License'
14
-
15
- @types = %w{ article article-journal article-magazine article-newspaper
16
- bill book broadcast chapter entry entry-dictionary entry-encyclopedia
17
- figure graphic interview legal_case legislation manuscript map
18
- motion_picture musical_score pamphlet paper-conference patent
19
- personal_communication post post-weblog report review review-book song
20
- speech thesis treaty webpage }.map(&:to_sym).freeze
13
+ 'This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.'
14
+
15
+ @types = %w{
16
+ article
17
+ article-journal
18
+ article-magazine
19
+ article-newspaper
20
+ bill
21
+ book
22
+ broadcast
23
+ chapter
24
+ classic
25
+ collection
26
+ dataset
27
+ document
28
+ entry
29
+ entry-dictionary
30
+ entry-encyclopedia
31
+ event
32
+ figure
33
+ graphic
34
+ hearing
35
+ interview
36
+ legal_case
37
+ legislation
38
+ manuscript
39
+ map
40
+ motion_picture
41
+ musical_score
42
+ pamphlet
43
+ paper-conference
44
+ patent
45
+ performance
46
+ periodical
47
+ personal_communication
48
+ post
49
+ post-weblog
50
+ regulation
51
+ report
52
+ review
53
+ review-book
54
+ software
55
+ song
56
+ speech
57
+ standard
58
+ thesis
59
+ treaty
60
+ webpage
61
+ }.map(&:to_sym).freeze
21
62
 
22
63
  @variables = Hash.new { |h,k| h.fetch(k.to_sym, nil) }.merge({
23
64
  :date => %w{
24
- accessed container event-date issued original-date submitted
65
+ accessed
66
+ available-date
67
+ event-date
68
+ issued
69
+ original-date
70
+ submitted
25
71
  },
26
72
 
27
73
  :names => %w{
28
- author collection-editor composer container-author recipient editor
29
- editorial-director illustrator interviewer original-author translator
74
+ author
75
+ chair
76
+ collection-editor
77
+ compiler
78
+ composer
79
+ container-author
80
+ contributor
81
+ creator
82
+ curator
83
+ editor
84
+ editorial-director
85
+ executive-producer
86
+ guest
87
+ host
88
+ illustrator
89
+ interviewer
90
+ narrator
91
+ organizer
92
+ original-author
93
+ performer
94
+ producer
95
+ recipient
96
+ translator
97
+ writer
30
98
  },
31
99
 
32
100
  :number => %w{
33
- chapter-number collection-number edition issue number number-of-pages
34
- number-of-volumes volume
101
+ chapter-number
102
+ citation-number
103
+ collection-number
104
+ edition
105
+ first-reference-note-number
106
+ issue
107
+ locator
108
+ number
109
+ number-of-pages
110
+ number-of-volumes
111
+ page
112
+ page-first
113
+ part-number
114
+ printing-number
115
+ section
116
+ supplement-number
117
+ version
118
+ volume
35
119
  },
36
120
 
37
121
  :text => %w{
38
- abstract annote archive archive_location archive-place authority
39
- call-number citation-label citation-number collection-title
40
- container-title container-title-short dimensions DOI event event-place
41
- first-reference-note-number genre ISBN ISSN jurisdiction keyword
42
- locator medium note original-publisher original-publisher-place
43
- original-title page page-first PMID PMCID publisher publisher-place
44
- references section source status title title-short URL version
122
+ abstract
123
+ annote
124
+ archive
125
+ archive_collection
126
+ archive_location
127
+ archive-place
128
+ authority
129
+ call-number
130
+ citation-key
131
+ citation-label
132
+ collection-title
133
+ container-title
134
+ container-title-short
135
+ dimensions
136
+ division
137
+ DOI
138
+ event
139
+ event-place
140
+ event-title
141
+ genre
142
+ ISBN
143
+ ISSN
144
+ jurisdiction
145
+ keyword
146
+ language
147
+ license
148
+ medium
149
+ note
150
+ original-publisher
151
+ original-publisher-place
152
+ original-title
153
+ part
154
+ part-title
155
+ PMCID
156
+ PMID
157
+ printing
158
+ publisher
159
+ publisher-place
160
+ references
161
+ reviewed-genre
162
+ reviewed-title
163
+ scale
164
+ source
165
+ status
166
+ title
167
+ title-short
168
+ translated-title
169
+ URL
170
+ volume-title
45
171
  year-suffix
46
172
  }
47
173
  })
@@ -192,7 +318,7 @@ module CSL
192
318
  case
193
319
  when node =~ /^\s*</
194
320
  @validator[@schema, node]
195
- when File.exists?(node)
321
+ when File.exist?(node)
196
322
  @validator[@schema, File.open(node, 'r:UTF-8')]
197
323
  else
198
324
  glob = Dir.glob(node)
data/lib/csl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -0,0 +1,130 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns:cs="http://purl.org/net/xbiblio/csl" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
3
+ <div>
4
+ <a:documentation>cs:choose - Conditional Statements"</a:documentation>
5
+ <define name="rendering-element.choose">
6
+ <element name="cs:choose">
7
+ <a:documentation>Use to conditionally render rendering elements.</a:documentation>
8
+ <ref name="choose.if"/>
9
+ <zeroOrMore>
10
+ <ref name="choose.else-if"/>
11
+ </zeroOrMore>
12
+ <optional>
13
+ <ref name="choose.else"/>
14
+ </optional>
15
+ </element>
16
+ </define>
17
+ <define name="choose.if">
18
+ <element name="cs:if">
19
+ <oneOrMore>
20
+ <ref name="condition"/>
21
+ </oneOrMore>
22
+ <ref name="match"/>
23
+ <zeroOrMore>
24
+ <ref name="rendering-element"/>
25
+ </zeroOrMore>
26
+ </element>
27
+ </define>
28
+ <define name="choose.else-if">
29
+ <element name="cs:else-if">
30
+ <oneOrMore>
31
+ <ref name="condition"/>
32
+ </oneOrMore>
33
+ <ref name="match"/>
34
+ <zeroOrMore>
35
+ <ref name="rendering-element"/>
36
+ </zeroOrMore>
37
+ </element>
38
+ </define>
39
+ <define name="choose.else">
40
+ <element name="cs:else">
41
+ <oneOrMore>
42
+ <ref name="rendering-element"/>
43
+ </oneOrMore>
44
+ </element>
45
+ </define>
46
+ <define name="condition">
47
+ <choice>
48
+ <attribute name="disambiguate" a:defaultValue="true">
49
+ <a:documentation>If used, the element content is only rendered if it disambiguates two
50
+ otherwise identical citations. This attempt at disambiguation is only
51
+ made after all other disambiguation methods have failed.</a:documentation>
52
+ <value>true</value>
53
+ </attribute>
54
+ <attribute name="is-numeric">
55
+ <a:documentation>Tests whether the given variables contain numeric text.</a:documentation>
56
+ <list>
57
+ <oneOrMore>
58
+ <ref name="variables"/>
59
+ </oneOrMore>
60
+ </list>
61
+ </attribute>
62
+ <attribute name="is-uncertain-date">
63
+ <a:documentation>Tests whether the given date variables contain approximate dates.</a:documentation>
64
+ <list>
65
+ <oneOrMore>
66
+ <ref name="variables.dates"/>
67
+ </oneOrMore>
68
+ </list>
69
+ </attribute>
70
+ <attribute name="locator">
71
+ <a:documentation>Tests whether the locator matches the given locator types.</a:documentation>
72
+ <list>
73
+ <oneOrMore>
74
+ <ref name="terms.locator"/>
75
+ </oneOrMore>
76
+ </list>
77
+ </attribute>
78
+ <attribute name="position">
79
+ <a:documentation>Tests whether the cite position matches the given positions.</a:documentation>
80
+ <list>
81
+ <oneOrMore>
82
+ <choice>
83
+ <value>first</value>
84
+ <value>subsequent</value>
85
+ <value>ibid</value>
86
+ <value>ibid-with-locator</value>
87
+ <value>near-note</value>
88
+ </choice>
89
+ </oneOrMore>
90
+ </list>
91
+ </attribute>
92
+ <attribute name="type">
93
+ <a:documentation>Tests whether the item matches the given types.</a:documentation>
94
+ <list>
95
+ <oneOrMore>
96
+ <ref name="item-types"/>
97
+ </oneOrMore>
98
+ </list>
99
+ </attribute>
100
+ <attribute name="variable">
101
+ <a:documentation>Tests whether the default ("long") forms of the given variables
102
+ contain non-empty values.</a:documentation>
103
+ <list>
104
+ <oneOrMore>
105
+ <ref name="variables"/>
106
+ </oneOrMore>
107
+ </list>
108
+ </attribute>
109
+ </choice>
110
+ </define>
111
+ <define name="match">
112
+ <optional>
113
+ <attribute name="match" a:defaultValue="all">
114
+ <a:documentation>Set the testing logic.</a:documentation>
115
+ <choice>
116
+ <value>all</value>
117
+ <a:documentation>Element only tests "true" when all conditions test "true" for all
118
+ given test values.</a:documentation>
119
+ <value>any</value>
120
+ <a:documentation>Element tests "true" when any condition tests "true" for any given
121
+ test value.</a:documentation>
122
+ <value>none</value>
123
+ <a:documentation>Element only tests "true" when none of the conditions test "true"
124
+ for any given test value.</a:documentation>
125
+ </choice>
126
+ </attribute>
127
+ </optional>
128
+ </define>
129
+ </div>
130
+ </grammar>
@@ -7,6 +7,7 @@
7
7
  <ref name="terms.gender-assignable"/>
8
8
  <ref name="terms.gender-variants"/>
9
9
  <ref name="terms.locator"/>
10
+ <ref name="item-types"/>
10
11
  <ref name="variables.names">
11
12
  <a:documentation>Contributor roles</a:documentation>
12
13
  </ref>
@@ -14,45 +15,72 @@
14
15
  <value>accessed</value>
15
16
  <a:documentation>Miscellaneous terms</a:documentation>
16
17
  <value>ad</value>
18
+ <value>advance-online-publication</value>
19
+ <value>album</value>
17
20
  <value>and</value>
18
21
  <value>and others</value>
19
22
  <value>anonymous</value>
20
23
  <value>at</value>
24
+ <value>audio-recording</value>
21
25
  <value>available at</value>
22
26
  <value>bc</value>
27
+ <value>bce</value>
23
28
  <value>by</value>
29
+ <value>ce</value>
24
30
  <value>circa</value>
25
31
  <value>cited</value>
26
32
  <value>et-al</value>
33
+ <value>film</value>
27
34
  <value>forthcoming</value>
28
35
  <value>from</value>
36
+ <value>henceforth</value>
29
37
  <value>ibid</value>
30
38
  <value>in</value>
31
39
  <value>in press</value>
32
40
  <value>internet</value>
33
41
  <value>interview</value>
34
42
  <value>letter</value>
43
+ <value>loc-cit</value>
35
44
  <value>no date</value>
45
+ <value>no-place</value>
46
+ <value>no-publisher</value>
47
+ <value>on</value>
36
48
  <value>online</value>
49
+ <value>op-cit</value>
50
+ <value>original-work-published</value>
51
+ <value>personal-communication</value>
52
+ <value>podcast</value>
53
+ <value>podcast-episode</value>
54
+ <value>preprint</value>
37
55
  <value>presented at</value>
56
+ <value>radio-broadcast</value>
57
+ <value>radio-series</value>
58
+ <value>radio-series-episode</value>
38
59
  <value>reference</value>
39
60
  <value>retrieved</value>
61
+ <value>review-of</value>
40
62
  <value>scale</value>
41
- <value>version</value>
63
+ <value>special-issue</value>
64
+ <value>special-section</value>
65
+ <value>television-broadcast</value>
66
+ <value>television-series</value>
67
+ <value>television-series-episode</value>
68
+ <value>video</value>
69
+ <value>working-paper</value>
42
70
  <value>open-quote</value>
43
71
  <a:documentation>Punctuation</a:documentation>
44
72
  <value>close-quote</value>
45
73
  <value>open-inner-quote</value>
46
74
  <value>close-inner-quote</value>
47
75
  <value>page-range-delimiter</value>
76
+ <value>colon</value>
77
+ <value>comma</value>
78
+ <value>semicolon</value>
48
79
  <value>season-01</value>
49
80
  <a:documentation>Seasons</a:documentation>
50
81
  <value>season-02</value>
51
82
  <value>season-03</value>
52
83
  <value>season-04</value>
53
- <ref name="category.field">
54
- <a:documentation>(legacy; remove in CSL 1.1)</a:documentation>
55
- </ref>
56
84
  </choice>
57
85
  </define>
58
86
  <define name="terms.gender-assignable">
@@ -106,28 +134,27 @@
106
134
  <define name="terms.locator">
107
135
  <a:documentation>Locators</a:documentation>
108
136
  <choice>
109
- <ref name="terms.locator.testable"/>
110
- <value>sub verbo</value>
111
- <a:documentation>"sub verbo" is recognized as "sub" &amp; "verbo" in attribute lists; term
112
- should be renamed to "sub-verbo"</a:documentation>
113
- </choice>
114
- </define>
115
- <define name="terms.locator.testable">
116
- <a:documentation>Locator terms that can be tested with the "locator" conditional
117
- ("sub verbo" can be tested with "sub-verbo")</a:documentation>
118
- <choice>
137
+ <value>act</value>
138
+ <value>appendix</value>
139
+ <value>article-locator</value>
119
140
  <value>book</value>
141
+ <value>canon</value>
120
142
  <value>chapter</value>
121
143
  <value>column</value>
144
+ <value>elocation</value>
145
+ <value>equation</value>
122
146
  <value>figure</value>
123
147
  <value>folio</value>
124
148
  <value>line</value>
125
149
  <value>note</value>
126
150
  <value>opus</value>
127
- <value>page</value>
128
151
  <value>paragraph</value>
129
- <value>part</value>
130
- <value>section</value>
152
+ <value>rule</value>
153
+ <value>scene</value>
154
+ <value>sub-verbo</value>
155
+ <value>table</value>
156
+ <value>timestamp</value>
157
+ <value>title-locator</value>
131
158
  <value>verse</value>
132
159
  <ref name="terms.locator-number-variables"/>
133
160
  </choice>
@@ -136,6 +163,11 @@ should be renamed to "sub-verbo"</a:documentation>
136
163
  <a:documentation>Locator terms with matching number variables</a:documentation>
137
164
  <choice>
138
165
  <value>issue</value>
166
+ <value>page</value>
167
+ <value>part</value>
168
+ <value>section</value>
169
+ <value>supplement</value>
170
+ <value>version</value>
139
171
  <value>volume</value>
140
172
  </choice>
141
173
  </define>
@@ -143,11 +175,15 @@ should be renamed to "sub-verbo"</a:documentation>
143
175
  <a:documentation>Non-locator terms accompanying number variables</a:documentation>
144
176
  <choice>
145
177
  <value>chapter-number</value>
178
+ <value>citation-number</value>
146
179
  <value>collection-number</value>
147
180
  <value>edition</value>
181
+ <value>first-reference-note-number</value>
148
182
  <value>number</value>
149
183
  <value>number-of-pages</value>
150
184
  <value>number-of-volumes</value>
185
+ <value>page-first</value>
186
+ <value>printing</value>
151
187
  </choice>
152
188
  </define>
153
189
  </div>
@@ -12,12 +12,17 @@
12
12
  <value>book</value>
13
13
  <value>broadcast</value>
14
14
  <value>chapter</value>
15
+ <value>classic</value>
16
+ <value>collection</value>
15
17
  <value>dataset</value>
18
+ <value>document</value>
16
19
  <value>entry</value>
17
20
  <value>entry-dictionary</value>
18
21
  <value>entry-encyclopedia</value>
22
+ <value>event</value>
19
23
  <value>figure</value>
20
24
  <value>graphic</value>
25
+ <value>hearing</value>
21
26
  <value>interview</value>
22
27
  <value>legal_case</value>
23
28
  <value>legislation</value>
@@ -28,14 +33,19 @@
28
33
  <value>pamphlet</value>
29
34
  <value>paper-conference</value>
30
35
  <value>patent</value>
36
+ <value>performance</value>
37
+ <value>periodical</value>
31
38
  <value>personal_communication</value>
32
39
  <value>post</value>
33
40
  <value>post-weblog</value>
41
+ <value>regulation</value>
34
42
  <value>report</value>
35
43
  <value>review</value>
36
44
  <value>review-book</value>
45
+ <value>software</value>
37
46
  <value>song</value>
38
47
  <value>speech</value>
48
+ <value>standard</value>
39
49
  <value>thesis</value>
40
50
  <value>treaty</value>
41
51
  <value>webpage</value>