@@ -134,32 +134,26 @@ object Preparser {
134
134
135
135
def processLink : Unit =
136
136
if (! summon[DocContext ].args.noLinkWarnings) then tags.get(SimpleTagKey (" see" )).get.foreach(link => {
137
- val newLink : String = link.replaceAll(" \\ [\\ [|\\ ]\\ ]" , " " )
138
- val isValid = Try (new URL (newLink)).isSuccess
139
- isValid match {
140
- case true =>
141
- val url = new URL (newLink)
142
- url match {
143
- // We check if it's an internal link
144
- case s if s.getPath.contains(" /docs/" ) =>
145
- if (newLink.contains(" oracle" )) then // exclude links containing "oracle"
146
- None
147
- else
148
- // We check if the internal link to the static documentation is valid
149
- val docPath = url.getPath.substring(url.getPath.indexOf(" /docs/" )).replaceFirst(" /docs/" , " docs/_docs/" ).replace(" .html" , " .md" )
150
- println(docPath)
151
- val fileExists = Files .exists(Paths .get(docPath))
152
- if ! fileExists then
153
- // Si le fichier n'existe pas, on vérifie si le fichier existe avec l'extension .md
154
- val newDocPath = docPath + " .md"
155
- if ! Files .exists(Paths .get(newDocPath)) then
156
- report.warning(s " Link to $newLink will return a 404 not found " )
157
- case _ => None
158
- }
159
- case false =>
160
- None
137
+ val newLink = link.replaceAll(" \\ [\\ [|\\ ]\\ ]" , " " )
138
+ val newUrl = new URL (newLink)
139
+ if (Try (newUrl).isSuccess) {
140
+ if (newUrl.getPath.contains(" /docs/" )) {
141
+ if (newLink.contains(" oracle" ) || newLink.contains(" excludeValidation" )) then None
142
+ else
143
+ // We check if the internal link to the static documentation is valid
144
+ val docPath = newUrl.getPath.substring(newUrl.getPath.indexOf(" /docs/" ))
145
+ .replaceFirst(" /docs/(docs/)?" , " docs/_docs/" )
146
+ .replace(" .html" , " .md" )
147
+ println(docPath)
148
+ val fileExists = Files .exists(Paths .get(docPath))
149
+ if ! fileExists then
150
+ val newDocPath = docPath + " .md"
151
+ if ! Files .exists(Paths .get(newDocPath)) then report.warning(s " Link to $newLink will return a 404 not found " )
161
152
}
162
- })
153
+ else None
154
+ }
155
+ else None
156
+ })
163
157
164
158
val bodyTags : mutable.Map [TagKey , List [String ]] =
165
159
if tags.get(SimpleTagKey (" see" )).isDefined then
0 commit comments