private List<Piece> htmlToParagraphPieces(String html) throws IOException, FHIRException { List<Piece> myPieces = new ArrayList<Piece>(); String[] paragraphs = html.replace("<p>", "").split("<\\/p>|<br \\/>"); for (int i=0;i<paragraphs.length;i++) { if (!paragraphs[i].isEmpty()) { if (i!=0) { myPieces.add(new Piece("br")); myPieces.add(new Piece("br")); } myPieces.addAll(htmlFormattingToPieces(paragraphs[i])); } } return myPieces; } private List<Piece> htmlFormattingToPieces(String html) throws IOException, FHIRException {
if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, translate("sd.table", "URL")+": ", null).addStyle("font-weight:bold"));
} else { String name = urltail(eurl); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.addStyle("font-style: italic"); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.setStyle("text-decoration:line-through"); p.setReference(null);
c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode()!= null && t.getCode().equals("Reference")) { if (!allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasTitle() ? sd.getTitle() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null))); } else { String rn = t.getTargetProfile().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null))); if (ref.contains("|")) ref = ref.substring(0, ref.indexOf("|")); c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null))); } else c.addPiece(checkForNoChange(t, gen.new Piece(null, t.getTargetProfile(), null))); } else if (t.hasTargetProfile() && t.getTargetProfile().startsWith("#")) c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+t.getTargetProfile().substring(1).toLowerCase()+".html", t.getTargetProfile(), null))); else if (t.hasTargetProfile())
if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, translate("sd.table", "URL")+": ", null).addStyle("font-weight:bold"));
} else { String name = urltail(element.getType().get(0).getProfile()); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.addStyle("font-style: italic"); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.setStyle("text-decoration:line-through"); p.setReference(null);
if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, translate("sd.table", "URL")+": ", null).addStyle("font-weight:bold"));
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+definition.getContentReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (url != null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); if (binding!=null && !binding.isEmpty()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(profile, binding, definition.getPath()); c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(binding, gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null))); if (binding.hasStrength()) { c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(binding, gen.new Piece(corePath+"terminologies.html#"+binding.getStrength().toCode(), binding.getStrength().toCode(), binding.getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null));
} else { String name = urltail(eurl); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.addStyle("font-style: italic"); for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) { p.setStyle("text-decoration:line-through"); p.setReference(null);
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+definition.getContentReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (url != null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); if (binding!=null && !binding.isEmpty()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(profile, binding, definition.getPath()); c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(binding, gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null))); if (binding.hasStrength()) { c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(binding, gen.new Piece(corePath+"terminologies.html#"+binding.getStrength().toCode(), binding.getStrength().toCode(), binding.getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null));
Piece cc = gen.new Piece(null, ed.getName()+": ", null); c.addPiece(gen.new Piece("br")).addPiece(cc); c.addMarkdown(ed.getDescription()); c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(ed, ved.getBinding(), ved.getPath()); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, translate("sd.table", "Binding")+": ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null))); if (ved.getBinding().hasStrength()) { c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(corePath+"terminologies.html#"+ved.getBinding().getStrength().toCode(), egt(ved.getBinding().getStrengthElement()), ved.getBinding().getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null)); c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, describeExtensionContext(ed), null)); r.getCells().add(c);
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), e.getNameReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+e.getNameReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); return c; } else { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode().equals("Reference") || (t.getCode().equals("Resource") && t.hasProfile())) { if (ADD_REFERENCE_TO_TABLE && !allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasDisplay() ? sd.getDisplay() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+sd.getUserString("path"), disp, null))); } else { String rn = t.getProfile().get(0).getValue().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+pkp.getLinkFor(rn), rn, null)));
first = false; else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.hasTarget()) { c.getPieces().add(gen.new Piece(corePath+"references.html", t.getCode(), null)); c.getPieces().add(gen.new Piece(null, "(", null)); boolean tfirst = true; for (UriType u : t.getTargetProfile()) { tfirst = false; else c.addPiece(gen.new Piece(null, " | ", null)); if (u.getValue().startsWith("http://hl7.org/fhir/StructureDefinition/")) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, u.getValue()); if (sd != null) { String disp = sd.hasTitle() ? sd.getTitle() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null))); } else { String rn = u.getValue().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null))); if (ref.contains("|")) ref = ref.substring(0, ref.indexOf("|")); c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null))); } else c.addPiece(checkForNoChange(t, gen.new Piece(null, u.getValue(), null))); } else if (t.hasTargetProfile() && u.getValue().startsWith("#")) c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+u.getValue().substring(1).toLowerCase()+".html", u.getValue(), null)));
c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, ed.getName()+": "+ed.getDescription(), null)); if (!full && !(deep || vdeep) && ved != null && ved.hasBinding()) { c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(ed, ved.getBinding(), ved.getPath()); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, translate("sd.table", "Binding")+": ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null))); if (ved.getBinding().hasStrength()) { c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(corePath+"terminologies.html#"+ved.getBinding().getStrength().toCode(), egt(ved.getBinding().getStrengthElement()), ved.getBinding().getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null)); c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, describeExtensionContext(ed), null)); r.getCells().add(c);
if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, "XML Namespace: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, "XML Namespace: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+definition.getContentReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, definition.getShort(), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, fallback.getShort(), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); String ref = ed == null ? null : (String) corePath+ed.getUserData("path"); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold"));
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, definition.getShort(), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, fallback.getShort(), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); String ref = ed == null ? null : (String) corePath+ed.getUserData("path"); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(definition.getBinding()); c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url)? br.url : corePath+br.url, br.display, null))); if (definition.getBinding().hasStrength()) { c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(corePath+"terminologies.html#"+definition.getBinding().getStrength().toCode(), definition.getBinding().getStrength().toCode(), definition.getBinding().getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null));
c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode().equals("Reference") || (t.getCode().equals("Resource") && t.hasProfile())) { if (ADD_REFERENCE_TO_TABLE && !allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasDisplay() ? sd.getDisplay() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+sd.getUserString("path"), disp, null))); } else { String rn = t.getProfile().get(0).getValue().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+pkp.getLinkFor(rn), rn, null))); c.addPiece(checkForNoChange(t, gen.new Piece(null, t.getCode(), null))); } else if (t.getProfile().get(0).getValue().startsWith("#")) c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+t.getProfile().get(0).getValue().substring(1).toLowerCase()+".html", t.getProfile().get(0).getValue(), null))); else c.addPiece(checkForNoChange(t, gen.new Piece(corePath+t.getProfile().get(0).getValue(), t.getProfile().get(0).getValue(), null))); if (ADD_REFERENCE_TO_TABLE && !allReference) { c.getPieces().add(gen.new Piece(null, ")", null));
Cell left = gen.new Cell(); if (element.getType().size() == 1 && element.getType().get(0).isPrimitive()) left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement())).addStyle("font-weight:bold")); else left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement()))); if (element.hasSliceName()) { left.getPieces().add(gen.new Piece("br")); String indent = StringUtils.repeat('\u00A0', 1+2*(element.getPath().split("\\.").length)); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null));
Cell left = gen.new Cell(); if (element.getType().size() == 1 && element.getType().get(0).isPrimitive()) left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement())).addStyle("font-weight:bold")); else left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement()))); if (element.hasSliceName()) { left.getPieces().add(gen.new Piece("br")); String indent = StringUtils.repeat('\u00A0', 1+2*(element.getPath().split("\\.").length)); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null));
private void addNode(List<Piece> list, XhtmlNode c) { if (c.getNodeType() == NodeType.Text) list.add(new Piece(null, c.getContent(), null)); else if (c.getNodeType() == NodeType.Element) { if (c.getName().equals("a")) { list.add(new Piece(c.getAttribute("href"), c.allText(), c.getAttribute("title"))); } else if (c.getName().equals("b") || c.getName().equals("em") || c.getName().equals("strong")) { list.add(new Piece(null, c.allText(), null).setStyle("font-face: bold")); } else if (c.getName().equals("code")) { list.add(new Piece(null, c.allText(), null).setStyle("padding: 2px 4px; color: #005c00; background-color: #f9f2f4; white-space: nowrap; border-radius: 4px")); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("pre")) { Piece p = new Piece(c.getName()).setStyle("white-space: pre; font-family: courier"); list.add(p); p.getChildren().addAll(c.getChildNodes()); } else if (c.getName().equals("ul") || c.getName().equals("ol")) { Piece p = new Piece(c.getName()); list.add(p); p.getChildren().addAll(c.getChildNodes()); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("h1")||c.getName().equals("h2")||c.getName().equals("h3")||c.getName().equals("h4")) { Piece p = new Piece(c.getName()); list.add(p); p.getChildren().addAll(c.getChildNodes()); } else if (c.getName().equals("br")) { list.add(new Piece(c.getName())); } else {