let MetadataProp = { type | [| 'derived, 'docinfo, 'docmeta |] | doc "Where will we be looking for this metadata?" | default = 'docinfo, title | String | std.string.NonEmpty | doc "Definition title in the document (replaces existing; can be HTML)", modifier | String | std.string.NonEmpty | doc "Modifier for the CSS selector (camel case preferred)", itemprop | String | std.string.NonEmpty | optional | doc "BlogPosting schema prop (see: https://schema.org/BlogPosting)", separator | String | std.string.NonEmpty | doc "Separator for multiple values" | optional, special | [| 'date, 'peer, 'keywords, 'license |] | optional | doc "Special type handling", } in let ValidMetadataField = std.contract.from_predicate (fun mps => std.is_record mps && std.record.fields mps |> std.array.all (fun field => std.string.is_match "^[a-z][a-z0-9_-]*$" field) ) in { author = { title = "Writer", modifier = "writer", itemprop = "author", special = 'peer, }, authors = { title = "Writers", modifier = "writer", itemprop = "author", special = 'peer, }, contributors = { title = "Contributors", modifier = "contributor", itemprop = "contributor", special = 'peer, }, editor = { title = "Editor", modifier = "editor", itemprop = "editor", special = 'peer, }, translator = { title = "Translator", modifier = "translator", itemprop = "translator", special = 'peer, }, version = { title = "Version", modifier = "version", itemprop = "version", }, date_created = { title = "Created", modifier = "dateCreated", itemprop = "dateCreated", special = 'date, }, date = { title = "Published", modifier = "datePublished", itemprop = "datePublished", special = 'date, }, date_amended = { title = "Amended", modifier = "dateAmended", itemprop = "datePublished", special = 'date, }, location = { title = "Location", modifier = "locationWritten", itemprop = "locationCreated", }, license = { title = "License", modifier = "license", itemprop = "license", special = 'license, }, word_count = { type = 'derived, title = "Words", modifier = "words", itemprop = "wordCount", }, time_burden = { type = 'derived, title = "Time burden", modifier = "timeBurden", itemprop = "timeRequired", }, } | { _ : MetadataProp } | ValidMetadataField #| doc "Mapping props to key is the Docutils CSS selector (which will be all lowercased & elimates Unicode) for the purpose of shaping the metadata"