fix tests
This commit is contained in:
parent
8ceb3cad05
commit
5494b14b4b
|
@ -335,6 +335,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
private boolean autoFixSliceNames;
|
||||
private XVerExtensionManager xver;
|
||||
private boolean wantFixDifferentialFirstElementType;
|
||||
private List<String> masterSourceFileNames;
|
||||
|
||||
public ProfileUtilities(IWorkerContext context, List<ValidationMessage> messages, ProfileKnowledgeProvider pkp, FHIRPathEngine fpe) {
|
||||
super();
|
||||
|
@ -2452,19 +2453,19 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (webUrl != null) {
|
||||
// also, must touch up the markdown
|
||||
if (element.hasDefinition())
|
||||
element.setDefinition(processRelativeUrls(element.getDefinition(), webUrl, baseSpecUrl(), context.getResourceNames()));
|
||||
element.setDefinition(processRelativeUrls(element.getDefinition(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
if (element.hasComment())
|
||||
element.setComment(processRelativeUrls(element.getComment(), webUrl, baseSpecUrl(), context.getResourceNames()));
|
||||
element.setComment(processRelativeUrls(element.getComment(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
if (element.hasRequirements())
|
||||
element.setRequirements(processRelativeUrls(element.getRequirements(), webUrl, baseSpecUrl(), context.getResourceNames()));
|
||||
element.setRequirements(processRelativeUrls(element.getRequirements(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
if (element.hasMeaningWhenMissing())
|
||||
element.setMeaningWhenMissing(processRelativeUrls(element.getMeaningWhenMissing(), webUrl, baseSpecUrl(), context.getResourceNames()));
|
||||
element.setMeaningWhenMissing(processRelativeUrls(element.getMeaningWhenMissing(), webUrl, baseSpecUrl(), context.getResourceNames(), masterSourceFileNames));
|
||||
}
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames) {
|
||||
public static String processRelativeUrls(String markdown, String webUrl, String basePath, List<String> resourceNames, List<String> filenames) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
int i = 0;
|
||||
while (i < markdown.length()) {
|
||||
|
@ -2485,7 +2486,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
// This code is trying to guess which relative references are actually to the
|
||||
// base specification.
|
||||
//
|
||||
if (isLikelySourceURLReference(url, resourceNames)) {
|
||||
if (isLikelySourceURLReference(url, resourceNames, filenames)) {
|
||||
b.append("](");
|
||||
b.append(basePath);
|
||||
i = i + 1;
|
||||
|
@ -2507,7 +2508,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
|
||||
public static boolean isLikelySourceURLReference(String url, List<String> resourceNames) {
|
||||
public static boolean isLikelySourceURLReference(String url, List<String> resourceNames, List<String> filenames) {
|
||||
if (resourceNames != null) {
|
||||
for (String n : resourceNames) {
|
||||
if (url.startsWith(n.toLowerCase()+".html")) {
|
||||
|
@ -2518,6 +2519,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (filenames != null) {
|
||||
for (String n : filenames) {
|
||||
if (url.startsWith(n.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
url.startsWith("extensibility.html") ||
|
||||
url.startsWith("terminologies.html") ||
|
||||
|
@ -6661,4 +6669,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
return getElementById(structure, structure.getSnapshot().getElement(), element.getContentReference());
|
||||
}
|
||||
|
||||
public List<String> getMasterSourceFileNames() {
|
||||
return masterSourceFileNames;
|
||||
}
|
||||
|
||||
public void setMasterSourceFileNames(List<String> masterSourceFileNames) {
|
||||
this.masterSourceFileNames = masterSourceFileNames;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class UnicodeUtilitiesTests {
|
|||
Assertions.assertNull(UnicodeUtilities.checkUnicodeWellFormed(UnicodeUtilities.RLI + " "+ UnicodeUtilities.LRI + "a b c "+
|
||||
UnicodeUtilities.PDI+" "+UnicodeUtilities.LRI+" d e f "+UnicodeUtilities.PDI+" "+UnicodeUtilities.PDI));
|
||||
Assertions.assertEquals(UnicodeUtilities.checkUnicodeWellFormed("'''subject funds from back account then "+UnicodeUtilities.RLI + "''' ;return"),
|
||||
"Unicode has unterminated bi-di control characters (see CVE-2021-42574): Unicode Character RLI at index 40 has no terminating match");
|
||||
"Unicode Character RLI at index 40 has no terminating match");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue