diff options
Diffstat (limited to '')
-rw-r--r-- | src/to_mdast.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/to_mdast.rs b/src/to_mdast.rs index e76bad5..4659d7b 100644 --- a/src/to_mdast.rs +++ b/src/to_mdast.rs @@ -2,11 +2,12 @@ use crate::event::{Event, Kind, Name, Point as EventPoint}; use crate::mdast::{ - AttributeContent, AttributeValue, BlockQuote, Break, Code, Definition, Delete, Emphasis, - FootnoteDefinition, FootnoteReference, Heading, Html, Image, ImageReference, InlineCode, - InlineMath, Link, LinkReference, List, ListItem, Math, MdxFlowExpression, MdxJsxAttribute, - MdxJsxFlowElement, MdxJsxTextElement, MdxTextExpression, MdxjsEsm, Node, Paragraph, - ReferenceKind, Root, Strong, Table, TableCell, TableRow, Text, ThematicBreak, Toml, Yaml, + AttributeContent, AttributeValue, AttributeValueExpression, BlockQuote, Break, Code, + Definition, Delete, Emphasis, FootnoteDefinition, FootnoteReference, Heading, Html, Image, + ImageReference, InlineCode, InlineMath, Link, LinkReference, List, ListItem, Math, + MdxFlowExpression, MdxJsxAttribute, MdxJsxFlowElement, MdxJsxTextElement, MdxTextExpression, + MdxjsEsm, Node, Paragraph, ReferenceKind, Root, Strong, Table, TableCell, TableRow, Text, + ThematicBreak, Toml, Yaml, }; use crate::unist::{Point, Position}; use crate::util::{ @@ -14,7 +15,7 @@ use crate::util::{ decode as decode_character_reference, parse as parse_character_reference, }, infer::{gfm_table_align, list_item_loose, list_loose}, - mdx_collect::collect, + mdx_collect::{collect, Result as CollectResult}, normalize_identifier::normalize_identifier, slice::{Position as SlicePosition, Slice}, }; @@ -834,7 +835,7 @@ fn on_enter_mdx_jsx_tag_attribute(context: &mut CompileContext) -> Result<(), St fn on_enter_mdx_jsx_tag_attribute_expression(context: &mut CompileContext) -> Result<(), String> { on_enter_mdx_jsx_tag_any_attribute(context)?; - let result = collect( + let CollectResult { value, stops } = collect( context.events, context.bytes, context.index, @@ -846,7 +847,7 @@ fn on_enter_mdx_jsx_tag_attribute_expression(context: &mut CompileContext) -> Re .as_mut() .expect("expected tag") .attributes - .push(AttributeContent::Expression(result.value, result.stops)); + .push(AttributeContent::Expression { value, stops }); context.buffer(); @@ -855,7 +856,7 @@ fn on_enter_mdx_jsx_tag_attribute_expression(context: &mut CompileContext) -> Re /// Handle [`Enter`][Kind::Enter]:[`MdxJsxTagAttributeValueExpression`][Name::MdxJsxTagAttributeValueExpression]. fn on_enter_mdx_jsx_tag_attribute_value_expression(context: &mut CompileContext) { - let result = collect( + let CollectResult { value, stops } = collect( context.events, context.bytes, context.index, @@ -870,7 +871,10 @@ fn on_enter_mdx_jsx_tag_attribute_value_expression(context: &mut CompileContext) .attributes .last_mut() { - node.value = Some(AttributeValue::Expression(result.value, result.stops)); + node.value = Some(AttributeValue::Expression(AttributeValueExpression { + value, + stops, + })); } else { unreachable!("expected property") } |