manx

renderable data


manx is the type that represents the shape of an interface node.

in the hawk system, there is only a single layer, the interface.

hawk's core opinion is that both the user interface tree and the application data should be combined into a manx.


in hoon:

+$  manx  [g=marx c=marl]
  :: g  tag
  :: c  children
+$  marl  (list manx)
+$  marx  [n=mane a=mart]
  :: n  tag name
  :: a  attributes
+$  mane  $@(@tas [@tas @tas])
+$  mart  (list [n=mane v=tape])

sail

hoon has a syntax for writing manxs called Sail.

;div
  ;h1: heading
  
  ;p
    ; i am a paragraph
    ; with some text
  ==
  
  ;form
    ;input(name "number", type "number");
    ;button: submit number
  ==
==


;/

turn tape into manx

^-  manx
;/  "some text"
;div
  ;+  ;/
  ?:  x  "other"
  "something"
==

;-

embed hoon's resulting tape in manx

^-  manx
;div
  ;-  "some text"
==
;div
  ;-
  ?:  x  "other"
  "something"
==

;+

embed hoon's resulting manx in manx

^-  manx
;div
  ;+
  ?:  w
    ;div: a
  ;div: b
==
|^
  ;div
    ;+  a
    ;+  b
  ==
++  a
  ;div
    blah
  ==
++  b
  ;div
    ;div
      blah
    ==
    ;div
      blah
    ==
  ==
--

;*

embed hoon's resultiing marl in manx

^-  manx
;div
  ;*
  ^-  marl
  %+  turn  (gulf 1 10)
  |=  n=@
  ;div: {<n>}
==

;%

run $-(marl marl) gate on the remaining marl

^-  manx
;div
  ;%  |=  =marl
      %+  skim  marl
      |=  =manx
      =(%h1 n.g.manx) :: filter to only `h1` tags

  hello world (filtered out)

  # i will be SHOWN

  beep boop (filtered out)

  ## i will also be filtered out

  this paragraph is not an `h1`
  so it will get filtered out.
==

;>

interpret rest of file as udon

udon is like markdown.

you can use udon syntax inside of sail nodes or underneath a ;> rune.

=;  content=manx
  ;div.page.prose  :: wrap with blog styling & header
    ;header.tr
      [back](..)
    ==
    ;*  c.content=manx
  ==
;>

# heading

paragraph,
paragraph, paragraph.

- list
- list
- list

+ numbered list
  + a
  + a
+ numbered list
  + a
+ numbered list
  + a