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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use crate::Encode;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Manual {
pub pages: Vec<Page>,
}
impl Encode<'_> for Manual {}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Page {
/// The page name as appears in the Table of Contents.
pub title: String,
/// Show the page only when the given badge is unlocked.
pub badge: Option<u8>,
/// Show the page only when the given score is reached on the given board.
pub score: Option<(u8, i16)>,
/// Encoded color scheme.
///
/// It's encoded the same way as in [Settings][crate::Settings].
pub theme: Option<u32>,
pub content: Vec<Block>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum Block {
/// The biggest header after the page title.
H2(String),
/// The smallest header.
H3(String),
/// Paragraph.
P(Paragraph),
/// Ordered (numbered) list item.
Oli(Paragraph),
/// Unrdered list item.
Uli(Paragraph),
/// Link to another page.
A(u8),
/// Block image, centered.
Img(String),
/// Block quote.
Quote(Paragraph),
/// QR code.
Qr(String),
}
pub type Paragraph = Vec<Inline>;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Inline {
pub kind: InlineKind,
pub content: String,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum InlineKind {
/// Plain text.
Plain,
/// Bold text.
Bold,
/// Italic text.
Italic,
/// Inline image.
Image,
/// Inline icon image.
Icon,
/// Line break.
Br,
}