(.require [library [lux (.except) ["_" test (.only Test)] ["[0]" meta] [control ["[0]" try] ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]] [format ["md" markdown]]] ["[0]" macro (.only) [syntax (.only syntax)] ["[0]" template] ["[0]" code (.only) ["<[1]>" \\parser]]]]] [\\library ["[0]" /]]) (def macro_error (syntax (_ [macro .any]) (function (_ compiler) {try.#Success [compiler (list (code.bit (case ((macro.expansion macro) compiler) {try.#Failure error} true {try.#Success _} false)))]}))) (def description (syntax (_ []) (at meta.monad each (|>> %.nat code.text list) meta.seed))) (template.with_locals [g!default] (with_expansions ['definition_description' (..description) 'sub_description' (..description) 'super_description' (..description)] (these (def .public g!default Nat 123) (def documentation (/.documentation /.documentation 'definition_description')) (def .public test Test (<| (_.covering /._) (all _.and (_.for [/.Definition] (all _.and (_.coverage [/.default] (case (`` (/.default (~~ (template.symbol [.._] [g!default])))) (pattern (list definition)) (and (|> definition (the /.#definition) (text#= (template.text [g!default]))) (|> definition (the /.#documentation) md.markdown (text#= "") not)) _ false)) (_.coverage [/.documentation] (case ..documentation (pattern (list documentation)) (and (|> documentation (the /.#definition) (text#= (template.text [/.documentation]))) (|> documentation (the /.#documentation) md.markdown (text.contains? 'definition_description'))) _ false)) )) (_.for [/.Module] (all _.and (_.coverage [/.module /.markdown] (let [sub (`` (/.module /._ (~~ (template.text ['sub_description'])) [] [])) super (`` (/.module .._ (~~ (template.text ['super_description'])) [..documentation] [sub]))] (and (text.contains? (template.text ['sub_description']) (/.markdown sub)) (text.contains? (/.markdown sub) (/.markdown super)) (text.contains? (template.text ['super_description']) (/.markdown super)) (case ..documentation (pattern (list documentation)) (text.contains? (md.markdown (the /.#documentation documentation)) (/.markdown super)) _ false)))) )) (_.coverage [/.unqualified_symbol] (`` (and (~~ (with_template [] [(macro_error )] [(/.default g!default)] [(/.documentation g!default (~~ (template.text ['definition_description'])))] [(/.module g!default "" [..documentation] [sub])] ))))) ))))) )