Commit 9c2902d
authored
Handle empty files and truncated YAML front matter (#17527)
Scaladoc crashes when a static file is empty:
```
[error] Caused by: java.util.NoSuchElementException: head of empty list
[error] at scala.collection.immutable.Nil$.head(List.scala:662)
[error] at scala.collection.immutable.Nil$.head(List.scala:661)
[error] at dotty.tools.scaladoc.site.common$package$.loadTemplateFile(common.scala:66)
[error] at dotty.tools.scaladoc.site.StaticSiteLoader.loadRecursively(StaticSiteLoader.scala:191)
[error] at dotty.tools.scaladoc.site.StaticSiteLoader.loadRecursively$$anonfun$1(StaticSiteLoader.scala:188)
```
See sbt/sbt#7256 for more context.
This PR solves this issue, and also handles unended YAML front matter.File tree
4 files changed
+27
-3
lines changed- scaladoc
- src/dotty/tools/scaladoc/site
- test-documentations
- emptyPage/_docs
- noConfigEnd/_docs
- test/dotty/tools/scaladoc/site
4 files changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
98 | 114 | | |
99 | 115 | | |
100 | 116 | | |
| |||
0 commit comments