diff options
Diffstat (limited to 'desk/lib/nostril/post.hoon')
-rw-r--r-- | desk/lib/nostril/post.hoon | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/desk/lib/nostril/post.hoon b/desk/lib/nostril/post.hoon index 134ed27..6ce9345 100644 --- a/desk/lib/nostril/post.hoon +++ b/desk/lib/nostril/post.hoon @@ -49,7 +49,8 @@ %emphasis (de-strong +.inl) %strong (de-strong +.inl) %link [%link (de-target target.inl) (flatten-inline contents.inl)] - %image [%img (de-target target.inl) alt-text.inl] + %image [%link (de-target target.inl) (de-target target.inl)] + :: %image [%img (de-target target.inl) alt-text.inl] %autolink [%text ''] %html [%codespan text.inl] == @@ -85,16 +86,18 @@ %block-quote [%blockquote (denest +.node)] %ol [%list (de-list contents.node) .y] %ul [%list (de-list contents.node) .n] - %tl [%tasklist (turn contents.node de-task)] + %tl [%paragraph ~] == -++ de-task |= [checked=? mde=markdown:md] ^- task:tp - :_ checked (denest mde) -++ de-list |= lmd=(list markdown:md) ^- (list li:tp) - =| res=(list li:tp) - |- ?~ lmd (flop res) - =/ nodelist i.lmd - =/ blocks %+ turn nodelist de-node - $(lmd t.lmd, res [blocks res]) +++ de-list |= lmd=(list markdown:md) ^- (list inline:tp) +:: TODO +~ + :: =| res=(list li:tp) + :: |- ?~ lmd (flop res) + :: =/ nodelist i.lmd + :: =/ blocks=(list block:tp) + :: %+ turn nodelist de-node + :: $(lmd t.lmd, res [blocks res]) + ++ denest |= mde=markdown:md ^- paragraph:tp =| res=paragraph:tp |- ?~ mde (flop res) @@ -110,7 +113,7 @@ %heading :~([%text p.block]) %codeblock :~([%text code.block]) %eval :~([%text hoon.block]) - %list (break-list p.block) + :: %list (break-list p.block) == ++ break-list |= lis=(list li:tp) ^- paragraph:tp =| res=paragraph:tp @@ -154,24 +157,25 @@ ++ manx-to-block |= =manx:hoot ^- (unit block:tp) ?+ n.g.manx ~ - heading %- some [%heading (phead n.g.manx c.manx)] + :: TODO + :: heading %- some [%heading (phead n.g.manx c.manx)] %p %- some [%paragraph (inline-list c.manx)] %blockquote %- some [%blockquote (inline-list c.manx)] %pre %- some [%codeblock (pre c.manx)] %hr %- some [%paragraph ~[[%break ~]]] - %ul %- some [%list (list-items c.manx) .n] - %ol %- some [%list (list-items c.manx) .y] + %ul %- some [%list (inline-list c.manx) .n] + %ol %- some [%list (inline-list c.manx) .y] :: %table %- some (table-rows c.manx) == -++ list-items -|= =marl:hoot ^- (list li:clist:tp) -%- flop - %+ roll marl |= [=tuna:hoot acc=(list li:clist:tp)] - ?@ -.tuna acc - ?. ?=(%li n.g.tuna) acc :_ acc (marl-to-cl c.tuna) - ++ phead - |= [h=heading c=marl:hoot] ^- [p=cord q=heading] - :- (get-tag-text c) h +:: ++ list-items +:: |= =marl:hoot ^- (list li:tp) +:: %- flop +:: %+ roll marl |= [=tuna:hoot acc=(list li:tp)] +:: ?@ -.tuna acc +:: ?. ?=(%li n.g.tuna) acc :_ acc (marl-to-cl c.tuna) +:: ++ phead +:: |= [h=heading c=marl:hoot] ^- [p=cord q=heading] +:: :- (get-tag-text c) h ++ inline-list |= c=marl:hoot ^- (list inline:tp) %- flop @@ -261,8 +265,8 @@ "{acc}{il}" "{acc}{il} " %list - %^ foldi:sr p.b "" |= [in=@ud =li:tp acc=tape] - =/ li-tape (content-list-to-md li) + %^ foldi:sr p.b "" |= [in=@ud i=inline:tp acc=tape] + =/ li-tape (inline-to-tape i) =/ line ?: ordered.b "{<+(in)>}. {li-tape}" "- {li-tape}" @@ -271,11 +275,14 @@ "{acc}{line}\0a" %media ?+ -.media.b "})" -%images %^ foldi:sr p.media.b "" |= [i=@ud [url=@t caption=@t] acc=tape] - =/ line "})" - ?: .=(+(i) (lent p.media.b)) - "{acc}{line}" - "{acc}{line}\0a" + :: TODO +%images + :: %^ foldi:sr p.media.b "" |= [i=@ud [url=@t caption=@t] acc=tape] + :: =/ line "})" + :: ?: .=(+(i) (lent p.media.b)) + :: "{acc}{line}" + :: "{acc}{line}\0a" + "" == %codeblock """ @@ -291,7 +298,7 @@ %h5 "##### " %h6 "###### " == "{dashes}{(trip p.b)}" -%tasklist "" ::TODO +:: %tasklist "" ::TODO :: :: %table acc :: %eval acc @@ -307,7 +314,7 @@ "{acc}{block-tape}\0a\0a" ++ inline-to-tape |= i=inline:tp ^- tape - ?- -.i + ?+ -.i "" %text (trip p.i) %italic "_{(trip p.i)}_" %bold "*{(trip p.i)}*" @@ -315,7 +322,7 @@ %ship (scow %p p.i) %codespan "`{(trip p.i)}`" %link "[{(trip show.i)}]({(trip href.i)})" - %img "})" + :: %img "})" %break "\0a" == ++ tags-to-tape @@ -324,6 +331,7 @@ ?: .=(+(i) ~(wyt in t)) "{acc}{(trip c)}" "{acc}{(trip c)}," + ++ init-content-map |= [cl=content-list:tp date=@da] ^- content-map:tp (put:corm:tp *content-map:tp date cl) |