Skip to content

Commit cb0f5e7

Browse files
committed
Remove excess blank lines
1 parent d77b9cf commit cb0f5e7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

data/generated/proc_testing-a-procedure.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Delete this section if it does not apply to your module. Provide the user with v
4545

4646
. Use an unnumbered bullet (*) if the procedure includes only one step.
4747

48-
4948
[role="_additional-resources"]
5049
.Additional resources
5150
////

src/templating.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,18 @@ impl Input {
129129
.to_string();
130130
}
131131

132+
// Remove excess blank lines that might have been left by the verious
133+
// replacement stages. Make sure that the result contains no more than one
134+
// consecutive blank line.
135+
let two_blanks = "\n\n\n";
136+
let one_blank = "\n\n";
137+
138+
while document.contains(two_blanks) {
139+
document = document.replace(two_blanks, one_blank);
140+
}
141+
132142
// Add newlines at the end of the document to prevent potential issues
133143
// when including two AsciiDoc files right next to each other.
134-
document + "\n\n"
144+
document + one_blank
135145
}
136146
}

0 commit comments

Comments
 (0)