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