Skip to content

Commit d051f2b

Browse files
committed
Remove the validation of path-based xrefs (no longer recommended)
1 parent ef4239e commit d051f2b

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/validation.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ mod content {
344344
reports.push(experimental_issue);
345345
}
346346

347-
reports.append(check_path_xrefs(content).as_mut());
348347
reports.append(check_metadata_variable(content).as_mut());
349348

350349
reports
@@ -458,38 +457,6 @@ mod content {
458457
None
459458
}
460459
}
461-
462-
/// Check that supported xrefs are path-based.
463-
/// Report issues as warnings because ID-based xrefs might still work in some instances, such as within the file.
464-
fn check_path_xrefs(content: &str) -> Vec<IssueReport> {
465-
// Check only those xrefs that have labels. Skip unsupported, label-less xrefs, which are reported elsewhere.
466-
let xref_regex = Regex::new(r"xref:(\S+)\[\S+.*?\]").unwrap();
467-
// This regex checks only the captured content of the xref.
468-
let path_based_regex = Regex::new(r"\S+\.(?:adoc|asciidoc)$").unwrap();
469-
470-
let mut issues = Vec::new();
471-
472-
for (index, line) in content.lines().enumerate() {
473-
if let Some(xref) = xref_regex.captures(line) {
474-
if path_based_regex.is_match(
475-
xref.get(1)
476-
.expect("Cannot capture the xref content.")
477-
.as_str(),
478-
) {
479-
// This xref is path-based. This is the correct form. Skip.
480-
} else {
481-
// This xref is not path-based. Report.
482-
issues.push(IssueReport {
483-
line_number: Some(index),
484-
description: "This xref does not appear to be path-based. Make sure that it works in your assembly.",
485-
severity: IssueSeverity::Warning,
486-
});
487-
}
488-
}
489-
}
490-
491-
issues
492-
}
493460
}
494461

495462
// This section groups all module requirements;

0 commit comments

Comments
 (0)