diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-30 18:17:54 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-30 18:18:58 +0200 |
commit | 117cfc10c6d4a0a9346a29353860d1185d1ea224 (patch) | |
tree | a5ae0b1f36b7955016b83477b3f4dd455669d2af /tests/test_utils/hast.rs | |
parent | 9dd7a2ba67b7c35e9cd5c9105fdf36aec764fa6e (diff) | |
download | markdown-rs-117cfc10c6d4a0a9346a29353860d1185d1ea224.tar.gz markdown-rs-117cfc10c6d4a0a9346a29353860d1185d1ea224.tar.bz2 markdown-rs-117cfc10c6d4a0a9346a29353860d1185d1ea224.zip |
Add support for turning hast into swc
Diffstat (limited to 'tests/test_utils/hast.rs')
-rw-r--r-- | tests/test_utils/hast.rs | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/test_utils/hast.rs b/tests/test_utils/hast.rs index 4adf0ca..1ad8789 100644 --- a/tests/test_utils/hast.rs +++ b/tests/test_utils/hast.rs @@ -9,10 +9,11 @@ use alloc::{ string::{String, ToString}, vec::Vec, }; -use micromark::{mdast::AttributeContent, unist::Position}; +pub use micromark::mdast::{AttributeContent, AttributeValue, MdxJsxAttribute}; +use micromark::unist::Position; /// Nodes. -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Eq)] pub enum Node { /// Root. Root(Root), @@ -142,7 +143,7 @@ impl Node { /// > | a /// ^ /// ``` -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Root { // Parent. /// Content model. @@ -157,8 +158,7 @@ pub struct Root { /// > | <!doctype html> /// ^^^^^^^^^^^^^^^ /// ``` -// To do: clone. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Element { pub tag_name: String, pub properties: Vec<(String, PropertyValue)>, @@ -168,19 +168,12 @@ pub struct Element { pub position: Option<Position>, } -#[derive(Clone, Debug, PartialEq)] -pub enum PropertyItem { - Number(f32), - String(String), -} - -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum PropertyValue { - Number(f32), Boolean(bool), String(String), - CommaSeparated(Vec<PropertyItem>), - SpaceSeparated(Vec<PropertyItem>), + CommaSeparated(Vec<String>), + SpaceSeparated(Vec<String>), } /// Document type. @@ -232,7 +225,7 @@ pub struct Text { /// > | <a /> /// ^^^^^ /// ``` -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct MdxJsxElement { // Parent. /// Content model. |