Skip to content

Commit 0648f97

Browse files
committed
Prevent some empty lines in the excerpt
1 parent 1736dcf commit 0648f97

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/lib/package/backend.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,17 +1346,20 @@ class PackageBackend {
13461346
/// Limit the changelog to 10 lines, 75 characters each:
13471347
final lines = text.split('\n');
13481348
final excerpt = lines
1349+
// prevent accidental HTML-tag creation
1350+
.map((line) => line
1351+
.replaceAll('<', '[')
1352+
.replaceAll('>', ']')
1353+
.replaceAll('&', ' ')
1354+
.trim())
13491355
// filter empty or decorative lines to maximalize usefulness
13501356
.where((line) =>
13511357
line.isNotEmpty &&
1358+
line != '-' && // empty list item
1359+
line != '1.' && // empty list item
13521360
!line.startsWith('```') && // also removes the need to escape it
13531361
!line.startsWith('---'))
13541362
.take(10)
1355-
// prevent accidental HTML-tag creation
1356-
.map((line) => line
1357-
.replaceAll('<', '[')
1358-
.replaceAll('>', ']')
1359-
.replaceAll('&', ' '))
13601363
.map((line) =>
13611364
line.length < 76 ? line : '${line.substring(0, 70)}[...]')
13621365
.join('\n');

0 commit comments

Comments
 (0)