aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
authorGravatar Neil Blakey-Milner <nbm@nxsy.org> 2022-03-12 17:43:27 -0800
committerGravatar GitHub <noreply@github.com> 2022-03-12 17:43:27 -0800
commitde1dbbd0ac9b7b6e5690ab3d7b2ebfe7d6423802 (patch)
tree4f24e1d025440b6c7bf57ffab0ebe328380a351e /src/models.rs
parent669190ed6c5e7d21dcfeba1e6d3f300983546a09 (diff)
downloadnotion-de1dbbd0ac9b7b6e5690ab3d7b2ebfe7d6423802.tar.gz
notion-de1dbbd0ac9b7b6e5690ab3d7b2ebfe7d6423802.tar.zst
notion-de1dbbd0ac9b7b6e5690ab3d7b2ebfe7d6423802.zip
Add support for quote and equation blocks (#38)
Diffstat (limited to '')
-rw-r--r--src/models.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/models.rs b/src/models.rs
index dd886ac..9eab369 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -235,6 +235,11 @@ pub struct CodeFields {
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
+pub struct Equation {
+ pub expression: String,
+}
+
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum Block {
@@ -291,6 +296,16 @@ pub enum Block {
common: BlockCommon,
code: CodeFields,
},
+ Quote {
+ #[serde(flatten)]
+ common: BlockCommon,
+ quote: TextAndChildren,
+ },
+ Equation {
+ #[serde(flatten)]
+ common: BlockCommon,
+ equation: Equation,
+ },
#[serde(other)]
Unsupported,
}
@@ -308,7 +323,9 @@ impl AsIdentifier<BlockId> for Block {
| ToDo { common, .. }
| Toggle { common, .. }
| ChildPage { common, .. }
- | Code { common, .. } => &common.id,
+ | Code { common, .. }
+ | Quote { common, .. }
+ | Equation { common, .. } => &common.id,
Unsupported {} => {
panic!("Trying to reference identifier for unsupported block!")
}