@@ -32,17 +32,6 @@ object Sidebar:
32
32
33
33
private object RawInputTypeRef extends TypeReference [RawInput ]
34
34
35
- private def pageWithNoTitle (content : String | java.io.File ): String =
36
- val fileContent = content match {
37
- case file : java.io.File => Source .fromFile(file).getLines().mkString(" \n " )
38
- case str : String => str
39
- }
40
- val lines = fileContent.split(" \n " )
41
- lines.zipWithIndex
42
- .find { case (line, i) => line.trim.startsWith(" page:" ) && ! lines(i - 1 ).contains(" - title:" ) }
43
- .map(_._1.trim.stripPrefix(" page:" ))
44
- .getOrElse(" " )
45
-
46
35
private def toSidebar (r : RawInput , content : String | java.io.File )(using CompilerContext ): Sidebar = r match
47
36
case RawInput (title, page, index, subsection, dir, hidden) if page.nonEmpty && index.isEmpty && subsection.isEmpty() =>
48
37
val sidebarPath = content match
@@ -57,14 +46,13 @@ object Sidebar:
57
46
Sidebar .Category (Option .when(title.nonEmpty)(title), Option .when(index.nonEmpty)(index), subsection.asScala.map(toSidebar(_, content)).toList, Option .when(dir.nonEmpty)(dir))
58
47
case RawInput (title, page, index, subsection, dir, hidden) =>
59
48
if title.isEmpty() && index.isEmpty() then
60
- val page = pageWithNoTitle(content).trim()
61
- val msg = s " Error parsing YAML configuration file: 'title' is not provided for page ' $page'. "
49
+ val msg = " `title` property is missing for some page."
62
50
report.error(s " $msg\n $schemaMessage" )
63
51
else if title.nonEmpty && (page.isEmpty() || index.isEmpty()) then
64
52
val msg = s " Error parsing YAML configuration file: 'index' or 'page' path is missing for title ' $title'. "
65
53
report.error(s " $msg\n $schemaMessage" )
66
54
else
67
- val msg = s " Error parsing YAML configuration file."
55
+ val msg = " Problem when parsing YAML configuration file."
68
56
report.warning(s " $msg\n $schemaMessage" )
69
57
Sidebar .Page (None , page, hidden)
70
58
0 commit comments