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
29
30
31
32
33
34
|
import "std";
import "util";
Kmd :: struct
has
Mode :: enum(none, p, ul, ol);
HtmlOptions :: record(br_after_newline: bool);
is
title : str,
date : ?str,
contents : str,
do
new :: construct fn(text: str) -> ?Kmd
do
iter := text.split_iter("\n");
return construct Kmd // Kmd is coercible to ?Kmd.
as
title = iter.first(),
date = iter.after(),
contents = iter.rest(),
end;
end
apart :: deconstruct fn(^self) -> (str, str, str)
do
return (self.title, self.date, self.contents);
end
html :: fn(self, allocator: Allocator, opts: HtmlOptions, req_cap_if_known: ?usize) -> Kmd
do
mode : Mode = .none;
is_strong, is_emph := false, false;
end
end
|