fix broken links in R5 builds

This commit is contained in:
Grahame Grieve 2023-02-14 09:53:22 +11:00
parent 43eabcd7ab
commit d5d83bea9c
3 changed files with 39 additions and 15 deletions

View File

@ -29,6 +29,7 @@ import org.hl7.fhir.r5.utils.PublicationHacker;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece;
@ -319,36 +320,54 @@ public class AdditionalBindingsRenderer {
}
private void renderPurpose(XhtmlNode td, String purpose) {
boolean r5 = VersionUtilities.isR5Plus(context.getWorker().getVersion());
switch (purpose) {
case "maximum":
td.ah(corePath+"extension-elementdefinition-maxvalueset.html", "A required binding, for use when the binding strength is 'extensible' or 'preferred'").tx("Max Binding");
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-maximum" : corePath+"extension-elementdefinition-maxvalueset.html", "A required binding, for use when the binding strength is 'extensible' or 'preferred'").tx("Max Binding");
break;
case "minimum":
td.ah(corePath+"extension-elementdefinition-minvalueset.html", "The minimum allowable value set - any conformant system SHALL support all these codes").tx("Min Binding");
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-minimum" : corePath+"extension-elementdefinition-minvalueset.html", "The minimum allowable value set - any conformant system SHALL support all these codes").tx("Min Binding");
break;
case "required" :
td.ah(corePath+"terminologies.html#strength", "Validators will check this binding (strength = required)").tx("Validation Binding");
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-required" : corePath+"terminologies.html#strength", "Validators will check this binding (strength = required)").tx("Required Binding");
break;
case "extensible" :
td.ah(corePath+"terminologies.html#strength", "Validators will check this binding (strength = extensible)").tx("Validation Binding");
break;
case "candidate" :
td.ah(corePath+"terminologies.html#strength", "This is a candidate binding that constraints on this profile may consider (see doco)").tx("Candidate Validation Binding");
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-extensible" : corePath+"terminologies.html#strength", "Validators will check this binding (strength = extensible)").tx("Extensible Binding");
break;
case "current" :
td.span(null, "New records are required to use this value set, but legacy records may use other codes").tx("Required");
if (r5) {
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-current" : corePath+"terminologies.html#strength", "New records are required to use this value set, but legacy records may use other codes").tx("Current Binding");
} else {
td.span(null, "New records are required to use this value set, but legacy records may use other codes").tx("Required");
}
break;
case "preferred" :
td.span(null, "This is the value set that is recommended (documentation should explain why)").tx("Recommended");
if (r5) {
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-preferred" : corePath+"terminologies.html#strength", "This is the value set that is recommended (documentation should explain why)").tx("Preferred Binding");
} else {
td.span(null, "This is the value set that is recommended (documentation should explain why)").tx("Recommended");
}
break;
case "ui" :
td.span(null, "This value set is provided to user look up in a given context").tx("UI");
if (r5) {
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-ui" : corePath+"terminologies.html#strength", "This value set is provided to user look up in a given context").tx("UI Binding");
} else {
td.span(null, "This value set is provided to user look up in a given context").tx("UI");
}
break;
case "starter" :
td.span(null, "This value set is a good set of codes to start with when designing your system").tx("Starter");
if (r5) {
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-starter" : corePath+"terminologies.html#strength", "This value set is a good set of codes to start with when designing your system").tx("Starter Set");
} else {
td.span(null, "This value set is a good set of codes to start with when designing your system").tx("Starter");
}
break;
case "component" :
td.span(null, "This value set is a component of the base value set").tx("Component");
if (r5) {
td.ah(r5 ? "valueset-additional-binding-purpose.html#additional-binding-purpose-component" : corePath+"terminologies.html#strength", "This value set is a component of the base value set").tx("Component");
} else {
td.span(null, "This value set is a component of the base value set").tx("Component");
}
break;
default:
td.span(null, "Unknown code for purpose").tx(purpose);

View File

@ -608,5 +608,9 @@ public class VersionUtilities {
}
}
public static boolean isR5Plus(String version) {
return version != null && (version.startsWith("5.") || version.startsWith("6.") || "current".equals(version));
}
}

View File

@ -5994,8 +5994,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
private boolean checkInvariants(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, Element resource, Element element, boolean onlyNonInherited) throws FHIRException, FHIRException {
if (noInvariantChecks)
if (noInvariantChecks) {
return true;
}
boolean ok = true;
for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) {