pubid-nist 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/nist/addendum.rb +21 -0
- data/lib/pubid/nist/edition.rb +26 -14
- data/lib/pubid/nist/identifier.rb +21 -18
- data/lib/pubid/nist/nist_tech_pubs.rb +7 -1
- data/lib/pubid/nist/parser.rb +21 -15
- data/lib/pubid/nist/parsers/{nbs_circ.rb → circ.rb} +2 -2
- data/lib/pubid/nist/parsers/{nbs_crpl.rb → crpl.rb} +3 -3
- data/lib/pubid/nist/parsers/{nbs_csm.rb → csm.rb} +2 -2
- data/lib/pubid/nist/parsers/default.rb +6 -5
- data/lib/pubid/nist/parsers/fips.rb +10 -3
- data/lib/pubid/nist/parsers/{nist_gcr.rb → gcr.rb} +1 -1
- data/lib/pubid/nist/parsers/{nbs_hb.rb → hb.rb} +2 -10
- data/lib/pubid/nist/parsers/{nbs_mp.rb → mp.rb} +1 -1
- data/lib/pubid/nist/parsers/{nist_ncstar.rb → ncstar.rb} +1 -1
- data/lib/pubid/nist/parsers/{nist_owmwp.rb → owmwp.rb} +1 -1
- data/lib/pubid/nist/parsers/{nbs_rpt.rb → rpt.rb} +1 -1
- data/lib/pubid/nist/parsers/{nist_sp.rb → sp.rb} +5 -3
- data/lib/pubid/nist/parsers/tn.rb +17 -0
- data/lib/pubid/nist/publisher.rb +1 -5
- data/lib/pubid/nist/renderer/addendum.rb +20 -0
- data/lib/pubid/nist/renderer/base.rb +202 -0
- data/lib/pubid/nist/series.rb +30 -0
- data/lib/pubid/nist/stage.rb +2 -2
- data/lib/pubid/nist/transformer.rb +10 -2
- data/lib/pubid/nist/update.rb +1 -1
- data/lib/pubid/nist/version.rb +1 -1
- data/lib/pubid/nist.rb +4 -2
- data/series.yaml +60 -82
- data/update_codes.yaml +4 -4
- metadata +19 -23
- data/lib/pubid/nist/parsers/nbs_bh.rb +0 -6
- data/lib/pubid/nist/parsers/nbs_fips.rb +0 -14
- data/lib/pubid/nist/parsers/nbs_mn.rb +0 -6
- data/lib/pubid/nist/parsers/nbs_sp.rb +0 -13
- data/lib/pubid/nist/parsers/nbs_tn.rb +0 -9
- data/lib/pubid/nist/parsers/nist_hb.rb +0 -9
- data/lib/pubid/nist/parsers/nist_tn.rb +0 -13
- data/lib/pubid/nist/renderer.rb +0 -213
- data/lib/pubid/nist/serie.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ac016ca575f6b9815da56cb9424c1ba9bce844f494822e8bf407d9bb51de4cd
|
4
|
+
data.tar.gz: 5fe93360f4980550e766cffc5b7c0ad6ae00124fa818cfd6ac4ba6b6eb2bf445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afdb479f21109aaf05b75d9ae2d0d783b347fe2cea4734e18ec01cabfe3129bba69cb36e444f9005d12bb153516097642147a3a464ee576f1b9866ce03030eaf
|
7
|
+
data.tar.gz: 9a41dd6a27fda08447e56b1c128971fec36057739fd48a802ac503af1078247addf9329fe4a9d9b2a839d3e827b39be60108f536f39633eb798152ef431cff8c
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
module Pubid::Nist
|
3
|
+
class Addendum < Identifier
|
4
|
+
def_delegators 'Pubid::Nist::Addendum', :type
|
5
|
+
|
6
|
+
attr_accessor :base
|
7
|
+
|
8
|
+
def initialize(base:, number: nil)
|
9
|
+
@number = number
|
10
|
+
@base = base
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.type
|
14
|
+
{ key: :add, title: "Addendum" }
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get_renderer_class
|
18
|
+
Renderer::Addendum
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/pubid/nist/edition.rb
CHANGED
@@ -1,26 +1,38 @@
|
|
1
1
|
module Pubid::Nist
|
2
|
-
class Edition
|
3
|
-
attr_accessor :year, :month, :day, :parsed, :
|
2
|
+
class Edition < Pubid::Core::Entity
|
3
|
+
attr_accessor :year, :month, :day, :parsed, :number
|
4
4
|
|
5
|
-
def initialize(parsed: nil, year: nil, month: nil, day: nil,
|
5
|
+
def initialize(parsed: nil, year: nil, month: nil, day: nil, number: nil)
|
6
6
|
@parsed = parsed
|
7
7
|
@year = year
|
8
8
|
@month = month
|
9
9
|
@day = day
|
10
|
-
@
|
10
|
+
@number = number
|
11
11
|
end
|
12
12
|
|
13
|
-
def to_s
|
14
|
-
result = (@sequence && [@sequence]) || []
|
15
|
-
if @day
|
16
|
-
result << Date.new(@year, @month, @day).strftime("%Y%m%d")
|
17
|
-
elsif @month
|
18
|
-
result << Date.new(@year, @month).strftime("%Y%m")
|
19
|
-
elsif @year
|
20
|
-
result << Date.new(@year).strftime("%Y")
|
21
|
-
end
|
13
|
+
def to_s(format: :short)
|
22
14
|
|
23
|
-
|
15
|
+
if format == :long
|
16
|
+
result = (@number && ["Edition #{@number}"]) || []
|
17
|
+
if @day
|
18
|
+
result << Date.new(@year, @month, @day).strftime("(%B %d, %Y)")
|
19
|
+
elsif @month
|
20
|
+
result << Date.new(@year, @month).strftime("(%B %Y)")
|
21
|
+
elsif @year
|
22
|
+
result << Date.new(@year).strftime("(%Y)")
|
23
|
+
end
|
24
|
+
result.join(" ")
|
25
|
+
else
|
26
|
+
result = (@number && [@number]) || []
|
27
|
+
if @day
|
28
|
+
result << Date.new(@year, @month, @day).strftime("%Y%m%d")
|
29
|
+
elsif @month
|
30
|
+
result << Date.new(@year, @month).strftime("%Y%m")
|
31
|
+
elsif @year
|
32
|
+
result << Date.new(@year).strftime("%Y")
|
33
|
+
end
|
34
|
+
result.join("-")
|
35
|
+
end
|
24
36
|
end
|
25
37
|
end
|
26
38
|
end
|
@@ -1,24 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "json"
|
4
|
+
require "forwardable"
|
4
5
|
|
5
6
|
UPDATE_CODES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../update_codes.yaml"))
|
6
7
|
|
7
8
|
module Pubid::Nist
|
8
9
|
class Identifier < Pubid::Core::Identifier::Base
|
9
|
-
|
10
|
+
extend Forwardable
|
11
|
+
attr_accessor :series, :code, :revision, :publisher, :version, :volume,
|
10
12
|
:part, :addendum, :stage, :translation,
|
11
13
|
:edition, :supplement, :update,
|
12
14
|
:section, :appendix, :errata, :index, :insert
|
13
15
|
|
14
|
-
def initialize(publisher: "NIST",
|
15
|
-
edition_month: nil, edition_year: nil, edition_day: nil, update: nil,
|
16
|
-
|
17
|
-
@
|
16
|
+
def initialize(publisher: "NIST", series:, number: nil, stage: nil, supplement: nil,
|
17
|
+
edition_month: nil, edition_year: nil, edition_day: nil, update: nil,
|
18
|
+
edition: nil, **opts)
|
19
|
+
@publisher = publisher.is_a?(Publisher) ? publisher : Publisher.new(publisher: publisher.to_s)
|
20
|
+
@series = series.is_a?(Series) ? series : Series.new(series: series)
|
18
21
|
@code = number
|
19
22
|
@stage = Stage.new(**stage) if stage
|
20
23
|
@supplement = (supplement.is_a?(Array) && "") || supplement
|
21
|
-
|
24
|
+
if edition_month || edition_year
|
25
|
+
@edition = parse_edition(edition_month, edition_year, edition_day)
|
26
|
+
elsif edition
|
27
|
+
@edition = Edition.new(number: edition)
|
28
|
+
end
|
22
29
|
@update = update
|
23
30
|
opts.each { |key, value| send("#{key}=", value.to_s) }
|
24
31
|
end
|
@@ -54,7 +61,7 @@ module Pubid::Nist
|
|
54
61
|
document.instance_variables.each do |var|
|
55
62
|
val = document.instance_variable_get(var)
|
56
63
|
current_val = instance_variable_get(var)
|
57
|
-
if [:@
|
64
|
+
if [:@series, :@publisher].include?(var) ||
|
58
65
|
(val && current_val.nil?) ||
|
59
66
|
(val && current_val.to_s.length < val.to_s.length)
|
60
67
|
instance_variable_set(var, val)
|
@@ -73,7 +80,7 @@ module Pubid::Nist
|
|
73
80
|
|
74
81
|
# @param without_edition [Boolean] render pubid without rendering edition
|
75
82
|
def to_s(format = :short, without_edition: false)
|
76
|
-
self.class.get_renderer_class.new(to_h).render(format: format, without_edition: without_edition)
|
83
|
+
self.class.get_renderer_class.new(to_h(deep: false)).render(format: format, without_edition: without_edition)
|
77
84
|
end
|
78
85
|
|
79
86
|
def to_json(*args)
|
@@ -98,11 +105,6 @@ module Pubid::Nist
|
|
98
105
|
new(**opts)
|
99
106
|
end
|
100
107
|
|
101
|
-
# def transform(params)
|
102
|
-
# identifier_params = get_transformer_class.new.apply(params)
|
103
|
-
#
|
104
|
-
# Identifier.create(**identifier_params)
|
105
|
-
# end
|
106
108
|
def transform(params)
|
107
109
|
# run transform through each element,
|
108
110
|
# like running transformer.apply(number: 1) and transformer.apply(year: 1999)
|
@@ -114,11 +116,12 @@ module Pubid::Nist
|
|
114
116
|
get_transformer_class.new.apply({ k => v }, params)
|
115
117
|
end.inject({}, :merge)
|
116
118
|
|
119
|
+
if identifier_params[:addendum]
|
120
|
+
return Addendum.new(base: new(
|
121
|
+
**identifier_params.dup.tap { |h| h.delete(:addendum) }
|
122
|
+
), **identifier_params[:addendum])
|
123
|
+
end
|
117
124
|
|
118
|
-
# identifier_params = params.map do |k, v|
|
119
|
-
# get_transformer_class.new.apply({k => v}, params).to_a.first
|
120
|
-
# end.compact.to_h
|
121
|
-
#
|
122
125
|
new(**identifier_params)
|
123
126
|
end
|
124
127
|
|
@@ -131,7 +134,7 @@ module Pubid::Nist
|
|
131
134
|
end
|
132
135
|
|
133
136
|
def get_renderer_class
|
134
|
-
Renderer
|
137
|
+
Renderer::Base
|
135
138
|
end
|
136
139
|
end
|
137
140
|
end
|
@@ -45,7 +45,13 @@ module Pubid::Nist
|
|
45
45
|
def parse_docid(doc)
|
46
46
|
id = doc.at("publisher_item/item_number", "publisher_item/identifier")
|
47
47
|
&.text&.sub(%r{^/}, "")
|
48
|
-
|
48
|
+
if id == "NBS BH 10"
|
49
|
+
# XXX: "doi" attribute is missing for doi_data
|
50
|
+
doi = "NBS.BH.10"
|
51
|
+
else
|
52
|
+
doi = doc.at("doi_data/doi").text.gsub("10.6028/", "")
|
53
|
+
end
|
54
|
+
|
49
55
|
title = doc.at("titles/title").text
|
50
56
|
title += " #{doc.at('titles/subtitle').text}" if doc.at("titles/subtitle")
|
51
57
|
case doi
|
data/lib/pubid/nist/parser.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
module Pubid::Nist
|
2
|
-
class Parser <
|
2
|
+
class Parser < Pubid::Core::Parser
|
3
3
|
attr_accessor :parsed
|
4
4
|
|
5
5
|
rule(:series) do
|
6
|
-
((SERIES["long"].keys
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
(acc.is_a?(String) ? str(acc) : acc) | str(s)
|
11
|
-
end).as(:series) |
|
12
|
-
(SERIES["mr"].values.reduce do |acc, s|
|
13
|
-
(acc.is_a?(String) ? str(acc) : acc) | str(s)
|
14
|
-
end).as(:series_mr)) >> any.repeat.as(:remaining)
|
6
|
+
(array_to_str(SERIES["long"].keys.sort_by(&:length).reverse.flatten).as(:series) |
|
7
|
+
array_to_str(SERIES["mr"].values).as(:series_mr) |
|
8
|
+
((str("NBS") | str("NIST")).as(:publisher) >> (space | dot) >> array_to_str(SERIES["long"].keys.sort_by(&:length).reverse.flatten).as(:series))) >>
|
9
|
+
any.repeat.as(:remaining)
|
15
10
|
end
|
16
11
|
|
17
12
|
root(:series)
|
@@ -23,13 +18,24 @@ module Pubid::Nist
|
|
23
18
|
else
|
24
19
|
SERIES["mr"].key(parsed[:series_mr].to_s)
|
25
20
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
publisher = parsed[:publisher]
|
22
|
+
parser = find_parser(publisher, series)
|
23
|
+
begin
|
24
|
+
parsed = parser.new.parse(parsed[:remaining].to_s)
|
25
|
+
rescue Parslet::ParseFailed
|
26
|
+
# for PubID 1.0 identifier series specific parser might fail,
|
27
|
+
# so parse using Default parser which is comply with PubID 1.0
|
28
|
+
parsed = Parsers::Default.new.parse(parsed[:remaining].to_s)
|
29
|
+
end
|
30
|
+
if publisher
|
31
|
+
parsed.is_a?(Array) ? parsed << { series: series, publisher: publisher } : parsed.merge({ series: series, publisher: publisher })
|
32
|
+
else
|
33
|
+
parsed.is_a?(Array) ? parsed << { series: series } : parsed.merge({ series: series })
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
|
-
def find_parser(series)
|
32
|
-
PARSERS_CLASSES[series] || Pubid::Nist::Parsers::Default
|
37
|
+
def find_parser(publisher, series)
|
38
|
+
PARSERS_CLASSES[series] || PARSERS_CLASSES["#{publisher} #{series}"] || Pubid::Nist::Parsers::Default
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Pubid::Nist
|
2
2
|
module Parsers
|
3
|
-
class
|
3
|
+
class Circ < Default
|
4
4
|
rule(:revision) do
|
5
5
|
((str("rev") >> (words >> year_digits).as(:revision)) |
|
6
|
-
(str("r") >> digits.as(:revision))
|
6
|
+
(str("r") >> (digits | (words >> year_digits)).as(:revision))
|
7
7
|
)
|
8
8
|
end
|
9
9
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Pubid::Nist
|
2
2
|
module Parsers
|
3
|
-
class
|
3
|
+
class Crpl < Default
|
4
4
|
rule(:first_report_number) do
|
5
|
-
(digits >> str("-m").maybe).as(:first_report_number)
|
5
|
+
(digits >> (str("-m") | str("-M")).maybe).as(:first_report_number)
|
6
6
|
end
|
7
7
|
|
8
8
|
rule(:part) do
|
9
|
-
str("_") >> (digits >> str("-") >> digits).as(:part)
|
9
|
+
(str("_") | str("pt")) >> (digits >> str("-") >> digits).as(:part)
|
10
10
|
end
|
11
11
|
|
12
12
|
rule(:supplement) do
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Pubid::Nist
|
2
2
|
module Parsers
|
3
|
-
class
|
3
|
+
class Csm < Default
|
4
4
|
rule(:identifier) do
|
5
5
|
(str(" ") | str(".")) >> report_number.maybe >> parts.repeat.as(:parts)
|
6
6
|
end
|
7
7
|
|
8
|
-
rule(:part_prefixes) { str("n") }
|
8
|
+
rule(:part_prefixes) { str("n") | str("pt") }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -19,11 +19,11 @@ module Pubid::Nist
|
|
19
19
|
end
|
20
20
|
|
21
21
|
rule(:supplement) do
|
22
|
-
(str("supp") | str("sup")) >> match('\d').repeat.as(:supplement)
|
22
|
+
(str("supp") | str("sup")) >> match('[A-Z\d]').repeat.as(:supplement)
|
23
23
|
end
|
24
24
|
|
25
25
|
rule(:errata) do
|
26
|
-
str("-").maybe >> str("errata").as(:errata)
|
26
|
+
str("-").maybe >> (str("errata") | str("err")).as(:errata)
|
27
27
|
end
|
28
28
|
|
29
29
|
rule(:index) do
|
@@ -40,7 +40,7 @@ module Pubid::Nist
|
|
40
40
|
end
|
41
41
|
|
42
42
|
rule(:stage) do
|
43
|
-
(space >> (array_to_str(STAGES["id"].keys + STAGES["id"].keys.map(&:upcase)).as(:id) >>
|
43
|
+
((space | dot) >> (array_to_str(STAGES["id"].keys + STAGES["id"].keys.map(&:upcase)).as(:id) >>
|
44
44
|
array_to_str(STAGES["type"].keys + STAGES["type"].keys.map(&:upcase)).as(:type)).as(:stage))
|
45
45
|
end
|
46
46
|
|
@@ -68,7 +68,7 @@ module Pubid::Nist
|
|
68
68
|
rule(:part_prefixes) { str("pt") | str("p") }
|
69
69
|
|
70
70
|
rule(:part) do
|
71
|
-
part_prefixes >> digits.as(:part)
|
71
|
+
part_prefixes >> (digits >> (str("-") >> digits).maybe).as(:part)
|
72
72
|
end
|
73
73
|
|
74
74
|
rule(:revision) do
|
@@ -99,7 +99,8 @@ module Pubid::Nist
|
|
99
99
|
end
|
100
100
|
|
101
101
|
rule(:addendum) do
|
102
|
-
(str("-add") | str(".add
|
102
|
+
(str("-add") | str(".add") | str(" Add.")) >>
|
103
|
+
(str(" ") | str("-")).maybe >> (digits | str("")).as(:number).as(:addendum)
|
103
104
|
end
|
104
105
|
|
105
106
|
rule(:section) do
|
@@ -1,8 +1,15 @@
|
|
1
|
-
require_relative "nbs_fips"
|
2
|
-
|
3
1
|
module Pubid::Nist
|
4
2
|
module Parsers
|
5
|
-
class Fips <
|
3
|
+
class Fips < Default
|
4
|
+
rule(:edition) do
|
5
|
+
str("-") >> (
|
6
|
+
(month_letters.as(:edition_month) >> year_digits.as(:edition_year)) |
|
7
|
+
year_digits.as(:edition_year) |
|
8
|
+
(month_letters.as(:edition_month) >> match('\d').repeat(2, 2).as(:edition_day) >>
|
9
|
+
str("/") >> year_digits.as(:edition_year))
|
10
|
+
) |
|
11
|
+
(str("e") >> year_digits.as(:edition_year) >> month_digits.as(:edition_month).maybe)
|
12
|
+
end
|
6
13
|
end
|
7
14
|
end
|
8
15
|
end
|
@@ -1,15 +1,7 @@
|
|
1
1
|
module Pubid::Nist
|
2
2
|
module Parsers
|
3
|
-
class
|
4
|
-
|
5
|
-
# 44e2-1955 -> 44e2
|
6
|
-
# 146v1-1991
|
7
|
-
# 105-1-1990 -> 105-1e1990
|
8
|
-
# 111r1977 / 146v1
|
9
|
-
# 130-1979 -> 130e1979
|
10
|
-
# 105-8 -> 105-8
|
11
|
-
# 28supp1957pt1
|
12
|
-
# 67suppFeb1965
|
3
|
+
class Hb < Default
|
4
|
+
rule(:number_suffix) { match("[a-zA-Z]") }
|
13
5
|
|
14
6
|
rule(:edition) do
|
15
7
|
(str("supp") >> str("").as(:supplement) >>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Pubid::Nist
|
2
2
|
module Parsers
|
3
|
-
class
|
3
|
+
class Sp < Default
|
4
4
|
rule(:version) do
|
5
5
|
(((str("ver") | str(" Ver. ") | str(" Version ")) >> (digits >> (str(".") >> digits).repeat).as(:version)) |
|
6
6
|
(str("v") >>
|
@@ -50,10 +50,12 @@ module Pubid::Nist
|
|
50
50
|
end
|
51
51
|
|
52
52
|
rule(:volume) do
|
53
|
-
|
53
|
+
# hack for NBS SP 535v2a-l vs NBS SP 535v2m-z
|
54
|
+
# https://github.com/metanorma/pubid-nist/issues/98
|
55
|
+
(str("v") | str(" Vol. ")) >> (digits >> (str("a-l") | str("m-z")).maybe >> match("[A-Z]").repeat).as(:volume)
|
54
56
|
end
|
55
57
|
|
56
|
-
rule(:part_prefixes) { str("pt") | str("p") | str(" Part ") }
|
58
|
+
rule(:part_prefixes) { str("pt") | str("p") | str("P") | str(" Part ") }
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Pubid::Nist
|
2
|
+
module Parsers
|
3
|
+
class Tn < Default
|
4
|
+
# rule(:report_number) do
|
5
|
+
# first_report_number
|
6
|
+
# end
|
7
|
+
|
8
|
+
rule(:edition_prefixes) do
|
9
|
+
str("-") | str("e")
|
10
|
+
end
|
11
|
+
|
12
|
+
rule(:second_report_number) do
|
13
|
+
year_digits.absent? >> (digits_with_suffix | str("A")).as(:second_report_number)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/pubid/nist/publisher.rb
CHANGED
@@ -2,7 +2,7 @@ PUBLISHERS = YAML.load_file(File.join(File.dirname(__FILE__),
|
|
2
2
|
"../../../publishers.yaml"))
|
3
3
|
|
4
4
|
module Pubid::Nist
|
5
|
-
class Publisher
|
5
|
+
class Publisher < Pubid::Core::Entity
|
6
6
|
attr_accessor :publisher
|
7
7
|
|
8
8
|
def initialize(publisher:)
|
@@ -17,10 +17,6 @@ module Pubid::Nist
|
|
17
17
|
PUBLISHERS[format.to_s][@publisher]
|
18
18
|
end
|
19
19
|
|
20
|
-
def ==(other)
|
21
|
-
other.publisher == @publisher
|
22
|
-
end
|
23
|
-
|
24
20
|
def self.publishers_keys
|
25
21
|
PUBLISHERS["long"].keys
|
26
22
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
module Pubid::Nist::Renderer
|
4
|
+
class Addendum < Base
|
5
|
+
def render_identifier(params, opts)
|
6
|
+
# = "%{base}" % params
|
7
|
+
result = params[:base].to_s(opts[:format])
|
8
|
+
case opts[:format]
|
9
|
+
when :long
|
10
|
+
"Addendum to #{result}"
|
11
|
+
when :abbrev
|
12
|
+
"Add. to #{result}"
|
13
|
+
when :short
|
14
|
+
"#{result} Add."
|
15
|
+
when :mr
|
16
|
+
"#{result}.add-1"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|