Fix code system rendering for uri properties

This commit is contained in:
Grahame Grieve 2024-02-10 23:10:31 +11:00
parent 3e642e8bd8
commit 2628010dff
6 changed files with 1337 additions and 2 deletions

2
.gitignore vendored
View File

@ -307,3 +307,5 @@ local.properties
/org.hl7.fhir.r4b.new
org.hl7.fhir.r5/var/lib/.fhir/packages/
org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/DebugUtilities.java

View File

@ -11,6 +11,7 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.comparison.VersionComparisonAnnotation;
import org.hl7.fhir.r5.model.BooleanType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.Enumerations.CodeSystemContentMode;
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent;
@ -539,8 +540,15 @@ public class CodeSystemRenderer extends TerminologyRenderer {
if (first) first = false; else td.addText(", ");
if (pcv.hasValueCoding()) {
td.addText(pcv.getValueCoding().getCode());
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrl(pcv.getValue().primitiveValue())) {
CanonicalResource cr = (CanonicalResource) context.getContext().fetchResource(Resource.class, pcv.getValue().primitiveValue());
if (cr != null) {
td.ah(cr.getWebPath(), cr.getVersionedUrl()).tx(cr.present());
} else if (Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
} else {
td.code(pcv.getValue().primitiveValue());
}
} else if ("parent".equals(pcv.getCode())) {
td.ah("#"+cs.getId()+"-"+Utilities.nmtokenize(pcv.getValue().primitiveValue())).addText(pcv.getValue().primitiveValue());
} else {

View File

@ -31,6 +31,8 @@ public class XVerExtensionManager {
public static final String XVER_EXT_MARKER = "XVER_EXT_MARKER";
public static final String XVER_VER_MARKER = "XVER_VER_MARKER";
private Map<String, JsonObject> lists = new HashMap<>();
private IWorkerContext context;
@ -92,6 +94,7 @@ public class XVerExtensionManager {
StructureDefinition sd = new StructureDefinition();
sd.setUserData(XVER_EXT_MARKER, "true");
sd.setUserData(XVER_VER_MARKER, verSource);
if (context.getResourceNamesAsSet().contains(r)) {
sd.setWebPath(Utilities.pathURL(context.getSpecUrl(), r.toLowerCase()+"-definitions.html#"+e));
} else {

View File

@ -729,5 +729,15 @@ public class VersionUtilities {
}
}
public static boolean includedInRange(String startVer, String stopVer, String ver) {
if (ver.equals(startVer)) {
return true;
}
if (ver.equals(stopVer)) {
return true;
}
return startVer.compareTo(ver) < 0 && stopVer.compareTo(ver) > 0;
}
}

View File

@ -977,4 +977,26 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml {
return btn;
}
public XhtmlNode head() {
return addTag("head");
}
public XhtmlNode body() {
return addTag("body");
}
public XhtmlNode title(String title) {
return addTag("title").tx(title);
}
public XhtmlNode link(String rel, String href) {
return addTag("link").attribute("rel", rel).attribute("href", href);
}
public void wbr() {
addTag("wbr");
}
}