Fix up rendering of base64 content
This commit is contained in:
parent
6956f39502
commit
70e123e69b
|
@ -25,6 +25,7 @@ import org.hl7.fhir.r5.model.Address;
|
|||
import org.hl7.fhir.r5.model.Annotation;
|
||||
import org.hl7.fhir.r5.model.BackboneType;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.Base64BinaryType;
|
||||
import org.hl7.fhir.r5.model.BaseDateTimeType;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
|
@ -99,7 +100,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
|
||||
// -- 2. Markdown support -------------------------------------------------------
|
||||
|
||||
|
||||
public static String processRelativeUrls(String markdown, String path) {
|
||||
if (markdown == null) {
|
||||
return "";
|
||||
|
@ -726,6 +727,8 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
|||
}
|
||||
} else if (type instanceof MarkdownType) {
|
||||
addMarkdown(x, ((MarkdownType) type).asStringValue());
|
||||
} else if (type instanceof Base64BinaryType) {
|
||||
x.tx("(base64 data)");
|
||||
} else if (type.isPrimitive()) {
|
||||
x.tx(type.primitiveValue());
|
||||
} else {
|
||||
|
|
|
@ -377,9 +377,10 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
x.addText(((InstantType) e).toHumanDisplay());
|
||||
else if (e instanceof DateTimeType) {
|
||||
renderDateTime(x, e);
|
||||
} else if (e instanceof Base64BinaryType)
|
||||
x.addText(new Base64().encodeAsString(((Base64BinaryType) e).getValue()));
|
||||
else if (e instanceof org.hl7.fhir.r5.model.DateType) {
|
||||
} else if (e instanceof Base64BinaryType) {
|
||||
Base64BinaryType b64 = (Base64BinaryType) e;
|
||||
x.addText("(base64 data - "+(b64.getValue() == null ? "0" : b64.getValue().length)+" bytes)");
|
||||
} else if (e instanceof org.hl7.fhir.r5.model.DateType) {
|
||||
org.hl7.fhir.r5.model.DateType dt = ((org.hl7.fhir.r5.model.DateType) e);
|
||||
renderDate(x, dt);
|
||||
} else if (e instanceof Enumeration) {
|
||||
|
@ -853,12 +854,12 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
XhtmlNode tbl = new XhtmlNode(NodeType.Element, "table");
|
||||
tbl.setAttribute("class", "grid");
|
||||
XhtmlNode tr = tbl.tr();
|
||||
tr.td().tx("-"); // work around problem with empty table rows
|
||||
tr.td().style("display: hidden").tx("-"); // work around problem with empty table rows
|
||||
boolean add = addColumnHeadings(tr, grandChildren);
|
||||
for (BaseWrapper v : p.getValues()) {
|
||||
if (v != null) {
|
||||
tr = tbl.tr();
|
||||
tr.td().tx("*"); // work around problem with empty table rows
|
||||
tr.td().style("display: hidden").tx("*"); // work around problem with empty table rows
|
||||
add = addColumnValues(res, tr, grandChildren, v, showCodeDetails, displayHints, path, indent) || add;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue