aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/licentia/license/notice.lux
blob: d4df7d16669ac21a84b48e1ff68986b826f18eed (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
(.module:
  [lux #*
   [data
    [number
     ["n" nat]]
    ["." text
     ["%" format (#+ format)]]
    [collection
     ["." list ("#;." functor)]]]]
  ["." // #_
   ["#." time]
   ["#." copyright]
   ["_" term]
   [//
    ["$" document]]])

(def: #export end-of-license
  ($.sentence "END OF TERMS AND CONDITIONS"))

(def: #export (copyright-holder holder)
  (-> //copyright.Holder Text)
  (let [(^slots [#//time.start #//time.end]) (get@ #//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 " " (get@ #//copyright.name holder))))

(def: #export copyright
  (-> (List //copyright.Holder) Text)
  (|>> (list;map ..copyright-holder)
       (text.join-with text.new-line)))