summaryrefslogtreecommitdiff
path: root/desk/sur
diff options
context:
space:
mode:
Diffstat (limited to 'desk/sur')
-rw-r--r--desk/sur/docket.hoon82
-rw-r--r--desk/sur/feed.hoon16
-rw-r--r--desk/sur/markdown.hoon157
-rw-r--r--desk/sur/nostril.hoon18
-rw-r--r--desk/sur/post.hoon1
5 files changed, 272 insertions, 2 deletions
diff --git a/desk/sur/docket.hoon b/desk/sur/docket.hoon
new file mode 100644
index 0000000..091c8c9
--- /dev/null
+++ b/desk/sur/docket.hoon
@@ -0,0 +1,82 @@
+|%
+::
++$ version
+ [major=@ud minor=@ud patch=@ud]
+::
++$ glob (map path mime)
+::
++$ url cord
+:: $glob-location: How to retrieve a glob
+::
++$ glob-reference
+ [hash=@uvH location=glob-location]
+::
++$ glob-location
+ $% [%http =url]
+ [%ames =ship]
+ ==
+:: $href: Where a tile links to
+::
++$ href
+ $% [%glob base=term =glob-reference]
+ [%site =path]
+ ==
+:: $chad: State of a docket
+::
++$ chad
+ $~ [%install ~]
+ $% :: Done
+ [%glob =glob]
+ [%site ~]
+ :: Waiting
+ [%install ~]
+ [%suspend glob=(unit glob)]
+ :: Error
+ [%hung err=cord]
+ ==
+::
+:: $charge: A realized $docket
+::
++$ charge
+ $: =docket
+ =chad
+ ==
+::
+:: $clause: A key and value, as part of a docket
+::
+:: Only used to parse $docket
+::
++$ clause
+ $% [%title title=@t]
+ [%info info=@t]
+ [%color color=@ux]
+ [%glob-http url=cord hash=@uvH]
+ [%glob-ames =ship hash=@uvH]
+ [%image =url]
+ [%site =path]
+ [%base base=term]
+ [%version =version]
+ [%website website=url]
+ [%license license=cord]
+ ==
+::
+:: $docket: A description of JS bundles for a desk
+::
++$ docket
+ $: %1
+ title=@t
+ info=@t
+ color=@ux
+ =href
+ image=(unit url)
+ =version
+ website=url
+ license=cord
+ ==
+::
++$ charge-update
+ $% [%initial initial=(map desk charge)]
+ [%add-charge =desk =charge]
+ [%del-charge =desk]
+ ==
+--
diff --git a/desk/sur/feed.hoon b/desk/sur/feed.hoon
new file mode 100644
index 0000000..459d965
--- /dev/null
+++ b/desk/sur/feed.hoon
@@ -0,0 +1,16 @@
+/- post
+|%
++$ feeds (map ship feed)
++$ feed ((mop id:post post:post) gth)
++$ index (map @t (set pid:post))
+++ orm ((on id:post post:post) gth)
++$ full-graph ((mop id:post full-node:post) gth)
+++ form ((on id:post full-node:post) gth)
++$ global ((mop pid:post post:post) ggth)
+++ ggth |=([[ship a=time] [ship b=time]] (gth a b))
+++ gorm ((on pid:post post:post) ggth)
+
++$ cursor (unit @da)
++$ fc [=feed:feed start=cursor end=cursor]
++$ gc [mix=global:feed start=cursor end=cursor]
+--
diff --git a/desk/sur/markdown.hoon b/desk/sur/markdown.hoon
new file mode 100644
index 0000000..baf266e
--- /dev/null
+++ b/desk/sur/markdown.hoon
@@ -0,0 +1,157 @@
+=> |%
+ ++ ln
+ |%
+ ::
+ :: Url: optionally enclosed in triangle brackets
+ :: A link destination consists of either
+ :: - a sequence of zero or more characters between an opening < and a closing > that
+ :: contains no line breaks or unescaped < or > characters, or
+ :: - a nonempty sequence of characters that does not start with <, does not include
+ :: ASCII space or control characters, and includes parentheses only if (a) they are
+ :: backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses.
+ :: (Implementations may impose limits on parentheses nesting to avoid performance
+ :: issues, but at least three levels of nesting should be supported.)
+ +$ url [text=@t has-triangle-brackets=?]
+ ::
+ :: Url with optional title-text
+ +$ urlt [=url title-text=(unit @t)]
+ ::
+ :: Link target: the part of a link after the display text. can be direct or reference
+ :: A reference link is in square brackets, and refers to a named link elsewhere.
+ :: - full => [Display][foo]
+ :: - collapsed => [Display][]
+ :: - shortcut => [Display]
+ :: Collapsed and shortcut links have a `label` equal to the display text.
+ +$ target $% [%direct =urlt]
+ [%ref type=?(%full %collapsed %shortcut) label=@t]
+ ==
+ --
+ --
+::
+|%
+ ::
+ :: Markdown document or fragment: a list of nodes
+ ++ markdown =< $+ markdown
+ (list node)
+ |%
+ +$ node $+ markdown-node
+ $@ ~ :: `$@ ~` is magic that makes recursive structures work
+ $% [%leaf node:leaf]
+ [%container node:container]
+ ==
+ --
+ ::
+ ++ inline
+ |%
+ :: A single inline element
+ ++ element $+ inline-element
+ $@ ~
+ $%(escape entity code hardbrk softbrk text emphasis strong link image autolink html)
+ ::
+ :: Any amount of elements
+ ++ contents (list element)
+ ::
+ :: -----------------------
+ :: List of inline elements
+ :: -----------------------
+ ::
+ :: Backslash-escaped character
+ +$ escape [%escape char=@t]
+ ::
+ :: HTML-entity
+ +$ entity [%entity code=@t]
+ ::
+ :: Code span (inline code). Interpreted literally, cannot have nested elements.
+ :: Can be enclosed by any amount of backticks on each side, >= 1. Must be balanced.
+ +$ code [%code-span num-backticks=@ text=@t]
+ ::
+ :: Line break
+ +$ hardbrk [%line-break ~]
+ ::
+ :: Soft line break: a newline in the source code, will be rendered as a single space
+ +$ softbrk [%soft-line-break ~]
+ ::
+ :: Text: Just text
+ +$ text [%text text=@t]
+ ::
+ :: Emphasis and strong emphasis
+ :: Can use either tar "*" or cab "_" as the emphasis character.
+ :: Can have nested inline elements.
+ +$ emphasis [%emphasis emphasis-char=@t =contents]
+ +$ strong [%strong emphasis-char=@t =contents]
+ ::
+ :: Link
+ +$ link [%link =contents =target:ln]
+ ::
+ :: Images
+ +$ image [%image alt-text=@t =target:ln]
+ ::
+ :: Autolink: a link that's just itself, surrounded by "<...>"
+ +$ autolink [%autolink text=@t]
+ ::
+ :: HTML
+ +$ html [%html text=@t]
+ --
+ ::
+ :: Leaf nodes: non-nested (i.e., terminal) nodes
+ ++ leaf
+ |%
+ ++ node $+ leaf-node
+ $@ ~
+ $%(heading break codeblk-indent codeblk-fenced html link-ref-def table paragraph blank-line)
+ ::
+ :: Heading, either setext or ATX style
+ +$ heading [%heading style=?(%setext %atx) level=@ =contents:inline]
+ ::
+ :: Thematic break (horizontal line)
+ :: Consists of at least 3 repetitions of either hep '-', cab '_', or tar '*'
+ +$ break [%break char=@t char-count=@]
+ ::
+ :: Indentation-based code block: indented 4 spaces. Can include newlines and blank lines.
+ +$ codeblk-indent [%indent-codeblock text=@t]
+ ::
+ :: Fenced code block: begins and ends with 3+ repetitions of tic (`) or sig (~).
+ :: Can be indented up to 3 spaces.
+ +$ codeblk-fenced [%fenced-codeblock char=@t char-count=@ info-string=@t indent-level=@ text=@t]
+ ::
+ :: HTML
+ +$ html [%html text=@t]
+ ::
+ :: Link reference definition (defines a named link which can be referenced elsewhere)
+ +$ link-ref-def [%link-ref-definition label=@t =urlt:ln]
+ ::
+ :: Paragraph
+ +$ paragraph [%paragraph =contents:inline]
+ ::
+ :: Blank lines (not rendered, but lets user control aethetic layout of the source code)
+ +$ blank-line [%blank-line ~]
+ ::
+ :: Table (alignments: [l]eft, [r]ight, [c]enter, [n]one)
+ +$ table [%table widths=(list @) head=(list contents:inline) align=(list ?(%l %c %r %n)) rows=(list (list contents:inline))]
+ --
+ ::
+ :: Container node: can contain other nodes (either container or leaf).
+ ++ container
+ |%
+ ++ node $+ container-node
+ $@ ~
+ $%(block-quote ol ul tl)
+ ::
+ :: Block quote. Can be nested.
+ +$ block-quote [%block-quote =markdown]
+ ::
+ :: Ordered list: numbered based on first list item marker.
+ :: Marker char can be either dot '1. asdf' or par '1) asdf'
+ :: Can be indented up to 3 spaces
+ +$ ol [%ol indent-level=@ marker-char=@t start-num=@ contents=(list markdown)] :: is-tight=?
+ ::
+ :: Unordered list: bullet point list
+ :: Marker char can be either hep (-), lus (+) or tar (*)
+ :: Can be indented up to 3 spaces
+ +$ ul [%ul indent-level=@ marker-char=@t contents=(list markdown)] :: is-tight=?
+ ::
+ :: Task list: unordered list of tasks
+ :: Can be indented up to 3 spaces
+ +$ tl [%tl indent-level=@ marker-char=@t contents=(list [is-checked=? =markdown])] :: is-tight=?
+ --
+--
diff --git a/desk/sur/nostril.hoon b/desk/sur/nostril.hoon
index 1e51695..87f6611 100644
--- a/desk/sur/nostril.hoon
+++ b/desk/sur/nostril.hoon
@@ -1,17 +1,25 @@
+/- feed
|%
++ shim-url 'http://localhost:8888/shim'
+$ state state-0
+$ state-0
$: %0
+ :: nostr config
relays=(set @t)
events=(list event) :: let's limit it to 100
keys=(set keys)
+ :: feeds
+ own=feed:feed
+ following=(map @ux [profile=user-meta =feed:feed])
+ follow-graph=(map @ux (set [pubkey=@ux name=@t relay=(unit @t)]))
+ :: TODO global feed somehow?
+
==
+$ keys [pub=@ priv=@]
++ default ^- state-0 =/ s *state-0 s(relays (silt ~['wss://relay.damus.io' 'wss://nos.lol']))
:: NOSTR structs
::
-++ event
++$ event
$: id=@ux :: 32bytes
pubkey=@ux :: 32bytes
created-at=@ud :: seconds
@@ -20,9 +28,15 @@ $: id=@ux :: 32bytes
content=@t
sig=@ux :: 64bytes
==
-++ tag
++$ tag
$: key=@t
value=@t
rest=(list @t)
==
++$ user-meta :: NIP-1
+ (map @t @t)
+:: $: name=@t
+:: about=@t
+:: pic=@t
+:: ==
--
diff --git a/desk/sur/post.hoon b/desk/sur/post.hoon
index f7bdde6..75f2aa3 100644
--- a/desk/sur/post.hoon
+++ b/desk/sur/post.hoon
@@ -73,6 +73,7 @@
+$ content-map ((mop time content-list) gth)
++ corm ((on time content-list) gth)
+$ content-list contents:contents-1
++$ li content-list
++ contents-1
|%
+$ contents (list block)