Documentation
¶
Overview ¶
Package form interprets task lists in attached Markdown documents.
Index ¶
- func ApplyBulk(items []Item, targets []int, answers map[string]Answer, answer Answer)
- func CountSelected(items []Item, targets []int, answers map[string]Answer) int
- func Defaults(items []Item) map[string]Answer
- func Fingerprint(items []Item, id string) (string, error)
- func IsTextField(item Item) bool
- func RankOrder(items []Item, id string, answer Answer) (values []string, ranked bool)
- func Satisfied(item Item, answer Answer) bool
- func Selected(item Item, answer Answer) bool
- func Targets(items []Item) (map[int][]int, error)
- type Answer
- type Heading
- type InputType
- type Item
- type Span
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBulk ¶
ApplyBulk selects every target, or deselects them when all are selected. Each answer copies the provenance in answer.
func CountSelected ¶
CountSelected reports how many of the target items are selected.
func Fingerprint ¶
Fingerprint excludes source positions but includes the complete ordered group.
func IsTextField ¶
IsTextField distinguishes standalone string input from associated input.
Types ¶
type Answer ¶
type Answer struct {
Value any `json:"value"`
Human bool `json:"human"`
Author string `json:"author,omitempty"`
Revision string `json:"review_revision,omitempty"`
Round int `json:"round,omitempty"`
// Via names the select-all item whose human operation set this answer.
Via string `json:"via,omitempty"`
// Text holds the current associated input; unchecked checkbox input
// remains a draft until that checkbox is selected again.
Text string `json:"text,omitempty"`
// Drafts holds per-choice input values while another option is selected.
Drafts map[string]string `json:"drafts,omitempty"`
}
type Item ¶
type Item struct {
ID string `json:"id"`
Value string `json:"value,omitempty"`
Choice bool `json:"choice,omitempty"`
Explicit bool `json:"explicit,omitempty"`
Required bool `json:"required,omitempty"`
Consent bool `json:"consent,omitempty"`
Initial bool `json:"initial,omitempty"`
Label string `json:"label"`
Definition string `json:"definition"`
Line int `json:"line"`
EndLine int `json:"end_line"`
Offset int `json:"offset"`
Metadata []Span `json:"metadata,omitempty"`
// Tags and SelectAll are sorted sets, so reordering keeps fingerprints.
Tags []string `json:"tags,omitempty"`
SelectAll []string `json:"select_all,omitempty"`
// Text adds string input to a control, or makes a standalone input field.
Text bool `json:"text,omitempty"`
// Type selects single-line path input; Text remains true for string fields.
Type InputType `json:"type,omitempty"`
Default string `json:"default,omitempty"`
Existing bool `json:"existing,omitempty"`
// Checkbox keeps a boolean control alongside an associated input.
Checkbox bool `json:"checkbox,omitempty"`
// Rank makes items sharing an ID one field ordered by the reviewer.
Rank bool `json:"rank,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.