-
Notifications
You must be signed in to change notification settings - Fork 17
/
stdlib.norg
28 lines (21 loc) · 1018 Bytes
/
stdlib.norg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|comment
This document is a real implementation of the Norg standard library.
This includes all carryover tags, ranged tags and their behaviours.
|end
=macro name params* >next
#eval
@code janet
(def wrong-next-object "`macro` requires that the next object be a `@code` tag!")
(assert (neorg/ast/ranged-verbatim-tag? next) wrong-next-object)
(let [next-tag (neorg/ast/ranged-verbatim-tag next)]
(assert (= (get next-tag :name) "code") wrong-next-object))
# TODO: Ensure that the language used in the `@code` tag is supported?
(string "=" name " " ;params "\n#eval\n" (neorg/ast/node-text next :join) "\n=end")
@end
=end
%Yes, this is the implementation of `comment`%
=comment ...
=end
=eval language-name? &captures* >code
.invoke-janet (neorg/execute (or &language-name& (neorg/ast/ranged-verbatim-tag/parameter &code& 0) (error "Language type to execute could not be inferred!")) \[&captures&\] (or (neorg/ast/ranged-verbatim-tag? &code& "code") (error "Expected code block to follow `#eval` block!")))
=end