Skip to content

Commit 1d5cc45

Browse files
committed
Add Note and Snippet.notes
1 parent 97fef0f commit 1d5cc45

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

notebook.example.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
snippets:
2+
- words:
3+
- !Tunic
4+
- 153
5+
source: !ManualPageNumber 2
6+
description: Placeholder
7+
notes:
8+
- ADD_NOTE_HERE

notebook.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
snippets:
2+
- words:
3+
- !Tunic
4+
- 153
5+
source: !ManualPageNumber 2
6+
description: Placeholder
7+
notes:
8+
- ADD_NOTE_HERE

src/bin/add-snippet.rs

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ fn english_word_snippet(args: &English) -> Snippet {
143143
words,
144144
source,
145145
description,
146+
..Snippet::starting_snippet()
146147
}
147148
}
148149

@@ -167,5 +168,6 @@ fn tunic_word_snippet(args: &Tunic) -> Snippet {
167168
words,
168169
source,
169170
description,
171+
..Snippet::starting_snippet()
170172
}
171173
}

src/language.rs

+9
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ pub enum Source {
1313
ScreenshotFilename(String),
1414
Other(String),
1515
}
16+
17+
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
18+
pub struct Note(String);
19+
20+
impl From<&str> for Note {
21+
fn from(text: &str) -> Self {
22+
Note(text.to_string())
23+
}
24+
}

src/language/snippets.rs

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub struct Snippet {
77
pub words: Vec<Word>,
88
pub source: Option<Source>,
99
pub description: String,
10+
pub notes: Vec<Note>,
1011
}
1112

1213
impl Snippet {
@@ -17,11 +18,13 @@ impl Snippet {
1718
let words = vec![Word::Tunic(vec![glyph])];
1819
let source = Some(Source::Other("ADD_SOURCE_HERE".into()));
1920
let description = "ADD_DESCRIPTION_HERE".into();
21+
let note: Note = "ADD_NOTE_HERE".into();
2022

2123
Self {
2224
words,
2325
source,
2426
description,
27+
notes: vec![note],
2528
}
2629
}
2730
}

0 commit comments

Comments
 (0)