historical_dating 1.8.0 → 1.9.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/Gemfile.lock +12 -13
- data/lib/historical_dating/parser.rb +10 -1
- data/lib/historical_dating/transform.rb +21 -0
- data/lib/historical_dating/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea9f6d3ea5c9989b77256a1a935b671fcfea3670e45b83120c40f0f7012c3708
|
|
4
|
+
data.tar.gz: 9dcf1c375641b46cadb8268a60bf37650f5775be48f6e58fdb5d6ad8c222fa39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d39a07f5744036e7e5304e5d94f9548bff69f84cabdda11e19d9271538b9a674b0e1cc576463b2327ddbf337f1dce449357b386472f39d4152f0603f9ed6324
|
|
7
|
+
data.tar.gz: 7aad71e45279f25a1d7b739a6bf656e78dcf2831178c54ebe32804f8b5499c1a16c4915d993cd4574678bc58c4d23732207da1039ddf99da789c4e523da47a5d
|
data/Gemfile.lock
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
historical_dating (1.
|
|
4
|
+
historical_dating (1.9.0)
|
|
5
5
|
activesupport (>= 3.0.0)
|
|
6
6
|
parslet (~> 2.0.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activesupport (6.
|
|
11
|
+
activesupport (6.1.4.1)
|
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
13
|
-
i18n (>=
|
|
14
|
-
minitest (
|
|
15
|
-
tzinfo (~>
|
|
16
|
-
zeitwerk (~> 2.
|
|
13
|
+
i18n (>= 1.6, < 2)
|
|
14
|
+
minitest (>= 5.1)
|
|
15
|
+
tzinfo (~> 2.0)
|
|
16
|
+
zeitwerk (~> 2.3)
|
|
17
17
|
coderay (1.1.3)
|
|
18
|
-
concurrent-ruby (1.1.
|
|
18
|
+
concurrent-ruby (1.1.9)
|
|
19
19
|
diff-lcs (1.4.4)
|
|
20
|
-
i18n (1.8.
|
|
20
|
+
i18n (1.8.11)
|
|
21
21
|
concurrent-ruby (~> 1.0)
|
|
22
22
|
method_source (1.0.0)
|
|
23
23
|
minitest (5.14.1)
|
|
@@ -39,10 +39,9 @@ GEM
|
|
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
40
|
rspec-support (~> 3.9.0)
|
|
41
41
|
rspec-support (3.9.3)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
zeitwerk (2.4.1)
|
|
42
|
+
tzinfo (2.0.4)
|
|
43
|
+
concurrent-ruby (~> 1.0)
|
|
44
|
+
zeitwerk (2.4.2)
|
|
46
45
|
|
|
47
46
|
PLATFORMS
|
|
48
47
|
ruby
|
|
@@ -55,4 +54,4 @@ DEPENDENCIES
|
|
|
55
54
|
rspec (~> 3.9.0)
|
|
56
55
|
|
|
57
56
|
BUNDLED WITH
|
|
58
|
-
2.2.
|
|
57
|
+
2.2.30
|
|
@@ -81,6 +81,14 @@ class HistoricalDating::Parser < Parslet::Parser
|
|
|
81
81
|
str('4. Viertel')
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
# Special cases / conflicts with existing rules
|
|
85
|
+
|
|
86
|
+
rule(:uncertain_from_range){
|
|
87
|
+
natural_number.as(:from_year) >> str('/') >> whole_number >>
|
|
88
|
+
space.maybe >> to_characters >> space.maybe >>
|
|
89
|
+
natural_number.as(:to_year)
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
# Dating
|
|
85
93
|
|
|
86
94
|
rule(:day){ match['1-2'] >> match['0-9'] | str('3') >> match['0-1'] | match['1-9'] | str('0') >> match['1-9'] }
|
|
@@ -143,7 +151,8 @@ class HistoricalDating::Parser < Parslet::Parser
|
|
|
143
151
|
century_part.as(:century_part) |
|
|
144
152
|
century.as(:century) |
|
|
145
153
|
date.as(:date) |
|
|
146
|
-
year.as(:year)
|
|
154
|
+
year.as(:year) |
|
|
155
|
+
uncertain_from_range.as(:special)
|
|
147
156
|
}
|
|
148
157
|
|
|
149
158
|
root(:dating)
|
|
@@ -65,6 +65,20 @@ class HistoricalDating::Transform < Parslet::Transform
|
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
# rule(from_year: simple(:from_year), to_year: simple(:to_year), acbc: simple(:acbc)) do
|
|
69
|
+
# if acbc.nil? || acbc.match(/(nach|n.) (Chr.|Christus)/)
|
|
70
|
+
# {
|
|
71
|
+
# :from => Date.new(from_year.to_i, 1, 1),
|
|
72
|
+
# :to => Date.new(to_year.to_i, 12, 31)
|
|
73
|
+
# }
|
|
74
|
+
# else
|
|
75
|
+
# {
|
|
76
|
+
# :from => Date.new(to_year.to_i * -1, 1, 1),
|
|
77
|
+
# :to => Date.new(from_year.to_i * -1, 12, 31)
|
|
78
|
+
# }
|
|
79
|
+
# end
|
|
80
|
+
# end
|
|
81
|
+
|
|
68
82
|
rule(:day => simple(:day), :month => simple(:month), :yearnum => simple(:yearnum)) do
|
|
69
83
|
if !Date.leap?(yearnum.to_i) && month.to_i == 2 && day.to_i == 29
|
|
70
84
|
raise HistoricalDating::Error.new('not_leap_year', year: yearnum.to_i)
|
|
@@ -143,6 +157,13 @@ class HistoricalDating::Transform < Parslet::Transform
|
|
|
143
157
|
end
|
|
144
158
|
end
|
|
145
159
|
|
|
160
|
+
rule(special: subtree(:a)) do
|
|
161
|
+
result = {
|
|
162
|
+
from: Date.new(a[:from_year].to_i, 1, 1),
|
|
163
|
+
to: Date.new(a[:to_year].to_i, 12, 31)
|
|
164
|
+
}
|
|
165
|
+
end
|
|
166
|
+
|
|
146
167
|
def self.ac?(acbc)
|
|
147
168
|
acbc.nil? || acbc.match(/(nach|n.) (Chr.|Christus)/) || acbc.match(/AC|Ac|Anno Domini|A. D.|AD/)
|
|
148
169
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: historical_dating
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Moritz Schepp
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parslet
|
|
@@ -100,7 +100,7 @@ metadata:
|
|
|
100
100
|
homepage_uri: https://github.com/wendig-ou/historical_dating
|
|
101
101
|
source_code_uri: https://github.com/wendig-ou/historical_dating
|
|
102
102
|
changelog_uri: https://github.com/wendig-ou/historical_dating/blob/master/CHANGELOG.md
|
|
103
|
-
post_install_message:
|
|
103
|
+
post_install_message:
|
|
104
104
|
rdoc_options: []
|
|
105
105
|
require_paths:
|
|
106
106
|
- lib
|
|
@@ -115,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
116
|
version: '0'
|
|
117
117
|
requirements: []
|
|
118
|
-
rubygems_version: 3.
|
|
119
|
-
signing_key:
|
|
118
|
+
rubygems_version: 3.1.6
|
|
119
|
+
signing_key:
|
|
120
120
|
specification_version: 4
|
|
121
121
|
summary: Parse human historical datings
|
|
122
122
|
test_files: []
|