asciidoctor-bibliography 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +23 -4
  3. data/asciidoctor-bibliography.gemspec +8 -8
  4. data/lib/asciidoctor-bibliography.rb +6 -0
  5. data/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb +35 -23
  6. data/lib/asciidoctor-bibliography/bibliographer.rb +0 -15
  7. data/lib/asciidoctor-bibliography/citation.rb +29 -22
  8. data/lib/asciidoctor-bibliography/databases/bibtex.rb +4 -1
  9. data/lib/asciidoctor-bibliography/formatter.rb +28 -0
  10. data/lib/asciidoctor-bibliography/index.rb +24 -16
  11. data/lib/asciidoctor-bibliography/options.rb +65 -32
  12. data/lib/asciidoctor-bibliography/version.rb +1 -1
  13. data/lib/citeproc/ruby/formats/adoc.rb +36 -0
  14. data/lib/csl/styles/tex-citealp-authoryear.csl +117 -0
  15. data/lib/csl/styles/tex-citealp-numeric.csl +116 -0
  16. data/lib/csl/styles/tex-citealps-authoryear.csl +117 -0
  17. data/lib/csl/styles/tex-citealps-numeric.csl +116 -0
  18. data/lib/csl/styles/tex-citealt-authoryear.csl +119 -0
  19. data/lib/csl/styles/tex-citealt-numeric.csl +119 -0
  20. data/lib/csl/styles/tex-citealts-authoryear.csl +119 -0
  21. data/lib/csl/styles/tex-citealts-numeric.csl +119 -0
  22. data/lib/csl/styles/tex-citeauthor-authoryear.csl +116 -0
  23. data/lib/csl/styles/tex-citeauthor-numeric.csl +116 -0
  24. data/lib/csl/styles/tex-citeauthors-authoryear.csl +116 -0
  25. data/lib/csl/styles/tex-citeauthors-numeric.csl +116 -0
  26. data/lib/csl/styles/tex-citep-authoryear.csl +117 -0
  27. data/lib/csl/styles/tex-citep-numeric.csl +116 -0
  28. data/lib/csl/styles/tex-citeps-authoryear.csl +117 -0
  29. data/lib/csl/styles/tex-citeps-numeric.csl +116 -0
  30. data/lib/csl/styles/tex-citet-authoryear.csl +119 -0
  31. data/lib/csl/styles/tex-citet-numeric.csl +119 -0
  32. data/lib/csl/styles/tex-citets-authoryear.csl +119 -0
  33. data/lib/csl/styles/tex-citets-numeric.csl +119 -0
  34. data/lib/csl/styles/tex-citeyear-authoryear.csl +116 -0
  35. data/lib/csl/styles/tex-citeyear-numeric.csl +116 -0
  36. data/lib/csl/styles/tex-citeyearpar-authoryear.csl +116 -0
  37. data/lib/csl/styles/tex-citeyearpar-numeric.csl +116 -0
  38. data/samples/tex/sample-numbers.adoc +1 -1
  39. data/samples/tex/sample-sort.adoc +1 -1
  40. data/spec/citation_helper.rb +46 -0
  41. data/spec/citation_item_spec.rb +0 -2
  42. data/spec/csl/styles/tex_citealp_authoryear_spec.rb +42 -0
  43. data/spec/csl/styles/tex_citealp_numeric_spec.rb +42 -0
  44. data/spec/csl/styles/tex_citealps_authoryear_spec.rb +42 -0
  45. data/spec/csl/styles/tex_citealps_numeric_spec.rb +42 -0
  46. data/spec/csl/styles/tex_citealt_authoryear_spec.rb +42 -0
  47. data/spec/csl/styles/tex_citealt_numeric_spec.rb +42 -0
  48. data/spec/csl/styles/tex_citealts_authoryear_spec.rb +42 -0
  49. data/spec/csl/styles/tex_citealts_numeric_spec.rb +42 -0
  50. data/spec/csl/styles/tex_citeauthor_authoryear_spec.rb +42 -0
  51. data/spec/csl/styles/tex_citeauthor_numeric_spec.rb +42 -0
  52. data/spec/csl/styles/tex_citeauthors_authoryear_spec.rb +42 -0
  53. data/spec/csl/styles/tex_citeauthors_numeric_spec.rb +42 -0
  54. data/spec/csl/styles/tex_citep_authoryear_spec.rb +42 -0
  55. data/spec/csl/styles/tex_citep_numeric_spec.rb +42 -0
  56. data/spec/csl/styles/tex_citeps_authoryear_spec.rb +42 -0
  57. data/spec/csl/styles/tex_citeps_numeric_spec.rb +42 -0
  58. data/spec/csl/styles/tex_citet_authoryear_spec.rb +42 -0
  59. data/spec/csl/styles/tex_citet_numeric_spec.rb +42 -0
  60. data/spec/csl/styles/tex_citets_authoryear_spec.rb +42 -0
  61. data/spec/csl/styles/tex_citets_numeric_spec.rb +42 -0
  62. data/spec/csl/styles/tex_citeyear_authoryear_spec.rb +42 -0
  63. data/spec/csl/styles/tex_citeyear_numeric_spec.rb +42 -0
  64. data/spec/csl/styles/tex_citeyearpar_authoryear_spec.rb +42 -0
  65. data/spec/csl/styles/tex_citeyearpar_numeric_spec.rb +42 -0
  66. data/spec/database_spec.rb +20 -1
  67. data/spec/macros_spec.rb +21 -0
  68. data/spec/options_spec.rb +105 -1
  69. metadata +72 -24
  70. data/lib/asciidoctor-bibliography/formatters/csl.rb +0 -28
  71. data/lib/asciidoctor-bibliography/formatters/tex.rb +0 -187
  72. data/lib/asciidoctor-bibliography/helpers.rb +0 -41
  73. data/spec/helpers_spec.rb +0 -73
@@ -8,6 +8,7 @@ module AsciidoctorBibliography
8
8
 
9
9
  DEFAULTS = {
10
10
  "bibliography-database" => nil,
11
+ "bibliography-locale" => "en-US",
11
12
  "bibliography-style" => "apa",
12
13
  "bibliography-hyperlinks" => "true",
13
14
  "bibliography-order" => "alphabetical", # TODO: deprecate
@@ -19,16 +20,47 @@ module AsciidoctorBibliography
19
20
  merge DEFAULTS
20
21
  end
21
22
 
23
+ def self.new_from_reader(reader)
24
+ header_attributes = get_header_attributes_hash reader
25
+ header_attributes.select! { |key, _| DEFAULTS.keys.include? key }
26
+ new.merge header_attributes
27
+ end
28
+
29
+ def self.get_header_attributes_hash(reader)
30
+ # We peek at the document attributes we need, without perturbing the parsing flow.
31
+ # NOTE: we'll use this in a preprocessor and they haven't been parsed yet, there.
32
+ tmp_document = ::Asciidoctor::Document.new
33
+ tmp_reader = ::Asciidoctor::PreprocessorReader.new(tmp_document, reader.source_lines)
34
+
35
+ ::Asciidoctor::Parser.
36
+ parse(tmp_reader, tmp_document, header_only: true).
37
+ attributes
38
+ end
39
+
22
40
  def style
23
41
  # Error throwing delegated to CSL library. Seems to have nice messages.
24
42
  self["bibliography-style"] || DEFAULTS["bibliography-style"]
25
43
  end
26
44
 
45
+ def locale
46
+ value = self["bibliography-locale"] || DEFAULTS["bibliography-locale"]
47
+ unless CSL::Locale.list.include? value
48
+ raise Errors::Options::Invalid, <<~MESSAGE
49
+ Option :bibliography-locale: has an invalid value (#{value}).
50
+ Allowed values are #{CSL::Locale.list.inspect}.
51
+ MESSAGE
52
+ end
53
+
54
+ value
55
+ end
56
+
27
57
  def hyperlinks?
28
58
  value = self["bibliography-hyperlinks"] || DEFAULTS["bibliography-hyperlinks"]
29
59
  unless %w[true false].include? value
30
- message = "Option :bibliography-hyperlinks: has an invalid value (#{value}). Allowed values are 'true' and 'false'."
31
- raise Errors::Options::Invalid, message
60
+ raise Errors::Options::Invalid, <<~MESSAGE
61
+ Option :bibliography-hyperlinks: has an invalid value (#{value}).
62
+ Allowed values are 'true' and 'false'.
63
+ MESSAGE
32
64
  end
33
65
 
34
66
  value == "true"
@@ -37,8 +69,10 @@ module AsciidoctorBibliography
37
69
  def database
38
70
  value = self["bibliography-database"] || DEFAULTS["bibliography-database"]
39
71
  if value.nil?
40
- message = "Option :bibliography-database: is mandatory. A bibliographic database is required."
41
- raise Errors::Options::Missing, message
72
+ raise Errors::Options::Missing, <<~MESSAGE
73
+ Option :bibliography-database: is mandatory.
74
+ A bibliographic database is required.
75
+ MESSAGE
42
76
  end
43
77
 
44
78
  value
@@ -48,50 +82,49 @@ module AsciidoctorBibliography
48
82
  begin
49
83
  value = YAML.safe_load self["bibliography-sort"].to_s
50
84
  rescue Psych::SyntaxError => psych_error
51
- message = "Option :bibliography-sort: is not a valid YAML string: \"#{psych_error}\"."
52
- raise Errors::Options::Invalid, message
85
+ raise Errors::Options::Invalid, <<~MESSAGE
86
+ Option :bibliography-sort: is not a valid YAML string: \"#{psych_error}\".
87
+ MESSAGE
53
88
  end
54
89
 
55
- value = self.class.validate_parsed_sort_type! value
56
- value = self.class.validate_parsed_sort_contents! value unless value.nil?
90
+ value = validate_parsed_sort_type! value
91
+ value = validate_parsed_sort_contents! value unless value.nil?
57
92
  value
58
93
  end
59
94
 
60
95
  def tex_style
61
- self["bibliography-tex-style"] || DEFAULTS["bibliography-tex-style"]
96
+ value = self["bibliography-tex-style"] || DEFAULTS["bibliography-tex-style"]
97
+ unless %w[authoryear numeric].include? value
98
+ raise Errors::Options::Invalid, <<~MESSAGE
99
+ Option :bibliography-tex-style: has an invalid value (#{value}).
100
+ Allowed values are 'authoryear' (default) and 'numeric'.
101
+ MESSAGE
102
+ end
103
+
104
+ value
62
105
  end
63
106
 
64
- def self.validate_parsed_sort_type!(value)
107
+ private
108
+
109
+ def validate_parsed_sort_type!(value)
65
110
  return value if value.nil?
66
111
  return value if value.is_a?(Array) && value.all? { |v| v.is_a? Hash }
67
112
  return [value] if value.is_a? Hash
68
- message = "Option :bibliography-sort: has an invalid value (#{value}). Please refer to manual for more info."
69
- raise Errors::Options::Invalid, message
113
+ raise Errors::Options::Invalid, <<~MESSAGE
114
+ Option :bibliography-sort: has an invalid value (#{value}).
115
+ Please refer to manual for more info.
116
+ MESSAGE
70
117
  end
71
118
 
72
- def self.validate_parsed_sort_contents!(array)
119
+ def validate_parsed_sort_contents!(array)
73
120
  # TODO: should we restrict these? Double check the CSL spec.
74
121
  allowed_keys = %w[variable macro sort names-min names-use-first names-use-last]
75
122
  return array unless array.any? { |hash| (hash.keys - allowed_keys).any? }
76
- message = "Option :bibliography-sort: has a value containing invalid keys (#{array}). Allowed keys are #{allowed_keys.inspect}. Please refer to manual for more info."
77
- raise Errors::Options::Invalid, message
78
- end
79
-
80
- def self.new_from_reader(reader)
81
- header_attributes = get_header_attributes_hash reader
82
- header_attributes.select! { |key, _| DEFAULTS.keys.include? key }
83
- new.merge header_attributes
84
- end
85
-
86
- def self.get_header_attributes_hash(reader)
87
- # We peek at the document attributes we need, without perturbing the parsing flow.
88
- # NOTE: we'll use this in a preprocessor and they haven't been parsed yet, there.
89
- tmp_document = ::Asciidoctor::Document.new
90
- tmp_reader = ::Asciidoctor::PreprocessorReader.new(tmp_document, reader.source_lines)
91
-
92
- ::Asciidoctor::Parser.
93
- parse(tmp_reader, tmp_document, header_only: true).
94
- attributes
123
+ raise Errors::Options::Invalid, <<~MESSAGE
124
+ Option :bibliography-sort: has a value containing invalid keys (#{array}).
125
+ Allowed keys are #{allowed_keys.inspect}.
126
+ Please refer to manual for more info.
127
+ MESSAGE
95
128
  end
96
129
  end
97
130
  end
@@ -1,3 +1,3 @@
1
1
  module AsciidoctorBibliography
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
@@ -0,0 +1,36 @@
1
+ require "citeproc/ruby/format"
2
+
3
+ module CiteProc
4
+ module Ruby
5
+ module Formats
6
+ class Adoc < Format
7
+ # TODO
8
+ # def bibliography(bibliography)
9
+ # end
10
+
11
+ def apply_font_style
12
+ output.replace "_#{output}_" if options[:'font-style'] == "italic"
13
+ end
14
+
15
+ # TODO
16
+ # def apply_font_variant
17
+ # output.replace "*#{output}*" if options[:'font-variant'] == 'small-caps'
18
+ # end
19
+
20
+ def apply_font_weight
21
+ output.replace "*#{output}*" if options[:'font-weight'] == "bold"
22
+ end
23
+
24
+ # TODO
25
+ # def apply_text_decoration
26
+ # output.replace "*#{output}*" if options[:'text-decoration'] == 'underline'
27
+ # end
28
+
29
+ def apply_vertical_align
30
+ output.replace "^#{output}^" if options[:vertical_align] == "sup"
31
+ output.replace "~#{output}~" if options[:vertical_align] == "sub"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
3
+ <info>
4
+ <title>TeX style for macro citealp with authoryear style</title>
5
+ <id>tex-citealp-authoryear</id>
6
+ </info>
7
+ <macro name="author-long">
8
+ <names variable="author">
9
+ <name form="short" and="text" initialize="false" sort-separator=""/>
10
+ </names>
11
+ </macro>
12
+ <macro name="author-short">
13
+ <names variable="author">
14
+ <name form="short" and="text" et-al-min="2" et-al-use-first="1" et-al-subsequent-min="2" et-al-subsequent-use-first="1"/>
15
+ </names>
16
+ </macro>
17
+ <macro name="locators">
18
+ <choose>
19
+ <if type="article-journal article-magazine" match="any">
20
+ <group prefix=", " delimiter=", ">
21
+ <group>
22
+ <text variable="volume" font-style="italic"/>
23
+ <text variable="issue" prefix="(" suffix=")"/>
24
+ </group>
25
+ <text variable="page"/>
26
+ </group>
27
+ <choose>
28
+ <if variable="issued">
29
+ <choose>
30
+ <if variable="page issue" match="none">
31
+ <text variable="status" prefix=". "/>
32
+ </if>
33
+ </choose>
34
+ </if>
35
+ </choose>
36
+ </if>
37
+ <else-if type="article-newspaper">
38
+ <group delimiter=" " prefix=", ">
39
+ <label variable="page" form="short"/>
40
+ <text variable="page"/>
41
+ </group>
42
+ </else-if>
43
+ <else-if type="book graphic motion_picture report song chapter paper-conference entry-encyclopedia entry-dictionary" match="any">
44
+ <group prefix=" (" suffix=")" delimiter=", ">
45
+ <choose>
46
+ <if type="report" match="none">
47
+ <text macro="edition"/>
48
+ </if>
49
+ </choose>
50
+ <choose>
51
+ <if variable="volume" match="any">
52
+ <group>
53
+ <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
54
+ <number variable="volume" form="numeric"/>
55
+ </group>
56
+ </if>
57
+ <else>
58
+ <group>
59
+ <text term="volume" form="short" plural="true" text-case="capitalize-first" suffix=" "/>
60
+ <number variable="number-of-volumes" form="numeric" prefix="1–"/>
61
+ </group>
62
+ </else>
63
+ </choose>
64
+ <group>
65
+ <label variable="page" form="short" suffix=" "/>
66
+ <text variable="page"/>
67
+ </group>
68
+ </group>
69
+ </else-if>
70
+ <else-if type="legal_case">
71
+ <group prefix=" (" suffix=")" delimiter=" ">
72
+ <text variable="authority"/>
73
+ <choose>
74
+ <if variable="container-title" match="any">
75
+ <date variable="issued" form="numeric" date-parts="year"/>
76
+ </if>
77
+ <else>
78
+ <date variable="issued" form="text"/>
79
+ </else>
80
+ </choose>
81
+ </group>
82
+ </else-if>
83
+ <else-if type="bill legislation" match="any">
84
+ <date variable="issued" prefix=" (" suffix=")">
85
+ <date-part name="year"/>
86
+ </date>
87
+ </else-if>
88
+ </choose>
89
+ </macro>
90
+ <macro name="citation-locator">
91
+ <group>
92
+ <choose>
93
+ <if locator="chapter">
94
+ <label variable="locator" form="long" text-case="capitalize-first"/>
95
+ </if>
96
+ <else>
97
+ <label variable="locator" form="short"/>
98
+ </else>
99
+ </choose>
100
+ <text variable="locator" prefix=" "/>
101
+ </group>
102
+ </macro>
103
+ <citation>
104
+ <layout delimiter="; ">
105
+ <group>
106
+ <text variable="prefix" suffix=" "/>
107
+ <group delimiter=", ">
108
+ <text macro="author-short"/>
109
+ <date date-parts="year" form="numeric" variable="issued"/>
110
+ <text macro="citation-locator"/>
111
+ </group>
112
+ <text variable="suffix" prefix=", "/>
113
+ </group>
114
+ </layout>
115
+ </citation>
116
+ <bibliography/>
117
+ </style>
@@ -0,0 +1,116 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
3
+ <info>
4
+ <title>TeX style for macro citealp with numeric style</title>
5
+ <id>tex-citealp-numeric</id>
6
+ </info>
7
+ <macro name="author-long">
8
+ <names variable="author">
9
+ <name form="short" and="text" initialize="false" sort-separator=""/>
10
+ </names>
11
+ </macro>
12
+ <macro name="author-short">
13
+ <names variable="author">
14
+ <name form="short" and="text" et-al-min="2" et-al-use-first="1" et-al-subsequent-min="2" et-al-subsequent-use-first="1"/>
15
+ </names>
16
+ </macro>
17
+ <macro name="locators">
18
+ <choose>
19
+ <if type="article-journal article-magazine" match="any">
20
+ <group prefix=", " delimiter=", ">
21
+ <group>
22
+ <text variable="volume" font-style="italic"/>
23
+ <text variable="issue" prefix="(" suffix=")"/>
24
+ </group>
25
+ <text variable="page"/>
26
+ </group>
27
+ <choose>
28
+ <if variable="issued">
29
+ <choose>
30
+ <if variable="page issue" match="none">
31
+ <text variable="status" prefix=". "/>
32
+ </if>
33
+ </choose>
34
+ </if>
35
+ </choose>
36
+ </if>
37
+ <else-if type="article-newspaper">
38
+ <group delimiter=" " prefix=", ">
39
+ <label variable="page" form="short"/>
40
+ <text variable="page"/>
41
+ </group>
42
+ </else-if>
43
+ <else-if type="book graphic motion_picture report song chapter paper-conference entry-encyclopedia entry-dictionary" match="any">
44
+ <group prefix=" (" suffix=")" delimiter=", ">
45
+ <choose>
46
+ <if type="report" match="none">
47
+ <text macro="edition"/>
48
+ </if>
49
+ </choose>
50
+ <choose>
51
+ <if variable="volume" match="any">
52
+ <group>
53
+ <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
54
+ <number variable="volume" form="numeric"/>
55
+ </group>
56
+ </if>
57
+ <else>
58
+ <group>
59
+ <text term="volume" form="short" plural="true" text-case="capitalize-first" suffix=" "/>
60
+ <number variable="number-of-volumes" form="numeric" prefix="1–"/>
61
+ </group>
62
+ </else>
63
+ </choose>
64
+ <group>
65
+ <label variable="page" form="short" suffix=" "/>
66
+ <text variable="page"/>
67
+ </group>
68
+ </group>
69
+ </else-if>
70
+ <else-if type="legal_case">
71
+ <group prefix=" (" suffix=")" delimiter=" ">
72
+ <text variable="authority"/>
73
+ <choose>
74
+ <if variable="container-title" match="any">
75
+ <date variable="issued" form="numeric" date-parts="year"/>
76
+ </if>
77
+ <else>
78
+ <date variable="issued" form="text"/>
79
+ </else>
80
+ </choose>
81
+ </group>
82
+ </else-if>
83
+ <else-if type="bill legislation" match="any">
84
+ <date variable="issued" prefix=" (" suffix=")">
85
+ <date-part name="year"/>
86
+ </date>
87
+ </else-if>
88
+ </choose>
89
+ </macro>
90
+ <macro name="citation-locator">
91
+ <group>
92
+ <choose>
93
+ <if locator="chapter">
94
+ <label variable="locator" form="long" text-case="capitalize-first"/>
95
+ </if>
96
+ <else>
97
+ <label variable="locator" form="short"/>
98
+ </else>
99
+ </choose>
100
+ <text variable="locator" prefix=" "/>
101
+ </group>
102
+ </macro>
103
+ <citation>
104
+ <layout delimiter=", ">
105
+ <group>
106
+ <text variable="prefix" suffix=" "/>
107
+ <group delimiter=", ">
108
+ <text variable="citation-number"/>
109
+ <text macro="citation-locator"/>
110
+ </group>
111
+ <text variable="suffix" prefix=", "/>
112
+ </group>
113
+ </layout>
114
+ </citation>
115
+ <bibliography/>
116
+ </style>
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
3
+ <info>
4
+ <title>TeX style for macro citealp* with authoryear style</title>
5
+ <id>tex-citealps-authoryear</id>
6
+ </info>
7
+ <macro name="author-long">
8
+ <names variable="author">
9
+ <name form="short" and="text" initialize="false" sort-separator=""/>
10
+ </names>
11
+ </macro>
12
+ <macro name="author-short">
13
+ <names variable="author">
14
+ <name form="short" and="text" et-al-min="2" et-al-use-first="1" et-al-subsequent-min="2" et-al-subsequent-use-first="1"/>
15
+ </names>
16
+ </macro>
17
+ <macro name="locators">
18
+ <choose>
19
+ <if type="article-journal article-magazine" match="any">
20
+ <group prefix=", " delimiter=", ">
21
+ <group>
22
+ <text variable="volume" font-style="italic"/>
23
+ <text variable="issue" prefix="(" suffix=")"/>
24
+ </group>
25
+ <text variable="page"/>
26
+ </group>
27
+ <choose>
28
+ <if variable="issued">
29
+ <choose>
30
+ <if variable="page issue" match="none">
31
+ <text variable="status" prefix=". "/>
32
+ </if>
33
+ </choose>
34
+ </if>
35
+ </choose>
36
+ </if>
37
+ <else-if type="article-newspaper">
38
+ <group delimiter=" " prefix=", ">
39
+ <label variable="page" form="short"/>
40
+ <text variable="page"/>
41
+ </group>
42
+ </else-if>
43
+ <else-if type="book graphic motion_picture report song chapter paper-conference entry-encyclopedia entry-dictionary" match="any">
44
+ <group prefix=" (" suffix=")" delimiter=", ">
45
+ <choose>
46
+ <if type="report" match="none">
47
+ <text macro="edition"/>
48
+ </if>
49
+ </choose>
50
+ <choose>
51
+ <if variable="volume" match="any">
52
+ <group>
53
+ <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
54
+ <number variable="volume" form="numeric"/>
55
+ </group>
56
+ </if>
57
+ <else>
58
+ <group>
59
+ <text term="volume" form="short" plural="true" text-case="capitalize-first" suffix=" "/>
60
+ <number variable="number-of-volumes" form="numeric" prefix="1–"/>
61
+ </group>
62
+ </else>
63
+ </choose>
64
+ <group>
65
+ <label variable="page" form="short" suffix=" "/>
66
+ <text variable="page"/>
67
+ </group>
68
+ </group>
69
+ </else-if>
70
+ <else-if type="legal_case">
71
+ <group prefix=" (" suffix=")" delimiter=" ">
72
+ <text variable="authority"/>
73
+ <choose>
74
+ <if variable="container-title" match="any">
75
+ <date variable="issued" form="numeric" date-parts="year"/>
76
+ </if>
77
+ <else>
78
+ <date variable="issued" form="text"/>
79
+ </else>
80
+ </choose>
81
+ </group>
82
+ </else-if>
83
+ <else-if type="bill legislation" match="any">
84
+ <date variable="issued" prefix=" (" suffix=")">
85
+ <date-part name="year"/>
86
+ </date>
87
+ </else-if>
88
+ </choose>
89
+ </macro>
90
+ <macro name="citation-locator">
91
+ <group>
92
+ <choose>
93
+ <if locator="chapter">
94
+ <label variable="locator" form="long" text-case="capitalize-first"/>
95
+ </if>
96
+ <else>
97
+ <label variable="locator" form="short"/>
98
+ </else>
99
+ </choose>
100
+ <text variable="locator" prefix=" "/>
101
+ </group>
102
+ </macro>
103
+ <citation>
104
+ <layout delimiter="; ">
105
+ <group>
106
+ <text variable="prefix" suffix=" "/>
107
+ <group delimiter=", ">
108
+ <text macro="author-long"/>
109
+ <date date-parts="year" form="numeric" variable="issued"/>
110
+ <text macro="citation-locator"/>
111
+ </group>
112
+ <text variable="suffix" prefix=", "/>
113
+ </group>
114
+ </layout>
115
+ </citation>
116
+ <bibliography/>
117
+ </style>