Skip to content

Commit e24b88c

Browse files
cci: remove whitespace at end of rows
1 parent d685ee5 commit e24b88c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/models/ContributionSurveyRowParser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export default class ContributionSurveyRowParser {
9595
private current: string;
9696

9797
/**
98-
*
9998
* @param wikitext
10099
*/
101100
constructor( readonly wikitext: string ) {
@@ -138,7 +137,7 @@ export default class ContributionSurveyRowParser {
138137
const revids: number[] = [];
139138
const revidText: Record<number, string> = {};
140139
let diffs: string = null,
141-
comments: string,
140+
comments: string | null,
142141
diffTemplate = '[[Special:Diff/$1|($2)]]';
143142
if ( extras ) {
144143
const starting = this.current;
@@ -200,6 +199,11 @@ export default class ContributionSurveyRowParser {
200199
comments = this.getCurrentLength() > 0 ? this.eatRemaining() : null;
201200
}
202201

202+
if ( comments?.trim()?.length === 0 ) {
203+
// Comments are just spaces. Let's just drop comments altogether.
204+
comments = null;
205+
}
206+
203207
// "{bullet}{creation}[[{page}]]{extras}{diffs}{comments}"
204208
return {
205209
type: ( extras || comments || diffs ) == null ? 'pageonly' : 'detailed',

0 commit comments

Comments
 (0)