From 83157e689f6bf90a53c6965a9fb7680440a1a55e Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 4 Jun 2020 10:37:18 +1000 Subject: [PATCH] Improve rendering of content reference in profiles --- .../fhir/r5/conformance/ProfileUtilities.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index c6ff21760..ecbb57dc1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -2992,6 +2992,16 @@ public class ProfileUtilities extends TranslatingUtilities { private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath, boolean root) { Cell c = gen.new Cell(); r.getCells().add(c); + if (e.hasContentReference()) { + ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference()); + if (ed == null) + c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", e.getContentReference()), null)); + else { + c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getPath()), null)); + c.getPieces().add(gen.new Piece("#"+ed.getPath(), tail(ed.getPath()), ed.getPath())); + } + return c; + } List types = e.getType(); if (!e.hasType()) { if (root) { // we'll use base instead of types then @@ -3840,13 +3850,6 @@ public class ProfileUtilities extends TranslatingUtilities { } } - if (definition.hasContentReference()) { - ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); - if (ed == null) - c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null)); - else - c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null)); - } if (definition.getPath().endsWith("url") && definition.hasFixed()) { c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else {