aboutsummaryrefslogtreecommitdiff
path: root/licentia/source/program/licentia/license/notice.lux
blob: 7ade12fc84c94ef0a1edacd7ccb11932e07f34a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(.module:
  [library
   [lux "*"
    [data
     ["." text
      ["%" format {"+" [format]}]]
     [collection
      ["." list ("#\." functor)]]]
    [math
     [number
      ["n" nat]]]]]
  ["." // "_"
   ["#." time]
   ["#." copyright]
   ["_" term]
   [//
    ["$" document]]])

(def: .public end_of_license
  ($.sentence "END OF TERMS AND CONDITIONS"))

(def: .public (copyright_holder holder)
  (-> //copyright.Holder Text)
  (let [(^slots [#//time.start #//time.end]) (value@ #//copyright.period holder)
        single_year? (n.= start end)
        period_section (if single_year?
                         (%.nat start)
                         (format (%.nat start) "-" (%.nat end)))]
    (format "Copyright (C) " period_section " " (value@ #//copyright.name holder))))

(def: .public copyright
  (-> (List //copyright.Holder) Text)
  (|>> (list\each ..copyright_holder)
       (text.interposed text.new_line)))