From ebfe1bbbe543299f8691e4862fbc899637ff8cfd Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 27 Jul 2022 21:46:33 -0400 Subject: New flat format for documentation fragments. --- stdlib/source/test/lux/documentation.lux | 84 +++++++++----------------------- 1 file changed, 24 insertions(+), 60 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 53296522c..ce0832ed2 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -11,6 +11,7 @@ [format ["md" markdown]]] ["[0]" meta (.only) + ["[0]" symbol] ["[0]" code (.only) ["<[1]>" \\parser]] [macro @@ -38,70 +39,37 @@ (template.with_locals [g!default] (with_expansions ['definition_description' (..description) - 'sub_description' (..description) - 'super_description' (..description)] + 'module_description' (..description)] (these (def .public g!default Nat 123) - (def definition - (/.definition /.definition - 'definition_description')) - (def .public test Test (<| (_.covering /._) + (let [module (`` (/.module .._ + (,, (template.text ['module_description'])))) + definition (`` (/.definition (,, (template.symbol [.._] [g!default])) + 'definition_description'))]) (all _.and - (_.for [/.Definition] - (_.coverage [/.definition] - (and (case (`` (/.definition (,, (template.symbol [.._] [g!default])))) - (list definition) - (and (|> definition - (the /.#definition) - (text#= (template.text [g!default]))) - (|> definition - (the /.#documentation) - md.markdown - (text#= "") - not)) - - _ - false) - (case ..definition - (list documentation) - (and (|> documentation - (the /.#definition) - (text#= (template.text [/.definition]))) - (|> documentation - (the /.#documentation) - md.markdown - (text.contains? 'definition_description'))) - - _ - false)))) - (_.for [/.Module] - (_.coverage [/.module /.markdown] - (let [sub (`` (/.module /._ - (,, (template.text ['sub_description'])) - [] - [])) - super (`` (/.module .._ - (,, (template.text ['super_description'])) - [..definition] - [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 ..definition - (list documentation) - (text.contains? (md.markdown (the /.#documentation documentation)) - (/.markdown super)) - - _ - false))))) + (_.for [/.markdown] + (all _.and + (_.for [/.Module] + (_.coverage [/.module] + (and (let [[expected _] (symbol .._)] + (text.contains? expected + (/.markdown (list module)))) + (text.contains? (template.text ['module_description']) + (/.markdown (list module)))))) + (_.for [/.Definition] + (_.coverage [/.definition] + (and (text.contains? (template.text ['definition_description']) + (/.markdown (list module + definition))) + (text.contains? (template.text [g!default]) + (/.markdown (list module + definition)))))) + )) (_.coverage [/.unqualified_symbol] (`` (and (,, (with_template [] [(macro_error )] @@ -109,10 +77,6 @@ [(/.definition g!default)] [(/.definition g!default (,, (template.text ['definition_description'])))] - [(/.module g!default - "" - [..definition] - [sub])] ))))) ))))) ) -- cgit v1.2.3