A file-based task manager
1#![allow(dead_code)]
2use url::Url;
3
4use crate::workspace::Id;
5
6/// An AST node parsed from the plain-text representation of
7enum TaskASTNode<'n> {
8 /// Unmodified text
9 Plain(&'n str),
10 /// Text that has been highlighted using =test= syntax.
11 Highlight(Box<TaskASTNode<'n>>),
12 /// A standard Markdown-style link
13 Link {
14 text: Box<TaskASTNode<'n>>,
15 to: Url,
16 },
17 /// An internal link to another task using custom [[tsk-id]] syntax
18 InternalLink(Id),
19 /// Italicized text using Markdown *text* syntax.
20 Italics(Box<TaskASTNode<'n>>),
21 /// Bolded text using !text! syntax.
22 Bold(Box<TaskASTNode<'n>>),
23 /// Underlined text using custom _text_ syntax.
24 Underline(Box<TaskASTNode<'n>>),
25 /// Strikethrough using -text- syntax
26 Strikethrough(Box<TaskASTNode<'n>>),
27 /// Unordered list using Markdown * list-item syntax
28 UnorderedList(Vec<TaskASTNode<'n>>),
29 /// Ordered list using Markdown 1. list-item syntax
30 OrderedList(Vec<TaskASTNode<'n>>),
31 /// Literal block using markdown triple-backtick syntax.
32 Block {
33 /// An optional syntax specifier. This *may* be used to apply syntax formatting to contents
34 /// in the future
35 syntax: Option<&'n str>,
36 /// The verbatim content of the block
37 content: &'n str,
38 },
39 /// Literal block using markdown single-backtick syntax.
40 InlineBlock(&'n str),
41 /// Blockquotes using Markdown > quote syntax
42 Blockquote(&'n str),
43}
44
45impl<'i> TaskASTNode<'i> {
46 fn parse(s: &'i String) -> Result<Vec<TaskASTNode<'i>>, String> {
47 let i = 0;
48 let mut roots: Vec<TaskASTNode<'i>> = Vec::new();
49
50 todo!();
51 }
52}