Merge pull request #14 from theRank/feature-workdays-restdays
Feature: work days and rest days
14
README.md
@ -13,15 +13,21 @@ subscription link of public holidays in mainland China
|
||||
日历 - 添加日历 - 添加订阅日历 - 输入链接
|
||||
「 [https://ics.github.rank.technology](https://ics.github.rank.technology) 」
|
||||
|
||||
![iOS](./docs/readme/ios.jpeg)
|
||||
![iOS](./docs/readme/ios.png)
|
||||
|
||||
### MacOs
|
||||
### macOs
|
||||
|
||||
日历 - 文件 - 新建日历订阅 - 输入链接
|
||||
「 [https://ics.github.rank.technology](https://ics.github.rank.technology) 」
|
||||
|
||||
![MacOs](./docs/readme/macos.png)
|
||||
|
||||
### 订阅成功
|
||||
## 为补班添加不同的颜色
|
||||
|
||||
![subscribed](./docs/readme/overview.png)
|
||||
分别订阅
|
||||
- 假期:「 [https://ics.github.rank.technology/rest.ics](https://ics.github.rank.technology/rest.ics) 」
|
||||
- 补班:「 [https://ics.github.rank.technology/work.ics](https://ics.github.rank.technology/work.ics) 」
|
||||
|
||||
给他们分配不同的颜色吧~
|
||||
|
||||
![overview](./docs/readme/overview.png)
|
||||
|
@ -1,3 +1,6 @@
|
||||
文件格式
|
||||
年份开头,形如 2022.txt
|
||||
|
||||
数据格式
|
||||
节日名;放假日期;补班日期
|
||||
没有补班留空,“;”不可省略
|
||||
|
Before Width: | Height: | Size: 907 KiB After Width: | Height: | Size: 1006 KiB |
Before Width: | Height: | Size: 988 KiB |
BIN
docs/readme/ios.png
Normal file
After Width: | Height: | Size: 6.3 MiB |
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 243 KiB |
Before Width: | Height: | Size: 520 KiB After Width: | Height: | Size: 555 KiB |
442
docs/rest.ics
Normal file
@ -0,0 +1,442 @@
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Rank Technology//Chinese Holidays//EN
|
||||
X-WR-CALNAME:节假日(假期)
|
||||
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:cb1c44b6-ebda-4f41-8314-8fd0db3b53b6
|
||||
DTSTART;VALUE=DATE:20210101
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:8ee6d498-6a9a-4627-86e7-3d639e4f0571
|
||||
DTSTART;VALUE=DATE:20210102
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:94f6931c-eec5-4064-a711-730949c899bc
|
||||
DTSTART;VALUE=DATE:20210103
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:c4af585d-556a-40e5-90c9-14534a739524
|
||||
DTSTART;VALUE=DATE:20210211
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第1天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:3588c348-326e-4aff-8688-3513aac091ef
|
||||
DTSTART;VALUE=DATE:20210212
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第2天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:088d8d3b-2daa-4965-96d1-03b5f526d9a5
|
||||
DTSTART;VALUE=DATE:20210213
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第3天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:244f0033-7123-40a0-b31a-eef1189945a4
|
||||
DTSTART;VALUE=DATE:20210214
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第4天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:250be12e-2667-4648-97c2-68635cb9c8dd
|
||||
DTSTART;VALUE=DATE:20210215
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第5天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e966f0e3-045b-424e-9cb1-3e0a5d3342b5
|
||||
DTSTART;VALUE=DATE:20210216
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第6天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:6fddc624-f69e-4e0b-8e36-79faa0696f2e
|
||||
DTSTART;VALUE=DATE:20210217
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第7天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:3b0dd0da-5a03-44dd-8dbb-61b44fcd31a0
|
||||
DTSTART;VALUE=DATE:20210403
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:2c43d942-5bf5-4f38-923f-4df4a7b74e5c
|
||||
DTSTART;VALUE=DATE:20210404
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:55f2a06b-37c7-4bd5-926c-9d86536927eb
|
||||
DTSTART;VALUE=DATE:20210405
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:3a77cd3a-8afd-4d46-b9bb-9e610a469ef0
|
||||
DTSTART;VALUE=DATE:20210501
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第1天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:fee39cc9-fa7f-4527-870e-78e7ba08e10c
|
||||
DTSTART;VALUE=DATE:20210502
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第2天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:16fd8cb9-3fa1-49c4-9589-d042a3b26706
|
||||
DTSTART;VALUE=DATE:20210503
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第3天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:fda7ea4e-3872-41e4-91c9-9776f9ee77b1
|
||||
DTSTART;VALUE=DATE:20210504
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第4天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:eeea89c5-5184-43f6-9561-94c5e0e6eecd
|
||||
DTSTART;VALUE=DATE:20210505
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第5天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:760dcb26-5054-4161-bdd1-5100108da94b
|
||||
DTSTART;VALUE=DATE:20210612
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:186b2b95-2f6a-4f4b-8727-057c4b31d101
|
||||
DTSTART;VALUE=DATE:20210613
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:f36b8b90-78bc-4d93-b670-3638aa9fe8cb
|
||||
DTSTART;VALUE=DATE:20210614
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:18d47ae6-ae6f-4527-8883-dd93267c1505
|
||||
DTSTART;VALUE=DATE:20210919
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:65dc783f-6ff0-48ed-a717-498a5d50e6c6
|
||||
DTSTART;VALUE=DATE:20210920
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:1e8d7cee-53e2-4d62-8358-fc6156108f33
|
||||
DTSTART;VALUE=DATE:20210921
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:7e286212-30e8-403e-bf11-19b718622a7f
|
||||
DTSTART;VALUE=DATE:20211001
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第1天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:89b40db3-58da-43a1-946b-e71c11a1813b
|
||||
DTSTART;VALUE=DATE:20211002
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第2天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:07dd75b1-8bd2-42e5-8b2f-bb4a13759e60
|
||||
DTSTART;VALUE=DATE:20211003
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第3天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:7874d291-ff94-4d87-adee-051430a9701b
|
||||
DTSTART;VALUE=DATE:20211004
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第4天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:ffaef558-36ad-4418-91ce-bcdb5c3cc44d
|
||||
DTSTART;VALUE=DATE:20211005
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第5天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:f4deeafb-a02b-40bf-ba2c-984f56b2e0be
|
||||
DTSTART;VALUE=DATE:20211006
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第6天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:73d4aebf-8b8f-409c-a649-020585e6d3ff
|
||||
DTSTART;VALUE=DATE:20211007
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第7天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e2fd19db-8171-456b-80a8-c320d8668c93
|
||||
DTSTART;VALUE=DATE:20220101
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:fb349f29-4a80-442c-85e5-2f52112cb933
|
||||
DTSTART;VALUE=DATE:20220102
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:db35b44f-e3a9-4d1f-8208-c650e4898749
|
||||
DTSTART;VALUE=DATE:20220103
|
||||
SUMMARY:元旦假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:acbe5998-888b-4e78-8d65-4be5a5cc29f0
|
||||
DTSTART;VALUE=DATE:20220131
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第1天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:8c86c6d5-d865-48d8-9a4d-d76584eb582b
|
||||
DTSTART;VALUE=DATE:20220201
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第2天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:84dcc64f-9bfd-4b25-9501-821a61909791
|
||||
DTSTART;VALUE=DATE:20220202
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第3天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:43d1c284-ca64-4545-b244-5eaa08304aa0
|
||||
DTSTART;VALUE=DATE:20220203
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第4天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:efdad81d-942a-4547-934e-b550cf46a563
|
||||
DTSTART;VALUE=DATE:20220204
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第5天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:ea1e2a06-005a-47b0-b3f8-d253c322b650
|
||||
DTSTART;VALUE=DATE:20220205
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第6天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:cc4df195-7070-4449-8a43-631488aa586f
|
||||
DTSTART;VALUE=DATE:20220206
|
||||
SUMMARY:春节假期
|
||||
DESCRIPTION:假期 第7天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:79b89604-4f62-4a5e-827b-380d626e659b
|
||||
DTSTART;VALUE=DATE:20220403
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:a8c70af3-fa56-43a8-81fd-1e5d7c28463f
|
||||
DTSTART;VALUE=DATE:20220404
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:64e993d3-ab65-46f3-a257-1da8b92f69cd
|
||||
DTSTART;VALUE=DATE:20220405
|
||||
SUMMARY:清明节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:08e8c8d8-94c5-40a3-b931-0cad312fa90d
|
||||
DTSTART;VALUE=DATE:20220430
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第1天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:b5c44f8b-4cae-4c8f-8206-401ca081420c
|
||||
DTSTART;VALUE=DATE:20220501
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第2天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:2d31fc3c-c027-4d5b-ba67-36a6f7e9f120
|
||||
DTSTART;VALUE=DATE:20220502
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第3天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:1265dcf3-1427-41a0-b0c7-8f5f4f0c1305
|
||||
DTSTART;VALUE=DATE:20220503
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第4天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:bd41c984-fdb3-4092-9792-7d364a3a19f4
|
||||
DTSTART;VALUE=DATE:20220504
|
||||
SUMMARY:劳动节假期
|
||||
DESCRIPTION:假期 第5天/共5天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:2ad6b093-3d1b-4930-854b-5cc9bbe213a1
|
||||
DTSTART;VALUE=DATE:20220603
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:82aa0716-f170-4060-a472-d01b2e236494
|
||||
DTSTART;VALUE=DATE:20220604
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:b70364da-05cf-4cc6-a8a2-e8dd86bf6b80
|
||||
DTSTART;VALUE=DATE:20220605
|
||||
SUMMARY:端午节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:2de03106-8cbb-47bc-800b-9b43865c6f56
|
||||
DTSTART;VALUE=DATE:20220910
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第1天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:50a74cc1-cace-40b9-98e4-8986911d7141
|
||||
DTSTART;VALUE=DATE:20220911
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第2天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e0a3f10e-bc01-4ba5-bf84-3c4232a89125
|
||||
DTSTART;VALUE=DATE:20220912
|
||||
SUMMARY:中秋节假期
|
||||
DESCRIPTION:假期 第3天/共3天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:8591f1ad-752b-45b8-8b9f-8d0bc09e4e8a
|
||||
DTSTART;VALUE=DATE:20221001
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第1天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e3d6951e-d133-40ff-9b95-4c462f42b5fc
|
||||
DTSTART;VALUE=DATE:20221002
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第2天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:289cb34a-1797-48f8-b24d-8d5da1bce443
|
||||
DTSTART;VALUE=DATE:20221003
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第3天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:bb026917-2df8-41eb-a352-3be3590f7862
|
||||
DTSTART;VALUE=DATE:20221004
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第4天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:656c0c14-fca6-4bb2-9671-8081b138def0
|
||||
DTSTART;VALUE=DATE:20221005
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第5天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:f618406a-db02-47c4-8786-cfe38eaedf5d
|
||||
DTSTART;VALUE=DATE:20221006
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第6天/共7天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:dab06a42-0100-4842-b8a1-5709ce49a10e
|
||||
DTSTART;VALUE=DATE:20221007
|
||||
SUMMARY:国庆节假期
|
||||
DESCRIPTION:假期 第7天/共7天
|
||||
END:VEVENT
|
||||
|
||||
|
||||
END:VCALENDAR
|
106
docs/work.ics
Normal file
@ -0,0 +1,106 @@
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Rank Technology//Chinese Holidays//EN
|
||||
X-WR-CALNAME:节假日(补班)
|
||||
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:63b0ed55-24d8-423f-bbf8-98cfab2ddc4e
|
||||
DTSTART;VALUE=DATE:20210207
|
||||
SUMMARY:春节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e4165ccc-14a7-49e9-80de-c9efd90de4e2
|
||||
DTSTART;VALUE=DATE:20210220
|
||||
SUMMARY:春节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:72cc510c-57c3-457d-85d8-2cdd04ab5086
|
||||
DTSTART;VALUE=DATE:20210425
|
||||
SUMMARY:劳动节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:122871c3-6c12-44f3-b9eb-740e5efdfb5f
|
||||
DTSTART;VALUE=DATE:20210508
|
||||
SUMMARY:劳动节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:c19c48e3-c2fd-4f8c-9bcd-b2c9850293db
|
||||
DTSTART;VALUE=DATE:20210918
|
||||
SUMMARY:中秋节补班
|
||||
DESCRIPTION:补班 第1天/共1天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:3b479ad4-35f9-47e6-920d-53f3b51005c7
|
||||
DTSTART;VALUE=DATE:20210926
|
||||
SUMMARY:国庆节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:781c09fc-5e8b-4464-aa02-eb799ee5613b
|
||||
DTSTART;VALUE=DATE:20211009
|
||||
SUMMARY:国庆节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:9d2b8eb5-09e3-48c9-b25d-c5eebdad6964
|
||||
DTSTART;VALUE=DATE:20220129
|
||||
SUMMARY:春节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:ff76606f-bf58-4b1b-83ce-63645f427063
|
||||
DTSTART;VALUE=DATE:20220130
|
||||
SUMMARY:春节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:2dbd9c1b-4f64-47c5-b64f-1e0c1863157f
|
||||
DTSTART;VALUE=DATE:20220402
|
||||
SUMMARY:清明节补班
|
||||
DESCRIPTION:补班 第1天/共1天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:12afb3aa-32c9-41a3-bb22-c69179cebf49
|
||||
DTSTART;VALUE=DATE:20220424
|
||||
SUMMARY:劳动节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:b6adb201-5bda-4cc7-b1db-cd64d515936d
|
||||
DTSTART;VALUE=DATE:20220507
|
||||
SUMMARY:劳动节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:d63f74a3-236c-4ad3-a333-cc3a86008d8a
|
||||
DTSTART;VALUE=DATE:20221008
|
||||
SUMMARY:国庆节补班
|
||||
DESCRIPTION:补班 第1天/共2天
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
UID:e5625a90-dcef-42e3-8c6c-33670431e32b
|
||||
DTSTART;VALUE=DATE:20221009
|
||||
SUMMARY:国庆节补班
|
||||
DESCRIPTION:补班 第2天/共2天
|
||||
END:VEVENT
|
||||
|
||||
|
||||
END:VCALENDAR
|
9
main.go
@ -6,10 +6,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
holidays := core.Data().ReadFrom(base.SourceDir).Parse().Sort().Get()
|
||||
holidays := core.Data().Read(`^20\d\d`).From("data").Parse().Sort().Get()
|
||||
|
||||
holidays.Print("==== HOLIDAYS ====")
|
||||
|
||||
core.Data(holidays).WriteTo(base.IndexPage).Format(base.ICS).Set()
|
||||
core.Data(holidays).WriteTo(base.HolidayICS).Format(base.ICS).Set()
|
||||
core.Data(holidays).Write("index.html").To("docs").Title("节假日").Set()
|
||||
core.Data(holidays).Write("holiday.ics").To("docs").Title("节假日").Set()
|
||||
|
||||
core.Data(holidays.Select(base.Rest)).Write("rest.ics").To("docs").Title("节假日(假期)").Set()
|
||||
core.Data(holidays.Select(base.Work)).Write("work.ics").To("docs").Title("节假日(补班)").Set()
|
||||
}
|
||||
|
@ -5,12 +5,6 @@ const (
|
||||
Work // 补班
|
||||
)
|
||||
|
||||
const (
|
||||
SourceDir = "./data/" // 源文件目录
|
||||
IndexPage = "./docs/index.html" // 默认页
|
||||
HolidayICS = "./docs/holiday.ics" // ICS 日历
|
||||
)
|
||||
|
||||
const (
|
||||
ICS = "ics" // .ics 文件
|
||||
)
|
||||
|
@ -15,6 +15,15 @@ type Holiday struct {
|
||||
Total int
|
||||
}
|
||||
|
||||
func (h Holidays) Where(filter func(Holiday) bool) (result Holidays) {
|
||||
for _, item := range h {
|
||||
if filter(item) {
|
||||
result = append(result, item)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (h Holidays) Len() int { return len(h) }
|
||||
func (h Holidays) Less(i, j int) bool { return h[i].Date.Before(h[j].Date) }
|
||||
func (h Holidays) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
|
||||
|
@ -2,6 +2,16 @@ package base
|
||||
|
||||
import "fmt"
|
||||
|
||||
func selectType(t int) func(Holiday) bool {
|
||||
return func(holidays Holiday) bool {
|
||||
return holidays.Type == t
|
||||
}
|
||||
}
|
||||
|
||||
func (h Holidays) Select(t int) Holidays {
|
||||
return h.Where(selectType(t))
|
||||
}
|
||||
|
||||
func (h Holidays) Print(titles ...string) (result string) {
|
||||
for _, title := range titles {
|
||||
fmt.Println(title)
|
||||
|
@ -2,33 +2,72 @@ package core
|
||||
|
||||
import (
|
||||
"main/parse/base"
|
||||
"main/parse/data"
|
||||
"main/parse/data/input"
|
||||
"main/parse/data/output"
|
||||
"main/parse/data/read"
|
||||
"main/parse/data/write"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func Data(optional ...base.Holidays) Handler {
|
||||
return newHandler(optional...)
|
||||
func newHandler(optional ...base.Holidays) Handler {
|
||||
if len(optional) == 0 {
|
||||
return handler{}
|
||||
}
|
||||
return handler{data: optional[0]}
|
||||
}
|
||||
|
||||
type Handler interface {
|
||||
ReadFrom(directory string) Parser
|
||||
WriteTo(file string) Formatter
|
||||
type handler struct {
|
||||
data base.Holidays
|
||||
|
||||
reader data.Reader
|
||||
writer data.Writer
|
||||
filename string
|
||||
|
||||
input data.Input
|
||||
output data.Output
|
||||
}
|
||||
|
||||
type Parser interface {
|
||||
Parse() Sorter
|
||||
func (h handler) Read(filename string) setDirIn {
|
||||
h.filename = filename
|
||||
return h
|
||||
}
|
||||
|
||||
type Sorter interface {
|
||||
Sort() Getter
|
||||
func (h handler) From(directory string) readData {
|
||||
h.reader = read.NewReader(directory, h.filename)
|
||||
return h
|
||||
}
|
||||
|
||||
type Formatter interface {
|
||||
Format(format string) Setter
|
||||
func (h handler) Parse() getData {
|
||||
h.input = h.reader.Read()
|
||||
h.data = input.NewParser().Parse(h.input)
|
||||
return h
|
||||
}
|
||||
|
||||
type Getter interface {
|
||||
Get() base.Holidays
|
||||
func (h handler) Sort() getData {
|
||||
sort.Sort(h.data)
|
||||
return h
|
||||
}
|
||||
|
||||
type Setter interface {
|
||||
Set()
|
||||
func (h handler) Write(filename string) setDirOut {
|
||||
h.filename = filename
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) To(directory string) setTitle {
|
||||
h.writer = write.NewWriter(directory, h.filename)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Title(name string) writeData {
|
||||
h.output = output.NewFormatter(name).Format(h.data)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Get() base.Holidays {
|
||||
return h.data
|
||||
}
|
||||
|
||||
func (h handler) Set() {
|
||||
h.writer.Write(h.output)
|
||||
}
|
||||
|
37
parse/core/flow.go
Normal file
@ -0,0 +1,37 @@
|
||||
package core
|
||||
|
||||
import "main/parse/base"
|
||||
|
||||
func Data(optional ...base.Holidays) Handler {
|
||||
return newHandler(optional...)
|
||||
}
|
||||
|
||||
type Handler interface {
|
||||
Read(filename string) setDirIn
|
||||
Write(filename string) setDirOut
|
||||
}
|
||||
|
||||
type setDirIn interface {
|
||||
From(directory string) readData
|
||||
}
|
||||
|
||||
type readData interface {
|
||||
Parse() getData
|
||||
}
|
||||
|
||||
type getData interface {
|
||||
Sort() getData
|
||||
Get() base.Holidays
|
||||
}
|
||||
|
||||
type setDirOut interface {
|
||||
To(directory string) setTitle
|
||||
}
|
||||
|
||||
type setTitle interface {
|
||||
Title(name string) writeData
|
||||
}
|
||||
|
||||
type writeData interface {
|
||||
Set()
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"main/parse/base"
|
||||
"main/parse/data"
|
||||
"main/parse/data/input"
|
||||
"main/parse/data/output"
|
||||
"main/parse/data/read"
|
||||
"main/parse/data/write"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func newHandler(optional ...base.Holidays) Handler {
|
||||
if len(optional) == 0 {
|
||||
return handler{}
|
||||
}
|
||||
return handler{data: optional[0]}
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
data base.Holidays
|
||||
|
||||
reader data.Reader
|
||||
writer data.Writer
|
||||
|
||||
input data.Input
|
||||
output data.Output
|
||||
}
|
||||
|
||||
func (h handler) ReadFrom(directory string) Parser {
|
||||
h.reader = read.NewReader(directory)
|
||||
h.input = h.reader.Read()
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Parse() Sorter {
|
||||
h.data = input.NewParser().Parse(h.input)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Sort() Getter {
|
||||
sort.Sort(h.data)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) WriteTo(file string) Formatter {
|
||||
h.writer = write.NewWriter(file)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Format(format string) Setter {
|
||||
h.output = output.NewFormatter(format).Format(h.data)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h handler) Get() base.Holidays {
|
||||
return h.data
|
||||
}
|
||||
|
||||
func (h handler) Set() {
|
||||
h.writer.Write(h.output)
|
||||
}
|
@ -25,7 +25,7 @@ func parse(raw data.InputRaw) (result base.Holidays, err error) {
|
||||
dayCount := make(map[string]map[int]int)
|
||||
|
||||
for group, holiday := range raw.Data {
|
||||
groupName := fmt.Sprintf("%04d%02d", raw.Year, group)
|
||||
groupName := fmt.Sprintf("%04d%02d", raw.Year, group+1)
|
||||
dayCount[groupName] = make(map[int]int)
|
||||
info := strings.Split(holiday, ";")
|
||||
|
||||
|
@ -9,15 +9,15 @@ import (
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
func NewFormatter(format string) data.Formatter {
|
||||
return formatterICS{"节假日"}
|
||||
func NewFormatter(name string) data.Formatter {
|
||||
return formatter{name}
|
||||
}
|
||||
|
||||
type formatterICS struct{
|
||||
type formatter struct {
|
||||
name string
|
||||
}
|
||||
|
||||
func (f formatterICS) Format(info base.Holidays) (result data.Output) {
|
||||
func (f formatter) Format(info base.Holidays) (result data.Output) {
|
||||
result.Prefix = fmt.Sprintf(IcsHead, f.name)
|
||||
result.Suffix = IcsTail
|
||||
|
||||
|
@ -11,12 +11,13 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
func NewReader(dir string) data.Reader {
|
||||
return dataReader{Dir: dir}
|
||||
func NewReader(dir, file string) data.Reader {
|
||||
return dataReader{Dir: "./" + dir + "/", File: file}
|
||||
}
|
||||
|
||||
type dataReader struct {
|
||||
Dir string
|
||||
File string
|
||||
}
|
||||
|
||||
type fileInfo struct {
|
||||
@ -70,7 +71,7 @@ func (dw dataReader) fileList() (result []fileInfo) {
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if yr, err := year(file.Name()); err == nil && !file.IsDir() {
|
||||
if yr, err := year(file.Name(), dw.File); err == nil && !file.IsDir() {
|
||||
result = append(result, fileInfo{Name: file.Name(), Year: yr})
|
||||
}
|
||||
}
|
||||
@ -85,8 +86,8 @@ func (dw dataReader) load(filename string) (result string, err error) {
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
func year(filename string) (result int, err error) {
|
||||
regex := regexp.MustCompile(`^\d{4}\.txt$`)
|
||||
func year(filename, format string) (result int, err error) {
|
||||
regex := regexp.MustCompile(format)
|
||||
if !regex.MatchString(filename) {
|
||||
return 0, fmt.Errorf("%s is not a valid filename", filename)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func Test_year(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
gotResult, err := year(tt.args.filename)
|
||||
gotResult, err := year(tt.args.filename, `^\d{4}\.txt$`)
|
||||
if err == nil && err != tt.wantErr || err != nil && tt.wantErr == nil {
|
||||
t.Errorf("year() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func NewWriter(filename string) data.Writer {
|
||||
return dataWriter{File: filename}
|
||||
func NewWriter(dir, file string) data.Writer {
|
||||
return dataWriter{File: "./" + dir + "/" + file}
|
||||
}
|
||||
|
||||
type dataWriter struct {
|
||||
|