tangled
alpha
login
or
join now
ngp.computer
/
tsk
A file-based task manager
0
fork
atom
overview
issues
pulls
pipelines
ADD: inline block styling in green
ngp.computer
1 year ago
0ab078be
b1132c11
+34
-10
1 changed file
expand all
collapse all
unified
split
src
task.rs
+34
-10
src/task.rs
···
67
out.push(c);
68
let end = out.len() - 1;
69
match (last, c, state_last) {
70
-
('=', ' ' | '\n' | '\r' | '.' | '!' | '?', Some(Highlight(hl))) => {
71
-
state.pop();
72
-
out.replace_range(
73
-
hl..end,
74
-
&out.get(hl + 1..out.len() - 2)?.reversed().to_string(),
75
-
);
76
-
}
77
-
(' ' | '\r' | '\n', '=', _) => {
78
-
state.push(Highlight(end));
79
-
}
80
('[', '[', _) => {
81
state.push(InternalLink(end));
82
}
···
125
out.replace_range(linktextpos..end, &linktext);
126
}
127
}
0
0
0
0
0
0
0
0
0
0
128
(' ' | '\r' | '\n', '*', _) => {
129
state.push(Italics(end));
130
}
···
161
il..end,
162
&out.get(il + 1..end - 1)?.strikethrough().to_string(),
163
);
0
0
0
0
0
0
0
0
0
0
164
}
165
_ => (),
166
}
···
326
#[test]
327
fn test_strikethrough_bad() {
328
let input = "hello ~world\n";
0
0
0
0
0
0
0
0
0
0
0
0
0
0
329
let output = parse(input).expect("parse to work");
330
assert_eq!(input, output.content);
331
}
···
67
out.push(c);
68
let end = out.len() - 1;
69
match (last, c, state_last) {
0
0
0
0
0
0
0
0
0
0
70
('[', '[', _) => {
71
state.push(InternalLink(end));
72
}
···
115
out.replace_range(linktextpos..end, &linktext);
116
}
117
}
118
+
('=', ' ' | '\n' | '\r' | '.' | '!' | '?', Some(Highlight(hl))) => {
119
+
state.pop();
120
+
out.replace_range(
121
+
hl..end,
122
+
&out.get(hl + 1..out.len() - 2)?.reversed().to_string(),
123
+
);
124
+
}
125
+
(' ' | '\r' | '\n', '=', _) => {
126
+
state.push(Highlight(end));
127
+
}
128
(' ' | '\r' | '\n', '*', _) => {
129
state.push(Italics(end));
130
}
···
161
il..end,
162
&out.get(il + 1..end - 1)?.strikethrough().to_string(),
163
);
164
+
}
165
+
('`', ' ' | '\n' | '\r' | '.' | '!' | '?', Some(InlineBlock(hl))) => {
166
+
state.pop();
167
+
out.replace_range(
168
+
hl..end,
169
+
&out.get(hl + 1..out.len() - 2)?.green().to_string(),
170
+
);
171
+
}
172
+
(' ' | '\r' | '\n', '`', _) => {
173
+
state.push(InlineBlock(end));
174
}
175
_ => (),
176
}
···
336
#[test]
337
fn test_strikethrough_bad() {
338
let input = "hello ~world\n";
339
+
let output = parse(input).expect("parse to work");
340
+
assert_eq!(input, output.content);
341
+
}
342
+
343
+
#[test]
344
+
fn test_inlineblock() {
345
+
let input = "hello `world`\n";
346
+
let output = parse(input).expect("parse to work");
347
+
assert_eq!("hello \u{1b}[32mworld\u{1b}[0m\n", output.content);
348
+
}
349
+
350
+
#[test]
351
+
fn test_inlineblock_bad() {
352
+
let input = "hello `world\n";
353
let output = parse(input).expect("parse to work");
354
assert_eq!(input, output.content);
355
}