From 65f51b446cfe1fe4da9143bfe5d71ad56e051dd6 Mon Sep 17 00:00:00 2001
From: Titus Wormer ");
- context.last_was_tag = true;
}
}
@@ -600,7 +587,6 @@ fn on_enter_resource_destination_string(context: &mut CompileContext) {
fn on_enter_strong(context: &mut CompileContext) {
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -619,14 +605,12 @@ fn on_exit_autolink_email(context: &mut CompileContext) {
&context.protocol_href,
));
context.push("\">");
- context.last_was_tag = true;
}
context.push_raw(value);
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -642,14 +626,12 @@ fn on_exit_autolink_protocol(context: &mut CompileContext) {
context.push("");
- context.last_was_tag = true;
}
context.push_raw(value);
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -657,7 +639,6 @@ fn on_exit_autolink_protocol(context: &mut CompileContext) {
fn on_exit_break(context: &mut CompileContext) {
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
/// Handle [`Enter`][EventType::Enter]:[`CodeIndented`][Token::CodeIndented].
@@ -396,7 +393,6 @@ fn on_enter_code_indented(context: &mut CompileContext) {
context.code_flow_seen_data = Some(false);
context.line_ending_if_needed();
context.push("
");
- context.last_was_tag = true;
}
/// Handle [`Exit`][EventType::Exit]:[`CharacterReferenceMarker`][Token::CharacterReferenceMarker].
@@ -737,7 +717,6 @@ fn on_exit_code_fenced_fence(context: &mut CompileContext) {
if count == 0 {
context.push(">");
- context.last_was_tag = true;
context.slurp_one_line_ending = true;
}
@@ -750,7 +729,6 @@ fn on_exit_code_fenced_fence_info(context: &mut CompileContext) {
context.push(" class=\"language-");
context.push(&value);
context.push("\"");
- context.last_was_tag = true;
}
/// Handle [`Exit`][EventType::Exit]:{[`CodeFenced`][Token::CodeFenced],[`CodeIndented`][Token::CodeIndented]}.
@@ -766,7 +744,13 @@ fn on_exit_code_flow(context: &mut CompileContext) {
// fenced code and block quote by micromark, but CM wants to treat that
// ending as part of the code.
if let Some(count) = context.code_fenced_fences_count {
- if count == 1 && !context.tight_stack.is_empty() && !context.last_was_tag {
+ // No closing fence.
+ if count == 1
+ // In a container.
+ && !context.tight_stack.is_empty()
+ // Empty (as the closing is right at the opening fence)
+ && context.events[context.index - 1].token_type != Token::CodeFencedFence
+ {
context.line_ending();
}
}
@@ -778,7 +762,6 @@ fn on_exit_code_flow(context: &mut CompileContext) {
}
context.push("");
- context.last_was_tag = true;
if let Some(count) = context.code_fenced_fences_count.take() {
if count < 2 {
@@ -815,7 +798,6 @@ fn on_exit_code_text(context: &mut CompileContext) {
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -883,7 +865,6 @@ fn on_exit_definition_title_string(context: &mut CompileContext) {
fn on_exit_emphasis(context: &mut CompileContext) {
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -897,7 +878,6 @@ fn on_exit_heading_atx(context: &mut CompileContext) {
context.push("");
- context.last_was_tag = true;
}
/// Handle [`Exit`][EventType::Exit]:[`HeadingAtxSequence`][Token::HeadingAtxSequence].
@@ -914,7 +894,6 @@ fn on_exit_heading_atx_sequence(context: &mut CompileContext) {
context.push("");
- context.last_was_tag = true;
}
/// Handle [`Enter`][EventType::Enter]:[`CodeFenced`][Token::CodeFenced].
@@ -405,7 +401,6 @@ fn on_enter_code_fenced(context: &mut CompileContext) {
context.line_ending_if_needed();
// Note that no `>` is used, which is added later.
context.push("
");
- context.last_was_tag = true;
}
context.buffer();
}
@@ -442,7 +436,6 @@ fn on_enter_definition_destination_string(context: &mut CompileContext) {
fn on_enter_emphasis(context: &mut CompileContext) {
if !context.in_image_alt {
context.push("");
- context.last_was_tag = true;
}
}
@@ -549,7 +542,6 @@ fn on_enter_list(context: &mut CompileContext) {
} else {
"
");
- context.last_was_tag = true;
}
context.line_ending_if_needed();
context.push("
");
- context.last_was_tag = true;
}
}
@@ -674,7 +655,6 @@ fn on_exit_block_quote(context: &mut CompileContext) {
context.line_ending_if_needed();
context.slurp_one_line_ending = false;
context.push("