base-dev: initial `mime:grab` impl for story mark
++ grab
|% :: convert from
++ noun (map tako:clay ,[title=@t body=@t]) :: clam from %noun
- ++ mime |=([p=mite q=octs] q.q) :: retrieve form %mime
+ ++ mime :: retrieve form %mime
+ |= [p=mite q=octs]
+ ^- (map tako:clay [title=@t body=@t])
+ =/ commit-parser
+ ;~ sfix :: throw away the trailing newline
+ ;~ pfix (jest 'commit: ') :: throw away leading literal 'commit'
+ (cook @uv ;~(pfix (jest '0v') viz:ag)) :: parse a @uv
+ ==
+ ::
+ (just '\0a') :: parse trailing newline
+ ==
+ ::
+ =/ title-parser
+ ;~ sfix :: throw away trailing newlines
+ (cook crip (star prn)) :: parse any number of ascii characters, turn into cord
+ (jest '\0a\0a') :: parse two newlines
+ ==
+ ::
+ =/ body-parser
+ ;~ sfix :: parse the following and discard terminator
+ %- star :: parse 0 or more of the following
+ %+ cook crip :: convert to cord
+ ;~ less (jest '---\0a') :: exclude '---' from the following parse
+ ;~(sfix (star prn) (just '\0a')) :: parse 0 or more prn chars then discard literal newline
+ ==
+ ::
+ (jest '---\0a') :: parse the terminator
+ ==
+ ::
+ =/ story-parser
+ %- star :: parse any number of the chapters
+ ;~ plug :: parse chapter: a commit, followed by a title, followed by a body
+ commit-parser
+ title-parser
+ body-parser
+ ==
+ ::
+ =/ story-text `@t`q.q
+ =/ parsed-story `(list [@uv @t wain])`(rash story-text story-parser)
+ %- ~(gas by *(map tako:clay [title=@t body=@t]))
+ %+ turn parsed-story
+ |= [tak=tako:clay title=@t body=wain]
+ [tak title (of-wain:format body)]
--
--
