(.require [library [lux (.except Definition) [control ["[0]" maybe (.use "[1]#[0]" functor)]] [data ["[0]" bit] ["[0]" text ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor monoid)]]]]] [// ["[0]" license (.only Identification Termination Liability Distribution Commercial Extension Entity Black_List URL Attribution License) ["[0]" copyright] ["[0]" definition (.only Definition)] ["[0]" grant] ["[0]" limitation] ["[0]" assurance] ["[0]" liability] ["[0]" distribution] ["[0]" commercial] ["[0]" extension] ["[0]" submission] ["[0]" miscellaneous] ["[0]" black_list] ["[0]" notice] ["_" term] ["[0]" addendum]] ["$" document]]) (def .public (definition value) (-> Definition Text) (format ($.quote (the definition.#term value)) ": " (the definition.#meaning value))) (def .public (identification value) (-> Identification Text) (format (the license.#name value) text.new_line (the license.#version value))) (def .public (grant termination) (-> Termination Text) (`` (format (,, (with_template [ <content>] [($.block ($.section [#$.title <title> #$.content <content>]))] ["Grant of Copyright License" grant.copyright] ["Grant of Patent License" (grant.patent (the license.#patent_retaliation? termination))] ["Effective Date for the Grants" grant.date] ["Grant Termination" (grant.termination (the license.#termination_period termination) (the license.#grace_period termination))] ["No Retroactive Effect of Termination" grant.no_retroactive_termination]))))) (def .public limitation Text (`` (format (,, (with_template [<title> <content>] [($.block ($.section [#$.title <title> #$.content <content>]))] ["Limitations on Grant Scope" limitation.grant] ["Limitations on Trademarks" limitation.trademark] [(format "Limitations on " ($.plural _.secondary_license)) limitation.secondary_licenses]))))) (def .public assurance Text (`` (format (,, (with_template [<title> <content>] [($.block ($.section [#$.title <title> #$.content <content>]))] ["Representation" assurance.representation] ["Fair Use" assurance.fair_use]))))) (def .public (liability value) (-> Liability Text) (`` (format (,, (with_template [<title> <condition> <content>] [(if <condition> ($.block ($.section [#$.title <title> #$.content <content>])) "")] ["Disclaimer of Warranty" bit.on liability.warranty] ["Limitation of Liability" bit.on liability.limitation] ["Litigation" bit.on liability.litigation] ["Accepting Warranty or Additional Liability" (the license.#can_accept? value) liability.can_accept] ["High Risk Activities" (the license.#disclaim_high_risk? value) liability.disclaim_high_risk]))))) (def .public (distribution distribution) (-> Distribution Text) (`` (format (,, (with_template [<title> <condition> <content>] [(if <condition> ($.block ($.section [#$.title <title> #$.content <content>])) "")] [(format "Distribution of a " _.source_code_form) bit.on distribution.source_code_form] [(format "Distribution of an " _.object_form) bit.on distribution.object_form] [(format "Distribution of an " _.extension) (or (the license.#can_re_license? distribution) (the license.#can_multi_license? distribution)) (distribution.extension distribution)]))))) (def .public (commercial value) (-> Commercial Text) (`` (format (,, (with_template [<title> <condition> <content>] [(if <condition> ($.block ($.section [#$.title <title> #$.content <content>])) "")] ["Non-Commerciality" (not (the license.#can_sell? value)) commercial.cannot_sell] [(format _.contributor " Attribution") (the license.#require_contributor_credit? value) commercial.require_contributor_attribution] [(format _.contributor " Endorsement") (not (the license.#allow_contributor_endorsement? value)) commercial.disallow_contributor_endorsement] ))))) (def .public (extension value) (-> Extension Text) (let [[show? document] (case (the license.#notification_period value) {.#Some period} [true (extension.notification_requirement period)] {.#None} [false ""])] (`` (format (,, (with_template [<condition> <title> <content>] [(if <condition> ($.block ($.section [#$.title <title> #$.content <content>])) "")] [(the license.#same_license? value) "License Retention" ($.paragraph (list#composite extension.sharing_requirement extension.license_conflict_resolution))] [(the license.#must_be_distinguishable? value) (format _.extension " Distinctness") extension.distinctness_requirement] [show? (format _.source_code_form " Availability") document] [(the license.#must_describe_modifications? value) (format "Description of " ($.plural _.modification)) extension.description_requirement])))))) (def .public (attribution value) (-> Attribution Text) (let [copyright_notice (format "Attribution Copyright Notice: " (the license.#copyright_notice value)) phrase (case (the license.#phrase value) {.#Some phrase} (format text.new_line "Attribution Phrase: " phrase text.new_line) {.#None} "") url (format text.new_line "Attribution URL: " (the license.#url value)) image (case (the license.#image value) {.#Some image} (format text.new_line "Attribution Image: " image) {.#None} "")] (format copyright_notice phrase url image))) (def .public (miscellaneous identified?) (-> Bit Text) (`` (format (,, (with_template [<title> <condition> <content>] [(if <condition> ($.block ($.section [#$.title <title> #$.content <content>])) "")] ["Entire Agreement" bit.on miscellaneous.entire_agreement] ["Relationship of Parties" bit.on miscellaneous.relationship_of_parties] ["Independent Development" bit.on miscellaneous.independent_development] ["Consent To Breach Not Waiver" bit.on miscellaneous.not_waiver] ["Severability" bit.on miscellaneous.severability] ["Export Restrictions" bit.on miscellaneous.export_restrictions] [(format "Versions of " _.license) identified? miscellaneous.new_versions] ))))) (def black_list_spacing (format text.new_line text.new_line)) (def .public (license value) (-> License Text) (let [identification (|> value (the license.#identification) (maybe#each ..identification) (maybe.default "")) identified? (case (the license.#identification value) {.#Some _} true {.#None} false)] (`` (format ($.block identification) ($.block (notice.copyright (the license.#copyright_holders value))) (case (the license.#black_lists value) {.#End} "" black_lists ($.block ($.section [#$.title (format "Denial of " _.license) #$.content (|> black_lists (list#each black_list.black_list) (text.interposed ..black_list_spacing))]))) ($.section [#$.title "Definitions" #$.content (|> definition.all (list#each (|>> ..definition $.block)) (text.interposed ""))]) ($.block ($.section [#$.title (format "Acceptance of " _.license) #$.content limitation.acceptance])) (..grant (the license.#termination value)) ..limitation ..assurance ($.block ($.section [#$.title (format _.submission " of " ($.plural _.contribution)) #$.content submission.contribution])) (..liability (the license.#liability value)) (..distribution (the license.#distribution value)) (..commercial (the license.#commercial value)) (..extension (the license.#extension value)) (|> value (the license.#attribution) (maybe#each (|>> ..attribution ["Attribution Information"] $.section $.block)) (maybe.default "")) (..miscellaneous identified?) (addendum.output (the license.#addendum value)) notice.end_of_license ))))