diff --git a/src/snapshots/rust_norg__tests__definitions.snap b/src/snapshots/rust_norg__tests__definitions.snap index 5975e54..9f3dbca 100644 --- a/src/snapshots/rust_norg__tests__definitions.snap +++ b/src/snapshots/rust_norg__tests__definitions.snap @@ -5,7 +5,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Definition title: - - Text: Term + - Token: + Text: Term extensions: [] content: - Paragraph: @@ -14,7 +15,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Definition title: - - Text: Term + - Token: + Text: Term extensions: [] content: - Paragraph: diff --git a/src/snapshots/rust_norg__tests__footnotes.snap b/src/snapshots/rust_norg__tests__footnotes.snap index 797d1fb..e2ecaa8 100644 --- a/src/snapshots/rust_norg__tests__footnotes.snap +++ b/src/snapshots/rust_norg__tests__footnotes.snap @@ -5,7 +5,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Footnote title: - - Text: Title + - Token: + Text: Title extensions: [] content: - Paragraph: @@ -14,7 +15,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Footnote title: - - Text: Title + - Token: + Text: Title extensions: [] content: - Paragraph: diff --git a/src/snapshots/rust_norg__tests__headings.snap b/src/snapshots/rust_norg__tests__headings.snap index 52f2a00..3274aa9 100644 --- a/src/snapshots/rust_norg__tests__headings.snap +++ b/src/snapshots/rust_norg__tests__headings.snap @@ -5,17 +5,20 @@ expression: examples - - Heading: level: 1 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - - Heading: level: 9 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - - Heading: level: 1 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - Paragraph: - Token: @@ -25,45 +28,56 @@ expression: examples - - Heading: level: 7 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - - Heading: level: 1 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - Heading: level: 1 title: - - Text: Another - - Whitespace - - Text: heading + - Token: + Text: Another + - Token: Whitespace + - Token: + Text: heading extensions: [] - - Heading: level: 1 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - Heading: level: 2 title: - - Text: Subheading + - Token: + Text: Subheading extensions: [] - Heading: level: 1 title: - - Text: Back - - Whitespace - - Text: to - - Whitespace - - Text: regular - - Whitespace - - Text: heading + - Token: + Text: Back + - Token: Whitespace + - Token: + Text: to + - Token: Whitespace + - Token: + Text: regular + - Token: Whitespace + - Token: + Text: heading extensions: [] - - Heading: level: 1 title: - - Text: Heading + - Token: + Text: Heading extensions: [] - Paragraph: - Token: @@ -76,7 +90,8 @@ expression: examples - Heading: level: 2 title: - - Text: Subheading + - Token: + Text: Subheading extensions: [] - Paragraph: - Token: @@ -95,11 +110,15 @@ expression: examples - Heading: level: 1 title: - - Text: Back - - Whitespace - - Text: to - - Whitespace - - Text: regular - - Whitespace - - Text: heading + - Token: + Text: Back + - Token: Whitespace + - Token: + Text: to + - Token: Whitespace + - Token: + Text: regular + - Token: Whitespace + - Token: + Text: heading extensions: [] diff --git a/src/snapshots/rust_norg__tests__ranged_tags.snap b/src/snapshots/rust_norg__tests__ranged_tags.snap index 3f2bdaf..756d1d5 100644 --- a/src/snapshots/rust_norg__tests__ranged_tags.snap +++ b/src/snapshots/rust_norg__tests__ranged_tags.snap @@ -67,10 +67,13 @@ expression: examples - Heading: level: 1 title: - - Text: Hello - - Whitespace - - Text: world - - Special: "!" + - Token: + Text: Hello + - Token: Whitespace + - Token: + Text: world + - Token: + Special: "!" extensions: [] - - RangedTag: name: @@ -85,10 +88,13 @@ expression: examples - Heading: level: 1 title: - - Text: Hello - - Whitespace - - Text: world - - Special: "!" + - Token: + Text: Hello + - Token: Whitespace + - Token: + Text: world + - Token: + Special: "!" extensions: [] - - RangedTag: name: @@ -155,10 +161,13 @@ expression: examples - Heading: level: 1 title: - - Text: Hello - - Whitespace - - Text: world - - Special: "!" + - Token: + Text: Hello + - Token: Whitespace + - Token: + Text: world + - Token: + Special: "!" extensions: [] - - RangedTag: name: @@ -173,8 +182,11 @@ expression: examples - Heading: level: 1 title: - - Text: Hello - - Whitespace - - Text: world - - Special: "!" + - Token: + Text: Hello + - Token: Whitespace + - Token: + Text: world + - Token: + Special: "!" extensions: [] diff --git a/src/snapshots/rust_norg__tests__tables.snap b/src/snapshots/rust_norg__tests__tables.snap index d9cd6a2..9737275 100644 --- a/src/snapshots/rust_norg__tests__tables.snap +++ b/src/snapshots/rust_norg__tests__tables.snap @@ -5,7 +5,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Table title: - - Text: A1 + - Token: + Text: A1 extensions: [] content: - Paragraph: @@ -17,7 +18,8 @@ expression: examples - - RangeableDetachedModifier: modifier_type: Table title: - - Text: A1 + - Token: + Text: A1 extensions: [] content: - Paragraph: diff --git a/src/stage_3.rs b/src/stage_3.rs index 3dbde58..9b48f5b 100644 --- a/src/stage_3.rs +++ b/src/stage_3.rs @@ -501,13 +501,13 @@ pub enum NorgASTFlat { }, RangeableDetachedModifier { modifier_type: RangeableDetachedModifier, - title: ParagraphTokenList, + title: Vec, extensions: Vec, content: Vec, }, Heading { level: u16, - title: ParagraphTokenList, + title: Vec, extensions: Vec, }, CarryoverTag { @@ -636,7 +636,7 @@ pub fn stage_3( NorgBlock::RangeableDetachedModifier { modifier_type: ':', ranged: false, title, extension_section } => (RangeableDetachedModifier::Table, title, extension_section), }.then(paragraph).map(|((modifier_type, title, extension_section), paragraph)| NorgASTFlat::RangeableDetachedModifier { modifier_type, - title, + title: parse_paragraph(title).unwrap(), extensions: detached_modifier_extensions().parse(extension_section).unwrap_or_default(), content: vec![paragraph], }); @@ -652,7 +652,7 @@ pub fn stage_3( if opening_ch == closing_ch { Ok(NorgASTFlat::RangeableDetachedModifier { modifier_type, - title, + title: parse_paragraph(title).unwrap(), extensions: detached_modifier_extensions().parse(extension_section).unwrap_or_default(), content, }) @@ -665,7 +665,7 @@ pub fn stage_3( } .try_map(move |(level, title, extension_section), _span| Ok(NorgASTFlat::Heading { level, - title, + title: parse_paragraph(title).unwrap(), extensions: detached_modifier_extensions().parse(extension_section).unwrap_or_default(), }));