when_exe 0.4.1 → 0.4.2
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/README.md +36 -33
- data/bin/locales.rb +1 -1
- data/bin/make_ttl.rb.config +1 -1
- data/lib/when_exe.rb +27 -16
- data/lib/when_exe/basictypes.rb +772 -771
- data/lib/when_exe/calendartypes.rb +1485 -1453
- data/lib/when_exe/coordinates.rb +5 -0
- data/lib/when_exe/core/compatibility.rb +1 -1
- data/lib/when_exe/core/duration.rb +147 -116
- data/lib/when_exe/core/extension.rb +499 -497
- data/lib/when_exe/ephemeris.rb +1952 -1951
- data/lib/when_exe/ephemeris/eclipse.rb +5 -4
- data/lib/when_exe/ephemeris/notes.rb +457 -421
- data/lib/when_exe/ephemeris/planets.rb +585 -585
- data/lib/when_exe/ephemeris/sun.rb +214 -214
- data/lib/when_exe/google_api.rb +153 -0
- data/lib/when_exe/icalendar.rb +1640 -1632
- data/lib/when_exe/inspect.rb +42 -20
- data/lib/when_exe/linkeddata.rb +28 -7
- data/lib/when_exe/locales/autoload.rb +2 -1
- data/lib/when_exe/locales/locale.rb +35 -15
- data/lib/when_exe/locales/zh.rb +77 -0
- data/lib/when_exe/mini_application.rb +3 -1
- data/lib/when_exe/{googlecalendar.rb → obsolete/googlecalendar.rb} +144 -144
- data/lib/when_exe/parts/enumerator.rb +498 -486
- data/lib/when_exe/parts/geometric_complex.rb +397 -397
- data/lib/when_exe/parts/timezone.rb +246 -241
- data/lib/when_exe/region/armenian.rb +55 -56
- data/lib/when_exe/region/babylonian.rb +406 -405
- data/lib/when_exe/region/bahai.rb +107 -106
- data/lib/when_exe/region/balinese.rb +624 -622
- data/lib/when_exe/region/chinese.rb +1071 -1026
- data/lib/when_exe/region/chinese/epochs.rb +28 -28
- data/lib/when_exe/region/chinese/notes.rb +219 -0
- data/lib/when_exe/region/chinese/twins.rb +803 -803
- data/lib/when_exe/region/christian.rb +21 -15
- data/lib/when_exe/region/coptic.rb +107 -106
- data/lib/when_exe/region/discordian.rb +218 -218
- data/lib/when_exe/region/east_asian.rb +1 -1
- data/lib/when_exe/region/french.rb +126 -56
- data/lib/when_exe/region/geologicalage.rb +639 -639
- data/lib/when_exe/region/goddess.rb +60 -58
- data/lib/when_exe/region/hanke_henry.rb +2 -2
- data/lib/when_exe/region/indian.rb +1225 -1222
- data/lib/when_exe/region/international_fixed.rb +96 -97
- data/lib/when_exe/region/iranian.rb +206 -203
- data/lib/when_exe/region/islamic.rb +102 -102
- data/lib/when_exe/region/japanese.rb +126 -71
- data/lib/when_exe/region/japanese/epochs.rb +426 -426
- data/lib/when_exe/region/japanese/notes.rb +101 -81
- data/lib/when_exe/region/japanese/residues.rb +1345 -1311
- data/lib/when_exe/region/japanese/twins.rb +225 -225
- data/lib/when_exe/region/japanese/weeks.rb +112 -112
- data/lib/when_exe/region/javanese.rb +230 -230
- data/lib/when_exe/region/jewish.rb +130 -131
- data/lib/when_exe/region/m17n.rb +114 -114
- data/lib/when_exe/region/martian.rb +258 -258
- data/lib/when_exe/region/mayan.rb +11 -8
- data/lib/when_exe/region/pax.rb +4 -5
- data/lib/when_exe/region/pope.rb +1 -1
- data/lib/when_exe/region/positivist.rb +100 -100
- data/lib/when_exe/region/residue.rb +162 -162
- data/lib/when_exe/region/roman.rb +333 -333
- data/lib/when_exe/region/{soviet.rb → russian.rb} +221 -209
- data/lib/when_exe/region/shire.rb +222 -223
- data/lib/when_exe/region/symmetry.rb +50 -50
- data/lib/when_exe/region/thai.rb +336 -336
- data/lib/when_exe/region/tibetan.rb +315 -316
- data/lib/when_exe/region/tranquility.rb +207 -208
- data/lib/when_exe/region/vanishing_leprechaun.rb +3 -1
- data/lib/when_exe/region/vietnamese.rb +449 -440
- data/lib/when_exe/region/weekdate.rb +80 -80
- data/lib/when_exe/region/world.rb +170 -171
- data/lib/when_exe/region/world_season.rb +89 -89
- data/lib/when_exe/region/yerm.rb +3 -3
- data/lib/when_exe/region/zoroastrian.rb +205 -205
- data/lib/when_exe/timestandard.rb +708 -707
- data/lib/when_exe/tmduration.rb +338 -338
- data/lib/when_exe/tmobjects.rb +1356 -1356
- data/lib/when_exe/tmposition.rb +66 -31
- data/lib/when_exe/version.rb +16 -2
- data/test/examples/Residue.m17n +83 -83
- data/test/examples/Terms.m17n +2 -2
- data/test/test.rb +2 -2
- data/test/test/google_api.rb +65 -0
- data/test/test/linkeddata.rb +1 -1
- data/test/test/{googlecalendar.rb → obsolete/googlecalendar.rb} +194 -194
- data/test/test/region/indian.rb +90 -85
- data/test/test/region/m17n.rb +7 -7
- data/test/test/region/mayan.rb +195 -195
- data/test/test/region/residue.rb +153 -153
- data/test/test/tmposition.rb +11 -1
- data/when_exe.gemspec +2 -2
- metadata +95 -8
- data/test/test.rb.config +0 -1
|
@@ -10,22 +10,28 @@ module When
|
|
|
10
10
|
class BasicTypes::M17n
|
|
11
11
|
|
|
12
12
|
Christian = [self, [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"[
|
|
16
|
-
"[
|
|
17
|
-
"[
|
|
18
|
-
"[
|
|
19
|
-
"[
|
|
13
|
+
"namespace:[wiki=http://www2u.biglobe.ne.jp/~suchowan/wiki/]",
|
|
14
|
+
"locale:[=en:, ja=ja:, zh=zh:, kr=ko:, kp=ko:, ko=ko:, alias]",
|
|
15
|
+
"names:[Christian=en:Christianity, キリスト教, 基督教]",
|
|
16
|
+
"[Julian=en:Julian_calendar, ユリウス暦 , 儒略曆, era:J]",
|
|
17
|
+
"[Gregorian=en:Gregorian_calendar, グレゴリオ暦 , 格里曆, era:G]",
|
|
18
|
+
"[RevisedJulian=en:Revised_Julian_calendar, 修正ユリウス暦, 儒略改革曆]",
|
|
19
|
+
"[Swedish=en:Swedish_calendar, スウェーデン暦, 瑞典曆]",
|
|
20
|
+
"[Customizable Western=wiki:pref_examples_en.html," +
|
|
21
|
+
"西暦(カスタマイズ可能)=wiki:pref_examples.html," +
|
|
22
|
+
"西元(可定制)=wiki:pref_examples.html," +
|
|
23
|
+
"서력기원(사용자정의)=wiki:pref_examples.html," +
|
|
24
|
+
"서력기원(사용자정의)=wiki:pref_examples.html," +
|
|
25
|
+
"서력기원(사용자정의)=wiki:pref_examples.html, *alias:Civil]"
|
|
20
26
|
]]
|
|
21
27
|
end
|
|
22
28
|
|
|
23
29
|
class TM::CalendarEra
|
|
24
30
|
# Anno Mundi Era
|
|
25
31
|
Byzantine = [self, [
|
|
26
|
-
"locale:[=en:, ja=ja:, alias]",
|
|
27
|
-
"period:[Byzantine=en:Byzantine_calendar, ビザンティン暦=ja
|
|
28
|
-
["[AM=en:Anno_Mundi, 世界創造紀元, alias:Anno_Mundi]6497*9.1",
|
|
32
|
+
"locale:[=en:, ja=ja:, zh=zh:, alias]",
|
|
33
|
+
"period:[Byzantine=en:Byzantine_calendar, ビザンティン暦=ja:%%<世界創造紀元>, 拜占庭曆=]",
|
|
34
|
+
["[AM=en:Anno_Mundi, 世界創造紀元, 世界創造紀元=en:Anno_Mundi, alias:Anno_Mundi]6497*9.1",
|
|
29
35
|
'@CE', "989*09-01^Julian?border=0*9-1¬e=Roman", "1453-5-29"]
|
|
30
36
|
]]
|
|
31
37
|
end
|
|
@@ -542,24 +548,24 @@ module When
|
|
|
542
548
|
|
|
543
549
|
Notes = [When::BasicTypes::M17n, [
|
|
544
550
|
"locale:[=en:, ja=ja:, alias]",
|
|
545
|
-
"names:[Christian]",
|
|
551
|
+
"names:[Christian=en:Christianity, キリスト教]",
|
|
546
552
|
|
|
547
553
|
# 年の暦注 ----------------------------
|
|
548
554
|
[When::BasicTypes::M17n,
|
|
549
|
-
"names:[year]"
|
|
555
|
+
"names:[note for year=, 年の暦注=, *year]"
|
|
550
556
|
],
|
|
551
557
|
|
|
552
558
|
# 月の暦注 ----------------------------
|
|
553
559
|
[When::BasicTypes::M17n,
|
|
554
|
-
"names:[month]",
|
|
560
|
+
"names:[note for month=, 月の暦注=, *month]",
|
|
555
561
|
[When::BasicTypes::M17n,
|
|
556
|
-
"names:[Month]"
|
|
562
|
+
"names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, zh:該月的名稱=, *alias:Month=]"
|
|
557
563
|
]
|
|
558
564
|
],
|
|
559
565
|
|
|
560
566
|
# 日の暦注 ----------------------------
|
|
561
567
|
[When::BasicTypes::M17n,
|
|
562
|
-
"names:[day]",
|
|
568
|
+
"names:[note for day=, 日の暦注=, *day]",
|
|
563
569
|
[When::BasicTypes::M17n, "names:[Week, 七曜]" ],
|
|
564
570
|
[When::BasicTypes::M17n, "names:[Easter, 復活祭]" ],
|
|
565
571
|
[When::BasicTypes::M17n, "names:[Christmas, クリスマス]"],
|
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (C) 2011-
|
|
4
|
-
|
|
5
|
-
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
|
6
|
-
=end
|
|
7
|
-
|
|
8
|
-
module When
|
|
9
|
-
|
|
10
|
-
class BasicTypes::M17n
|
|
11
|
-
|
|
12
|
-
Coptic = [self, [
|
|
13
|
-
"locale:[=en:, ja=ja:, alias]",
|
|
14
|
-
"names:[Coptic=]",
|
|
15
|
-
"[Coptic=en:Coptic_calendar,
|
|
16
|
-
"[Ethiopian=en:Ethiopian_calendar, エチオピア暦=en:Ethiopian_calendar]",
|
|
17
|
-
"[
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"[
|
|
26
|
-
"[
|
|
27
|
-
"[
|
|
28
|
-
"[
|
|
29
|
-
"[
|
|
30
|
-
"[
|
|
31
|
-
"[
|
|
32
|
-
"[
|
|
33
|
-
"[
|
|
34
|
-
"[
|
|
35
|
-
"[
|
|
36
|
-
"[
|
|
37
|
-
"[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"[
|
|
43
|
-
"[
|
|
44
|
-
"[
|
|
45
|
-
"[
|
|
46
|
-
"[
|
|
47
|
-
"[
|
|
48
|
-
"[
|
|
49
|
-
"[
|
|
50
|
-
"[
|
|
51
|
-
"[
|
|
52
|
-
"[
|
|
53
|
-
"[
|
|
54
|
-
"[
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
When::
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
When::
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
|
|
78
|
-
'
|
|
79
|
-
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
end
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
=begin
|
|
3
|
+
Copyright (C) 2011-2015 Takashi SUGA
|
|
4
|
+
|
|
5
|
+
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
|
6
|
+
=end
|
|
7
|
+
|
|
8
|
+
module When
|
|
9
|
+
|
|
10
|
+
class BasicTypes::M17n
|
|
11
|
+
|
|
12
|
+
Coptic = [self, [
|
|
13
|
+
"locale:[=en:, ja=ja:, zh=zh:, alias]",
|
|
14
|
+
"names:[Coptic=en:Copts, コプト, 科普特=zh:科普特人]",
|
|
15
|
+
"[Coptic=en:Coptic_calendar, コプト暦, 科普特曆 ]",
|
|
16
|
+
"[Ethiopian=en:Ethiopian_calendar, エチオピア暦=en:Ethiopian_calendar, 埃塞俄比亞曆=]",
|
|
17
|
+
"[Egyptian=en:Egypt, エジプト, 埃及 ]",
|
|
18
|
+
"[Ptolemaic=en:Ptolemaic_dynasty, プトレマイオス朝, 托勒密王朝 ]",
|
|
19
|
+
|
|
20
|
+
# Remarks
|
|
21
|
+
'[based on Chris Bennett "Egyptian Dates" (Retrieved 2014-06-29)=http://www.tyndalehouse.com/Egypt/ptolemies/chron/egyptian/chron_eg_intro.htm,' +
|
|
22
|
+
'典拠 - Chris Bennett "Egyptian Dates" (2014-06-29 閲覧)=]',
|
|
23
|
+
|
|
24
|
+
[self,
|
|
25
|
+
"names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, 該月的名稱=, *alias:EgyptianMonth=]",
|
|
26
|
+
"[tut=, トート= ]",
|
|
27
|
+
"[baba=, バーバ= ]",
|
|
28
|
+
"[hatur=, ハートール= ]",
|
|
29
|
+
"[kiyahak=, キヤハーク= ]",
|
|
30
|
+
"[tuba=, トーバ= ]",
|
|
31
|
+
"[amshir=, アムシール= ]",
|
|
32
|
+
"[baramhat=, バラムハート=]",
|
|
33
|
+
"[barmuda=, バルムーダ= ]",
|
|
34
|
+
"[bashans=, バシャンス= ]",
|
|
35
|
+
"[ba'una=, バウーナ= ]",
|
|
36
|
+
"[abib=, アビーブ= ]",
|
|
37
|
+
"[misra=, ミスラー= ]",
|
|
38
|
+
"[epagomen=, エパゴメネ= ]"
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
[self,
|
|
42
|
+
"names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, 該月的名稱=, *alias:EthiopianMonth=]",
|
|
43
|
+
"[Mäskäräm=, マスカラム= ]",
|
|
44
|
+
"[Ṭəqəmt=, テケルト= ]",
|
|
45
|
+
"[Ḫədar=, ヘダル= ]",
|
|
46
|
+
"[Taḫśaś=, ターサス= ]",
|
|
47
|
+
"[Ṭərr=, テル= ]",
|
|
48
|
+
"[Yäkatit=, イェカティト=]",
|
|
49
|
+
"[Mägabit=, メガビト= ]",
|
|
50
|
+
"[Miyazya=, ミアジア= ]",
|
|
51
|
+
"[Gənbot=, ゲエンポト= ]",
|
|
52
|
+
"[Säne=, セネ= ]",
|
|
53
|
+
"[Ḥamle=, ハムレ= ]",
|
|
54
|
+
"[Nähase=, ネハッセ= ]",
|
|
55
|
+
"[Ṗagʷəmen=, パゴウメン= ]"
|
|
56
|
+
]
|
|
57
|
+
]]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
module CalendarTypes
|
|
61
|
+
|
|
62
|
+
_egyptian_month_indices = [
|
|
63
|
+
When.Index('Coptic::EgyptianMonth', {:unit =>13}),
|
|
64
|
+
When::Coordinates::DefaultDayIndex
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
_ethiopian_month_indices = [
|
|
68
|
+
When.Index('Coptic::EthiopianMonth', {:unit =>13}),
|
|
69
|
+
When::Coordinates::DefaultDayIndex
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
#
|
|
73
|
+
# Coptic Calendar in Egypt and Ethiopia
|
|
74
|
+
#
|
|
75
|
+
Coptic = [{'Epoch'=>{'284Y'=>{'origin_of_MSC' => 1},
|
|
76
|
+
'0Y'=>{'origin_of_MSC' => 285},
|
|
77
|
+
'8Y'=>{'origin_of_MSC' => 277,
|
|
78
|
+
'label' => 'Coptic::Ethiopian',
|
|
79
|
+
'indices' => _ethiopian_month_indices}}}, CyclicTableBased, {
|
|
80
|
+
'label' => 'Coptic::Coptic',
|
|
81
|
+
'origin_of_LSC' => 1825030,
|
|
82
|
+
'origin_of_MSC' => 1,
|
|
83
|
+
'diff_to_CE' => 285,
|
|
84
|
+
'indices' => _egyptian_month_indices,
|
|
85
|
+
'rule_table' => {
|
|
86
|
+
'T' => {'Rule' =>[365,365,366,365]},
|
|
87
|
+
365 => {'Length'=>[30]*12+[5]},
|
|
88
|
+
366 => {'Length'=>[30]*12+[6]}
|
|
89
|
+
}
|
|
90
|
+
}]
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Egyptian Calendar based on Chris Bennett, http://www.tyndalehouse.com/Egypt/ptolemies/chron/babylonian/chron_bab_intro_fr.htm
|
|
94
|
+
#
|
|
95
|
+
Ptolemaic = [CyclicTableBased, {
|
|
96
|
+
'label' => 'Coptic::Ptolemaic',
|
|
97
|
+
'remarks' => When.M17n('Coptic::based on Chris Bennett "Egyptian Dates" (Retrieved 2014-06-29)'),
|
|
98
|
+
'origin_of_LSC' => 1600478,
|
|
99
|
+
'origin_of_MSC' => -330,
|
|
100
|
+
'indices' => _egyptian_month_indices,
|
|
101
|
+
'rule_table' => {
|
|
102
|
+
'T' => {'Rule' =>[365]},
|
|
103
|
+
365 => {'Length'=>[30]*12+[5]}
|
|
104
|
+
}
|
|
105
|
+
}]
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -1,218 +1,218 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
=begin
|
|
3
|
-
Copyright (C) 2014 Takashi SUGA
|
|
4
|
-
|
|
5
|
-
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
|
6
|
-
=end
|
|
7
|
-
|
|
8
|
-
module When
|
|
9
|
-
|
|
10
|
-
class BasicTypes::M17n
|
|
11
|
-
|
|
12
|
-
Discordian = [self, [
|
|
13
|
-
"locale:[=en:, ja]",
|
|
14
|
-
"names:[Discordian=en:Discordian_calendar, ディスコーディアン暦=]",
|
|
15
|
-
[self,
|
|
16
|
-
"names:[IntercalaryDay=en:Intercalation, 閏日=ja:%%<閏>]",
|
|
17
|
-
"[%0sSt. Tib's Day=, %0s閏日=]"
|
|
18
|
-
]
|
|
19
|
-
]]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
# Discordian Note
|
|
24
|
-
#
|
|
25
|
-
class CalendarNote::DiscordianWeek < CalendarNote::Week
|
|
26
|
-
|
|
27
|
-
Notes = [When::BasicTypes::M17n, [
|
|
28
|
-
"namespace:[en=http://en.wiktionary.org/wiki/]",
|
|
29
|
-
"locale:[=en:]",
|
|
30
|
-
"names:[Discordian]",
|
|
31
|
-
|
|
32
|
-
# Notes for year ----------------------------
|
|
33
|
-
[When::BasicTypes::M17n,
|
|
34
|
-
"names:[year]"
|
|
35
|
-
],
|
|
36
|
-
|
|
37
|
-
# Notes for month ----------------------------
|
|
38
|
-
[When::BasicTypes::M17n,
|
|
39
|
-
"names:[month]",
|
|
40
|
-
[When::BasicTypes::M17n,
|
|
41
|
-
"names:[
|
|
42
|
-
"[Chaos=en:chaos ]",
|
|
43
|
-
"[Discord=en:discord ]",
|
|
44
|
-
"[Confusion=en:confusion ]",
|
|
45
|
-
"[Bureaucracy=en:bureaucracy]",
|
|
46
|
-
"[The Aftermath=en:aftermath]"
|
|
47
|
-
]
|
|
48
|
-
],
|
|
49
|
-
|
|
50
|
-
# Notes for day ----------------------------
|
|
51
|
-
[When::BasicTypes::M17n,
|
|
52
|
-
"names:[day]",
|
|
53
|
-
[When::BasicTypes::M17n,
|
|
54
|
-
"names:[Week=
|
|
55
|
-
[DayOfWeek, "label:[Sweetmorn= ]", {'delta'=>5}],
|
|
56
|
-
[DayOfWeek, "label:[Boomtime= ]", {'delta'=>5}],
|
|
57
|
-
[DayOfWeek, "label:[Pungenday= ]", {'delta'=>5}],
|
|
58
|
-
[DayOfWeek, "label:[Prickle-Prickle=]", {'delta'=>5}],
|
|
59
|
-
[DayOfWeek, "label:[Setting Orange= ]", {'delta'=>5}],
|
|
60
|
-
[DayOfWeek, "label:[Out of Week= ]", {'delta'=>1461}]
|
|
61
|
-
],
|
|
62
|
-
|
|
63
|
-
[When::BasicTypes::M17n,
|
|
64
|
-
"names:[Holyday
|
|
65
|
-
"[St. Tib's Day=]", # 02-29 St. Tib's Day
|
|
66
|
-
"[Mungday= ]", # 01-05 Chaos 5
|
|
67
|
-
"[Chaoflux= ]", # 02-19 Chaos 50
|
|
68
|
-
"[Mojoday= ]", # 03-19 Discord 5
|
|
69
|
-
"[Discoflux= ]", # 05-03 Discord 50
|
|
70
|
-
"[Syaday= ]", # 05-31 Confusion 5
|
|
71
|
-
"[Confuflux= ]", # 07-15 Confusion 50
|
|
72
|
-
"[Zaraday= ]", # 08-12 Bureaucracy 5
|
|
73
|
-
"[Bureflux= ]", # 09-26 Bureaucracy 50
|
|
74
|
-
"[Maladay= ]", # 10-24 The Aftermath 5
|
|
75
|
-
"[Afflux= ]" # 12-08 The Aftermath 50
|
|
76
|
-
],
|
|
77
|
-
|
|
78
|
-
"[Common_Week=]"
|
|
79
|
-
]
|
|
80
|
-
]]
|
|
81
|
-
|
|
82
|
-
# @private
|
|
83
|
-
IndexOfWeek = [0, 1, 2, 3, 5, 4]
|
|
84
|
-
|
|
85
|
-
# Just or last sweetmorn
|
|
86
|
-
#
|
|
87
|
-
# @param [When::TM::TemporalPosition] date
|
|
88
|
-
# @param [nil] parameter (not used)
|
|
89
|
-
#
|
|
90
|
-
# @return [When::TM::TemporalPosition]
|
|
91
|
-
#
|
|
92
|
-
def sweetmorn(date, parameter=nil)
|
|
93
|
-
date = _to_date_for_note(date)
|
|
94
|
-
y,m,d = date.cal_date
|
|
95
|
-
date -= When::P1D if date.length(When::MONTH) == 74 && +d == 60
|
|
96
|
-
dow = ((m-1)*73+d*1-1) % 5
|
|
97
|
-
date -= When::P1D * dow unless dow == 0
|
|
98
|
-
date.events = [@days_of_week[0]]
|
|
99
|
-
date
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# Erisian week
|
|
103
|
-
#
|
|
104
|
-
# @param [When::TM::CalDate] date
|
|
105
|
-
# @param [When::TM::CalDate] base
|
|
106
|
-
#
|
|
107
|
-
# @return [String]
|
|
108
|
-
#
|
|
109
|
-
def week(date, base=nil)
|
|
110
|
-
date = _to_date_for_note(date)
|
|
111
|
-
y,m,d = date.cal_date
|
|
112
|
-
dow = d*0 == 0 ? ((m-1)*73+d*1-1) % 5 : 5
|
|
113
|
-
length = (base || date).length(When::MONTH) == 73 ? 5 : 6
|
|
114
|
-
index = length == 5 ? dow : IndexOfWeek[dow]
|
|
115
|
-
{:value=>@days_of_week[dow], :position=>[index,length]}
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
#
|
|
119
|
-
# Week labels
|
|
120
|
-
#
|
|
121
|
-
# @param [When::TM::TemporalPosition] date
|
|
122
|
-
#
|
|
123
|
-
# @return [Array<When::CalendarNote::Week::DayOfWeek>]
|
|
124
|
-
#
|
|
125
|
-
def week_labels(date)
|
|
126
|
-
date = _to_date_for_note(date)
|
|
127
|
-
date.length(When::MONTH) == 73 ?
|
|
128
|
-
@days_of_week.child[0...5] :
|
|
129
|
-
@days_of_week.child[0...4] + [@days_of_week.child[5]] + [@days_of_week.child[4]]
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# Holyday
|
|
133
|
-
#
|
|
134
|
-
# @param [When::TM::CalDate] date
|
|
135
|
-
#
|
|
136
|
-
# @return [String]
|
|
137
|
-
#
|
|
138
|
-
def holyday(date)
|
|
139
|
-
date = _to_date_for_note(date)
|
|
140
|
-
y, m, d = date.cal_date
|
|
141
|
-
index =
|
|
142
|
-
case +d
|
|
143
|
-
when 5 ; 1
|
|
144
|
-
when 50 ; 2
|
|
145
|
-
else ; d * 0 - 1
|
|
146
|
-
end
|
|
147
|
-
return nil if index == -1
|
|
148
|
-
When.CalendarNote('DiscordianWeek/Notes::day::Holyday::*')[(m-1)*2+index]
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
# convert date to Discordian date
|
|
153
|
-
#
|
|
154
|
-
# @private
|
|
155
|
-
def _to_date_for_note(date)
|
|
156
|
-
date = When::Discordian ^ date unless date.frame.label.to_s == 'Discordian'
|
|
157
|
-
date
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
private
|
|
161
|
-
|
|
162
|
-
# object normalization
|
|
163
|
-
#
|
|
164
|
-
# @private
|
|
165
|
-
def _normalize(args=[], options={})
|
|
166
|
-
@event ||= 'sweetmorn'
|
|
167
|
-
super
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
module CalendarTypes
|
|
172
|
-
|
|
173
|
-
#
|
|
174
|
-
# Discordian Calendar
|
|
175
|
-
#
|
|
176
|
-
class Discordian < SolarYearTableBased
|
|
177
|
-
|
|
178
|
-
# @private
|
|
179
|
-
Normal_IDS = (1..73).to_a
|
|
180
|
-
|
|
181
|
-
# @private
|
|
182
|
-
Long_IDS = (1..59).to_a + [When.Pair(59,1)] + (60..73).to_a
|
|
183
|
-
|
|
184
|
-
private
|
|
185
|
-
|
|
186
|
-
#
|
|
187
|
-
# Object Normalization
|
|
188
|
-
#
|
|
189
|
-
def _normalize(args=[], options={})
|
|
190
|
-
@label ||= 'Discordian'
|
|
191
|
-
@indices ||= [
|
|
192
|
-
When.Index('DiscordianWeekNotes::month::Month', {:unit =>5}),
|
|
193
|
-
When.Index({:branch=>{1=>When.M17n('Discordian::IntercalaryDay')[0]}})
|
|
194
|
-
]
|
|
195
|
-
@origin_of_MSC ||= +1166
|
|
196
|
-
@diff_to_CE ||= 0
|
|
197
|
-
@note ||= 'DiscordianWeek'
|
|
198
|
-
@rule_table ||= {
|
|
199
|
-
365 => {'Length'=> [73]*5},
|
|
200
|
-
366 => {'Length'=> [74] + [73]*4}
|
|
201
|
-
}
|
|
202
|
-
super
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
#
|
|
206
|
-
# day arrangement pattern
|
|
207
|
-
#
|
|
208
|
-
def _ids_(date)
|
|
209
|
-
y, m = date
|
|
210
|
-
case m
|
|
211
|
-
when nil ; super
|
|
212
|
-
when 0 ; @engine._length([+y, 1]) == 28 ? Normal_IDS : Long_IDS
|
|
213
|
-
else ; Normal_IDS
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
end
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
=begin
|
|
3
|
+
Copyright (C) 2014-2015 Takashi SUGA
|
|
4
|
+
|
|
5
|
+
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
|
6
|
+
=end
|
|
7
|
+
|
|
8
|
+
module When
|
|
9
|
+
|
|
10
|
+
class BasicTypes::M17n
|
|
11
|
+
|
|
12
|
+
Discordian = [self, [
|
|
13
|
+
"locale:[=en:, ja=ja:]",
|
|
14
|
+
"names:[Discordian=en:Discordian_calendar, ディスコーディアン暦=]",
|
|
15
|
+
[self,
|
|
16
|
+
"names:[IntercalaryDay=en:Intercalation, 閏日=ja:%%<閏>]",
|
|
17
|
+
"[%0sSt. Tib's Day=, %0s閏日=]"
|
|
18
|
+
]
|
|
19
|
+
]]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# Discordian Note
|
|
24
|
+
#
|
|
25
|
+
class CalendarNote::DiscordianWeek < CalendarNote::Week
|
|
26
|
+
|
|
27
|
+
Notes = [When::BasicTypes::M17n, [
|
|
28
|
+
"namespace:[en=http://en.wiktionary.org/wiki/]",
|
|
29
|
+
"locale:[=en:, ja=ja:]",
|
|
30
|
+
"names:[Discordian]",
|
|
31
|
+
|
|
32
|
+
# Notes for year ----------------------------
|
|
33
|
+
[When::BasicTypes::M17n,
|
|
34
|
+
"names:[note for year=, 年の暦注=, *year]"
|
|
35
|
+
],
|
|
36
|
+
|
|
37
|
+
# Notes for month ----------------------------
|
|
38
|
+
[When::BasicTypes::M17n,
|
|
39
|
+
"names:[note for month=, 月の暦注=, *month]",
|
|
40
|
+
[When::BasicTypes::M17n,
|
|
41
|
+
"names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, zh:該月的名稱=, *alias:Month=]",
|
|
42
|
+
"[Chaos=en:chaos ]",
|
|
43
|
+
"[Discord=en:discord ]",
|
|
44
|
+
"[Confusion=en:confusion ]",
|
|
45
|
+
"[Bureaucracy=en:bureaucracy]",
|
|
46
|
+
"[The Aftermath=en:aftermath]"
|
|
47
|
+
]
|
|
48
|
+
],
|
|
49
|
+
|
|
50
|
+
# Notes for day ----------------------------
|
|
51
|
+
[When::BasicTypes::M17n,
|
|
52
|
+
"names:[note for day=, 日の暦注=, *day]",
|
|
53
|
+
[When::BasicTypes::M17n,
|
|
54
|
+
"names:[Five day week=, 五日週=, zh:五日週=, *alias:Week=]",
|
|
55
|
+
[DayOfWeek, "label:[Sweetmorn= ]", {'delta'=>5}],
|
|
56
|
+
[DayOfWeek, "label:[Boomtime= ]", {'delta'=>5}],
|
|
57
|
+
[DayOfWeek, "label:[Pungenday= ]", {'delta'=>5}],
|
|
58
|
+
[DayOfWeek, "label:[Prickle-Prickle=]", {'delta'=>5}],
|
|
59
|
+
[DayOfWeek, "label:[Setting Orange= ]", {'delta'=>5}],
|
|
60
|
+
[DayOfWeek, "label:[Out of Week= ]", {'delta'=>1461}]
|
|
61
|
+
],
|
|
62
|
+
|
|
63
|
+
[When::BasicTypes::M17n,
|
|
64
|
+
"names:[Holyday=, 祝日=, zh:祝日=]",
|
|
65
|
+
"[St. Tib's Day=]", # 02-29 St. Tib's Day
|
|
66
|
+
"[Mungday= ]", # 01-05 Chaos 5
|
|
67
|
+
"[Chaoflux= ]", # 02-19 Chaos 50
|
|
68
|
+
"[Mojoday= ]", # 03-19 Discord 5
|
|
69
|
+
"[Discoflux= ]", # 05-03 Discord 50
|
|
70
|
+
"[Syaday= ]", # 05-31 Confusion 5
|
|
71
|
+
"[Confuflux= ]", # 07-15 Confusion 50
|
|
72
|
+
"[Zaraday= ]", # 08-12 Bureaucracy 5
|
|
73
|
+
"[Bureflux= ]", # 09-26 Bureaucracy 50
|
|
74
|
+
"[Maladay= ]", # 10-24 The Aftermath 5
|
|
75
|
+
"[Afflux= ]" # 12-08 The Aftermath 50
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
"[Common_Week=]"
|
|
79
|
+
]
|
|
80
|
+
]]
|
|
81
|
+
|
|
82
|
+
# @private
|
|
83
|
+
IndexOfWeek = [0, 1, 2, 3, 5, 4]
|
|
84
|
+
|
|
85
|
+
# Just or last sweetmorn
|
|
86
|
+
#
|
|
87
|
+
# @param [When::TM::TemporalPosition] date
|
|
88
|
+
# @param [nil] parameter (not used)
|
|
89
|
+
#
|
|
90
|
+
# @return [When::TM::TemporalPosition]
|
|
91
|
+
#
|
|
92
|
+
def sweetmorn(date, parameter=nil)
|
|
93
|
+
date = _to_date_for_note(date)
|
|
94
|
+
y,m,d = date.cal_date
|
|
95
|
+
date -= When::P1D if date.length(When::MONTH) == 74 && +d == 60
|
|
96
|
+
dow = ((m-1)*73+d*1-1) % 5
|
|
97
|
+
date -= When::P1D * dow unless dow == 0
|
|
98
|
+
date.events = [@days_of_week[0]]
|
|
99
|
+
date
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Erisian week
|
|
103
|
+
#
|
|
104
|
+
# @param [When::TM::CalDate] date
|
|
105
|
+
# @param [When::TM::CalDate] base
|
|
106
|
+
#
|
|
107
|
+
# @return [String]
|
|
108
|
+
#
|
|
109
|
+
def week(date, base=nil)
|
|
110
|
+
date = _to_date_for_note(date)
|
|
111
|
+
y,m,d = date.cal_date
|
|
112
|
+
dow = d*0 == 0 ? ((m-1)*73+d*1-1) % 5 : 5
|
|
113
|
+
length = (base || date).length(When::MONTH) == 73 ? 5 : 6
|
|
114
|
+
index = length == 5 ? dow : IndexOfWeek[dow]
|
|
115
|
+
{:value=>@days_of_week[dow], :position=>[index,length]}
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
#
|
|
119
|
+
# Week labels
|
|
120
|
+
#
|
|
121
|
+
# @param [When::TM::TemporalPosition] date
|
|
122
|
+
#
|
|
123
|
+
# @return [Array<When::CalendarNote::Week::DayOfWeek>]
|
|
124
|
+
#
|
|
125
|
+
def week_labels(date)
|
|
126
|
+
date = _to_date_for_note(date)
|
|
127
|
+
date.length(When::MONTH) == 73 ?
|
|
128
|
+
@days_of_week.child[0...5] :
|
|
129
|
+
@days_of_week.child[0...4] + [@days_of_week.child[5]] + [@days_of_week.child[4]]
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Holyday
|
|
133
|
+
#
|
|
134
|
+
# @param [When::TM::CalDate] date
|
|
135
|
+
#
|
|
136
|
+
# @return [String]
|
|
137
|
+
#
|
|
138
|
+
def holyday(date)
|
|
139
|
+
date = _to_date_for_note(date)
|
|
140
|
+
y, m, d = date.cal_date
|
|
141
|
+
index =
|
|
142
|
+
case +d
|
|
143
|
+
when 5 ; 1
|
|
144
|
+
when 50 ; 2
|
|
145
|
+
else ; d * 0 - 1
|
|
146
|
+
end
|
|
147
|
+
return nil if index == -1
|
|
148
|
+
When.CalendarNote('DiscordianWeek/Notes::day::Holyday::*')[(m-1)*2+index]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
#
|
|
152
|
+
# convert date to Discordian date
|
|
153
|
+
#
|
|
154
|
+
# @private
|
|
155
|
+
def _to_date_for_note(date)
|
|
156
|
+
date = When::Discordian ^ date unless date.frame.label.to_s == 'Discordian'
|
|
157
|
+
date
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
# object normalization
|
|
163
|
+
#
|
|
164
|
+
# @private
|
|
165
|
+
def _normalize(args=[], options={})
|
|
166
|
+
@event ||= 'sweetmorn'
|
|
167
|
+
super
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
module CalendarTypes
|
|
172
|
+
|
|
173
|
+
#
|
|
174
|
+
# Discordian Calendar
|
|
175
|
+
#
|
|
176
|
+
class Discordian < SolarYearTableBased
|
|
177
|
+
|
|
178
|
+
# @private
|
|
179
|
+
Normal_IDS = (1..73).to_a
|
|
180
|
+
|
|
181
|
+
# @private
|
|
182
|
+
Long_IDS = (1..59).to_a + [When.Pair(59,1)] + (60..73).to_a
|
|
183
|
+
|
|
184
|
+
private
|
|
185
|
+
|
|
186
|
+
#
|
|
187
|
+
# Object Normalization
|
|
188
|
+
#
|
|
189
|
+
def _normalize(args=[], options={})
|
|
190
|
+
@label ||= 'Discordian'
|
|
191
|
+
@indices ||= [
|
|
192
|
+
When.Index('DiscordianWeekNotes::month::Month', {:unit =>5}),
|
|
193
|
+
When.Index({:branch=>{1=>When.M17n('Discordian::IntercalaryDay')[0]}})
|
|
194
|
+
]
|
|
195
|
+
@origin_of_MSC ||= +1166
|
|
196
|
+
@diff_to_CE ||= 0
|
|
197
|
+
@note ||= 'DiscordianWeek'
|
|
198
|
+
@rule_table ||= {
|
|
199
|
+
365 => {'Length'=> [73]*5},
|
|
200
|
+
366 => {'Length'=> [74] + [73]*4}
|
|
201
|
+
}
|
|
202
|
+
super
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
#
|
|
206
|
+
# day arrangement pattern
|
|
207
|
+
#
|
|
208
|
+
def _ids_(date)
|
|
209
|
+
y, m = date
|
|
210
|
+
case m
|
|
211
|
+
when nil ; super
|
|
212
|
+
when 0 ; @engine._length([+y, 1]) == 28 ? Normal_IDS : Long_IDS
|
|
213
|
+
else ; Normal_IDS
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|