mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
story: make sure terminating newline is present in text encoding
This commit is contained in:
parent
7564f922a2
commit
6982735650
@ -7,11 +7,14 @@
|
||||
[/text/x-urb-story (as-octs:mimes:html (of-wain:format txt))]
|
||||
++ txt
|
||||
^- wain
|
||||
:: TODO better code style?
|
||||
%+ snoc :: ensure terminating newline is present
|
||||
%+ turn ~(tap by story)
|
||||
|= [chapter=[tak=tako:clay message=[title=@t body=@t]]]
|
||||
=/ tak=tako:clay tak.chapter
|
||||
=/ [title=@t body=@t] +.chapter
|
||||
(crip "commit: {<`@uv`tak>}\0a{(trip title)}\0a\0a{(trip body)}\0a---\0a")
|
||||
(crip "commit: {<`@uv`tak>}\0a{(trip title)}\0a\0a{(trip body)}\0a---")
|
||||
''
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
@ -38,7 +41,7 @@
|
||||
;~ 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
|
||||
;~ less (jest '---\0a') :: exclude the terminator from the following parse
|
||||
;~(sfix (star prn) (just '\0a')) :: parse 0 or more prn chars then discard literal newline
|
||||
==
|
||||
::
|
||||
@ -46,8 +49,8 @@
|
||||
==
|
||||
::
|
||||
=/ story-parser
|
||||
%- star :: parse any number of the chapters
|
||||
;~ plug :: parse chapter: a commit, followed by a title, followed by a body
|
||||
%- 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
|
||||
|
Loading…
Reference in New Issue
Block a user