aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-20 17:06:00 +0200
commit65dd765cceee8bdccc74c08066eec59a579a16b1 (patch)
treecb60ab00039135b6f0a65efcb508f73a8b39aa11 /src/compiler.rs
parent61271d73128f8553f8c4c17927828cde52a25eba (diff)
downloadmarkdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.gz
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.tar.bz2
markdown-rs-65dd765cceee8bdccc74c08066eec59a579a16b1.zip
Add improved whitespace handling
* add several helpers for parsing betwen x and y `space_or_tab`s * use those helpers in a bunch of places * move initial indent parsing to flow constructs themselves
Diffstat (limited to '')
-rw-r--r--src/compiler.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index 59fcd22..366dcd9 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -108,7 +108,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::AutolinkMarker
| TokenType::AutolinkProtocol
| TokenType::BlankLineEnding
- | TokenType::BlankLineWhitespace
| TokenType::CharacterEscape
| TokenType::CharacterEscapeMarker
| TokenType::CharacterEscapeValue
@@ -118,10 +117,8 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::CharacterReferenceMarkerNumeric
| TokenType::CharacterReferenceMarkerSemi
| TokenType::CharacterReferenceValue
- | TokenType::CodeIndentedPrefixWhitespace
| TokenType::CodeFencedFence
| TokenType::CodeFencedFenceSequence
- | TokenType::CodeFencedFenceWhitespace
| TokenType::CodeFlowChunk
| TokenType::CodeTextData
| TokenType::CodeTextLineEnding
@@ -153,7 +150,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::LineEnding
| TokenType::ThematicBreak
| TokenType::ThematicBreakSequence
- | TokenType::ThematicBreakWhitespace
| TokenType::Whitespace => {
// Ignore.
}
@@ -172,7 +168,7 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
TokenType::CodeFenced => {
code_flow_seen_data = Some(false);
line_ending_if_needed(buffers);
- // Note: no `>`, which is added later.
+ // Note that no `>` is used, which is added later.
buf_tail_mut(buffers).push("<pre><code".to_string());
code_fenced_fences_count = Some(0);
}
@@ -203,14 +199,11 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
TokenType::Autolink
| TokenType::AutolinkMarker
| TokenType::BlankLineEnding
- | TokenType::BlankLineWhitespace
| TokenType::CharacterEscape
| TokenType::CharacterEscapeMarker
| TokenType::CharacterReference
| TokenType::CharacterReferenceMarkerSemi
| TokenType::CodeFencedFenceSequence
- | TokenType::CodeFencedFenceWhitespace
- | TokenType::CodeIndentedPrefixWhitespace
| TokenType::CodeTextSequence
| TokenType::DefinitionLabel
| TokenType::DefinitionLabelMarker
@@ -228,7 +221,6 @@ pub fn compile(events: &[Event], codes: &[Code], options: &CompileOptions) -> St
| TokenType::HardBreakTrailingSpace
| TokenType::HeadingSetext
| TokenType::ThematicBreakSequence
- | TokenType::ThematicBreakWhitespace
| TokenType::Whitespace => {
// Ignore.
}