Fix rendering of CanonicalResource.url

This commit is contained in:
Grahame Grieve 2020-12-03 12:55:20 +11:00
parent 1f2859e49b
commit 89249219fd
1 changed files with 16 additions and 19 deletions

View File

@ -222,8 +222,11 @@ public class DataRenderer extends Renderer {
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(path.substring(0, path.length()-4));
if (sd == null)
return false;
if (Utilities.existsInList(path.substring(0, path.length()-4), "CapabilityStatement", "StructureDefinition", "ImplementationGuide", "SearchParameter", "MessageDefinition", "OperationDefinition", "CompartmentDefinition", "StructureMap", "GraphDefinition",
"ExampleScenario", "CodeSystem", "ValueSet", "ConceptMap", "NamingSystem", "TerminologyCapabilities"))
if (Utilities.existsInList(path.substring(0, path.length()-4),
"ActivityDefinition", "CapabilityStatement", "CapabilityStatement2", "ChargeItemDefinition", "Citation", "CodeSystem",
"CompartmentDefinition", "ConceptMap", "ConditionDefinition", "EventDefinition", "Evidence", "EvidenceReport", "EvidenceVariable",
"ExampleScenario", "GraphDefinition", "ImplementationGuide", "Library", "Measure", "MessageDefinition", "NamingSystem", "PlanDefinition"
))
return true;
return sd.getBaseDefinitionElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-codegen-super");
}
@ -381,17 +384,10 @@ public class DataRenderer extends Renderer {
}
protected void renderUri(XhtmlNode x, UriType uri, String path, String id) {
String url = uri.getValue();
if (isCanonical(path)) {
CanonicalResource mr = getContext().getWorker().fetchResource(null, url);
if (mr != null) {
if (path.startsWith(mr.fhirType()+".") && mr.getId().equals(id)) {
url = null; // don't link to self whatever
} else if (mr.hasUserData("path"))
url = mr.getUserString("path");
} else if (!getContext().isCanonicalUrlsAsLinks())
url = null;
}
x.code().tx(uri.getValue());
} else {
String url = uri.getValue();
if (url == null) {
x.b().tx(uri.getValue());
} else if (uri.getValue().startsWith("mailto:")) {
@ -404,6 +400,7 @@ public class DataRenderer extends Renderer {
}
}
}
}
protected void renderAnnotation(XhtmlNode x, Annotation annot) {
renderAnnotation(x, annot, false);