From 60430ee6dfffbeb220a3e8fee7336d54313467bc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 5 Feb 2019 20:30:13 -0400 Subject: Folded license-making program (legislator) into the Lux project proper (as licentia). --- stdlib/source/program/licentia/document.lux | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 stdlib/source/program/licentia/document.lux (limited to 'stdlib/source/program/licentia/document.lux') diff --git a/stdlib/source/program/licentia/document.lux b/stdlib/source/program/licentia/document.lux new file mode 100644 index 000000000..bb128807b --- /dev/null +++ b/stdlib/source/program/licentia/document.lux @@ -0,0 +1,47 @@ +(.module: + [lux (#- or and) + [data + ["." text + format] + [collection + [list ("list/." functor)]]]]) + +(def: #export (quote text) + (-> Text Text) + (format text.double-quote text text.double-quote)) + +(def: #export (block content) + (-> Text Text) + (format content text.new-line text.new-line)) + +(def: #export (plural singular) + (-> Text Text) + (format singular "(s)")) + +(def: #export (sentence content) + (-> Text Text) + (format content ".")) + +(def: #export paragraph + (-> (List Text) Text) + (|>> (list/map ..sentence) + (text.join-with text.new-line))) + +(do-template [ ] + [(def: #export + (-> (List Text) Text) + (text.join-with (format ", " " ")))] + + [or "or"] + [and "and"] + [and/or "and/or"] + ) + +(type: #export Section + {#title Text + #content Text}) + +(def: #export (section value) + (-> Section Text) + (format (block (get@ #title value)) + (get@ #content value))) -- cgit v1.2.3