Skip to content

Commit e4577ec

Browse files
committed
ResolveXrefs now reports every error in a document
1 parent 98e6fb1 commit e4577ec

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 1.0.0-alpha.9
22

3+
- Fixed xref resolution to report all errors in a given document at once.
34
- Changed the xref space placeholder character to a dash to match/roundtrip automatic file name titles.
45
- Removed the `ChildPages` shortcode (it should really be part of the theme).
56

src/Statiq.Web/Modules/ResolveXrefs.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class ResolveXrefs : Module
3737
{
3838
// Find and replace "xref:" in links
3939
bool modifiedDocument = false;
40+
bool errors = false;
4041
foreach (IElement element in htmlDocument
4142
.GetElementsByTagName("a")
4243
.Where(x => x.HasAttribute("href")))
@@ -58,13 +59,20 @@ public class ResolveXrefs : Module
5859
}
5960
else
6061
{
62+
// Continue processing so we can report all the failures in a given document
6163
input.LogError(error);
62-
return null;
64+
errors = true;
6365
}
6466
modifiedDocument = true;
6567
}
6668
}
6769

70+
// Exit if there were errors
71+
if (errors)
72+
{
73+
return null;
74+
}
75+
6876
// Return a new document with the replacements if we performed any
6977
if (modifiedDocument)
7078
{

0 commit comments

Comments
 (0)