2015-12-08 04:46:18 +03:00
|
|
|
:: File writer module
|
|
|
|
::
|
|
|
|
:::: /hoon/write/lib
|
|
|
|
::
|
2016-02-18 02:36:43 +03:00
|
|
|
/? 310
|
2016-03-29 01:17:08 +03:00
|
|
|
/- plan-diff, plan-acct
|
2016-12-02 02:59:17 +03:00
|
|
|
=, format
|
2016-12-03 03:56:54 +03:00
|
|
|
=* as-octs as-octs:mimes:html
|
2016-12-02 02:59:17 +03:00
|
|
|
=, space:userlib
|
2015-12-08 04:46:18 +03:00
|
|
|
|%
|
2016-02-01 09:16:26 +03:00
|
|
|
++ part {$write $0 pith} :: no state
|
|
|
|
++ pith $~
|
2015-12-08 04:46:18 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
::::
|
|
|
|
::
|
|
|
|
|%
|
2016-11-08 20:46:37 +03:00
|
|
|
++ data $%({$json json} {$mime mime})
|
2016-12-07 06:13:33 +03:00
|
|
|
++ card $% {$exec wire @p $~ {beak silk:ford}}
|
|
|
|
{$info wire @p toro:clay}
|
2015-12-08 04:46:18 +03:00
|
|
|
==
|
|
|
|
--
|
2016-11-17 04:42:58 +03:00
|
|
|
::
|
2015-12-08 04:46:18 +03:00
|
|
|
::::
|
|
|
|
::
|
2016-12-07 06:13:33 +03:00
|
|
|
|= {bowl:gall part}
|
2015-12-08 04:46:18 +03:00
|
|
|
=* par +<+
|
2016-02-01 09:16:26 +03:00
|
|
|
|_ moz/(list {bone card})
|
2015-12-08 04:46:18 +03:00
|
|
|
++ abet [(flop moz) `part`par]
|
2016-02-01 09:16:26 +03:00
|
|
|
++ emit |=(a/card %_(+> moz :_(moz [ost a])))
|
2015-12-08 04:46:18 +03:00
|
|
|
++ beak-now byk(r [%da now])
|
2015-12-11 01:04:59 +03:00
|
|
|
++ poke-wipe
|
2016-11-08 04:40:00 +03:00
|
|
|
|= sup/path ^+ abet :: XX determine extension, beak
|
2015-12-11 01:04:59 +03:00
|
|
|
=+ ext=%md
|
2016-12-02 02:59:17 +03:00
|
|
|
?~ (file (en-beam beak-now [ext sup]))
|
2016-02-12 02:29:52 +03:00
|
|
|
~|(not-found+[ext `path`(flop sup)] !!)
|
|
|
|
=- abet:(emit %info write+~ our -)
|
2016-12-02 02:59:17 +03:00
|
|
|
(fray (en-beam beak-now [ext sup]))
|
2015-12-11 01:04:59 +03:00
|
|
|
::
|
2015-12-10 01:12:59 +03:00
|
|
|
++ poke-tree
|
2016-11-08 20:46:37 +03:00
|
|
|
|= {sup/path mim/mime} ^+ abet :: XX determine extension, beak
|
2015-12-11 01:04:59 +03:00
|
|
|
(poke--data [`%md (flop sup)] %mime mim)
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
2016-03-29 01:17:08 +03:00
|
|
|
++ poke-plan-account
|
|
|
|
|= {sev/knot usr/plan-acct} ^+ abet
|
2016-03-31 01:42:54 +03:00
|
|
|
(poke-plan-diff [~ ~ [[sev usr] ~ ~]])
|
|
|
|
::
|
|
|
|
++ poke-plan-info
|
2016-06-03 02:04:01 +03:00
|
|
|
|= {who/@t loc/@t}
|
2016-03-31 01:42:54 +03:00
|
|
|
(poke-plan-diff [[~ who loc] ~ ~])
|
|
|
|
::
|
|
|
|
++ poke-plan-diff
|
|
|
|
|= dif/plan-diff ^+ abet
|
|
|
|
?. =(our src)
|
|
|
|
~|(foreign-write+[our=our src=src] !!)
|
2016-12-07 06:13:33 +03:00
|
|
|
=; sob/soba:clay
|
|
|
|
?~(sob abet abet:(emit %info write+~ our `toro:clay`[q.byk %& sob]))
|
2016-03-25 03:15:12 +03:00
|
|
|
=+ pax=`path`/web/plan
|
2016-12-02 02:59:17 +03:00
|
|
|
=+ paf=(en-beam beak-now (flop pax))
|
2016-03-31 03:27:18 +03:00
|
|
|
?~ [fil:.^(arch %cy paf)]
|
2016-06-03 02:04:01 +03:00
|
|
|
=+ ins=(pact-plan [['' ''] ~] dif)
|
2016-03-31 03:27:18 +03:00
|
|
|
[pax %ins plan+!>(ins)]~
|
2016-11-08 04:40:00 +03:00
|
|
|
=+ ole=.^({{@t @t} (map knot plan-acct)} %cx paf)
|
2016-03-31 03:27:18 +03:00
|
|
|
=+ neu=(pact-plan ole dif)
|
|
|
|
?: =(ole neu) ~
|
2016-03-31 01:42:54 +03:00
|
|
|
[pax %dif plan-diff+!>(dif)]~
|
2016-03-25 02:31:37 +03:00
|
|
|
::
|
2016-03-31 03:27:18 +03:00
|
|
|
++ pact-plan :: XX clay should handle fused insert+diff
|
2016-11-08 04:40:00 +03:00
|
|
|
|= {all/{{who/@t loc/@t} acc/(map knot plan-acct)} dif/plan-diff}
|
2016-03-31 03:27:18 +03:00
|
|
|
^+ all
|
|
|
|
:- (fall inf.dif -.all)
|
|
|
|
=; neu (~(uni by neu) put.dif)
|
|
|
|
=+ del=(~(tap by del.dif)) :: XXX map functions
|
|
|
|
|- ^+ acc.all
|
|
|
|
?~ del acc.all
|
|
|
|
$(del t.del, acc.all (~(del by acc.all) p.i.del))
|
|
|
|
::
|
2015-12-08 04:46:18 +03:00
|
|
|
++ poke-paste
|
2016-02-01 09:16:26 +03:00
|
|
|
|= {typ/?($hoon $md $txt) txt/@t} ^+ abet
|
2016-12-03 03:56:54 +03:00
|
|
|
(poke--data [`typ /web/paste/(scot %da now)] %mime / (as-octs txt))
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
2016-02-04 04:46:14 +03:00
|
|
|
++ poke-comment
|
2016-11-08 04:40:00 +03:00
|
|
|
|= {sup/path him/ship txt/@t} ^+ abet
|
2016-05-24 03:45:18 +03:00
|
|
|
=+ pax=(welp (flop sup) /comments/(scot %da now))
|
2016-12-16 09:34:01 +03:00
|
|
|
=. txt
|
2016-03-04 03:36:39 +03:00
|
|
|
%+ rap 3 :~
|
|
|
|
'## `' (scot %p him) '`'
|
|
|
|
'\0a' txt
|
|
|
|
==
|
2016-12-03 03:56:54 +03:00
|
|
|
(poke--data [`%md pax] %mime / (as-octs txt))
|
2016-02-04 04:46:14 +03:00
|
|
|
::
|
2016-07-26 01:23:04 +03:00
|
|
|
++ poke-fora-post
|
2016-11-08 04:40:00 +03:00
|
|
|
|= {sup/path him/ship hed/@t txt/@t} ^+ abet
|
2016-07-30 01:32:36 +03:00
|
|
|
=+ pax=(welp (flop sup) /posts/(cat 3 (scot %da now) '~'))
|
2016-07-26 01:23:04 +03:00
|
|
|
=. txt
|
|
|
|
%- crip
|
|
|
|
"""
|
|
|
|
---
|
|
|
|
type: post
|
|
|
|
date: {<now>}
|
|
|
|
title: {(trip hed)}
|
|
|
|
author: {<him>}
|
2016-09-07 00:27:42 +03:00
|
|
|
navsort: bump
|
2016-07-29 22:31:07 +03:00
|
|
|
navuptwo: true
|
2016-07-29 22:41:16 +03:00
|
|
|
comments: reverse
|
2016-07-26 01:23:04 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
{(trip txt)}
|
|
|
|
"""
|
2016-12-03 03:56:54 +03:00
|
|
|
(poke--data [`%md pax] %mime / (as-octs txt))
|
2016-07-26 01:23:04 +03:00
|
|
|
::
|
2016-03-11 23:02:08 +03:00
|
|
|
++ ames-secret
|
|
|
|
^- @t
|
|
|
|
=- (crip +:<.^(@p %a pax)>)
|
|
|
|
pax=/(scot %p our)/code/(scot %da now)/(scot %p our)
|
|
|
|
::
|
2016-02-05 02:03:51 +03:00
|
|
|
++ poke-sec-atom
|
2016-12-07 06:13:33 +03:00
|
|
|
|= {hot/host:eyre dat/@}
|
2016-02-19 23:33:56 +03:00
|
|
|
?> ?=($& -.hot)
|
2016-03-11 22:17:35 +03:00
|
|
|
=. p.hot (scag 2 p.hot) :: ignore subdomain
|
2016-12-01 04:22:43 +03:00
|
|
|
=. dat (scot %uw (en:crua:crypto ames-secret dat))
|
2016-12-03 03:56:54 +03:00
|
|
|
(poke--data [`%atom [%sec p.hot]] %mime / (as-octs dat))
|
2016-02-05 02:03:51 +03:00
|
|
|
::
|
2015-12-08 04:46:18 +03:00
|
|
|
++ poke--data
|
2016-02-01 09:16:26 +03:00
|
|
|
|= {{ext/(unit @t) pax/path} dat/data} ^+ abet
|
2015-12-08 04:46:18 +03:00
|
|
|
?~ ext $(ext [~ -.dat])
|
2016-02-01 09:16:26 +03:00
|
|
|
=+ cay=?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)])
|
2016-12-16 09:34:01 +03:00
|
|
|
?: =(u.ext -.dat)
|
2016-02-12 02:29:52 +03:00
|
|
|
(made pax ~ &+cay)
|
2015-12-08 04:46:18 +03:00
|
|
|
=< abet
|
2016-02-01 09:16:26 +03:00
|
|
|
%^ emit %exec write+pax :: XX defer %nice
|
2016-02-12 02:29:52 +03:00
|
|
|
[our ~ beak-now %cast u.ext $+cay]
|
2015-12-08 04:46:18 +03:00
|
|
|
::
|
|
|
|
++ made
|
2016-12-07 06:13:33 +03:00
|
|
|
|= {pax/wire @ res/gage:ford} ^+ abet
|
2016-02-04 04:46:14 +03:00
|
|
|
:: ?. =(our src)
|
|
|
|
:: ~|(foreign-write/[our=our src=src] !!)
|
2016-02-12 02:29:52 +03:00
|
|
|
?+ -.res ~|(gage+-.res !!)
|
2016-02-01 09:16:26 +03:00
|
|
|
$| (mean p.res)
|
|
|
|
$& =- abet:(emit %info write+~ our -)
|
2016-12-02 02:59:17 +03:00
|
|
|
(foal :(welp (en-beam beak-now ~) pax /[-.p.res]) p.res)
|
2015-12-08 04:46:18 +03:00
|
|
|
==
|
|
|
|
--
|