fix for empty markdown + rendering improvements for Bundles
This commit is contained in:
parent
f2f53c7872
commit
227bccbb35
|
@ -295,8 +295,7 @@ public class BundleRenderer extends ResourceRenderer {
|
||||||
try {
|
try {
|
||||||
xn = rr.build(be.getResource());
|
xn = rr.build(be.getResource());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
xn = new XhtmlNode();
|
xn = makeExceptionXhtml(e, "generating narrative");
|
||||||
xn.para().b().tx("Exception generating narrative: "+e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.blockquote().getChildNodes().addAll(checkInternalLinks(b, xn.getChildNodes()));
|
root.blockquote().getChildNodes().addAll(checkInternalLinks(b, xn.getChildNodes()));
|
||||||
|
|
|
@ -58,6 +58,7 @@ import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||||
|
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
||||||
|
|
||||||
|
@ -1021,6 +1022,21 @@ public class DataRenderer extends Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public XhtmlNode makeExceptionXhtml(Exception e, String function) {
|
||||||
|
XhtmlNode xn;
|
||||||
|
xn = new XhtmlNode(NodeType.Element, "div");
|
||||||
|
xn.para().b().tx("Exception "+function+": "+e.getMessage()).addComment(getStackTrace(e));
|
||||||
|
return xn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getStackTrace(Exception e) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append("\r\n");
|
||||||
|
for (StackTraceElement t : e.getStackTrace()) {
|
||||||
|
b.append(t.getClassName()+"."+t.getMethodName()+" ("+t.getFileName()+":"+t.getLineNumber());
|
||||||
|
b.append("\r\n");
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -56,6 +56,12 @@ public class MarkDownProcessor {
|
||||||
|
|
||||||
|
|
||||||
public String process(String source, String context) {
|
public String process(String source, String context) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ("".equals(source)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
switch (dialect) {
|
switch (dialect) {
|
||||||
case DARING_FIREBALL : return Processor.process(source);
|
case DARING_FIREBALL : return Processor.process(source);
|
||||||
case COMMON_MARK : return processCommonMark(source);
|
case COMMON_MARK : return processCommonMark(source);
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class I18nConstants {
|
||||||
public static final String FHIRPATH_UNKNOWN_CONSTANT = "FHIRPATH_UNKNOWN_CONSTANT";
|
public static final String FHIRPATH_UNKNOWN_CONSTANT = "FHIRPATH_UNKNOWN_CONSTANT";
|
||||||
public static final String FHIRPATH_UNKNOWN_CONTEXT = "FHIRPATH_UNKNOWN_CONTEXT";
|
public static final String FHIRPATH_UNKNOWN_CONTEXT = "FHIRPATH_UNKNOWN_CONTEXT";
|
||||||
public static final String FHIRPATH_UNKNOWN_CONTEXT_ELEMENT = "FHIRPATH_UNKNOWN_CONTEXT_ELEMENT";
|
public static final String FHIRPATH_UNKNOWN_CONTEXT_ELEMENT = "FHIRPATH_UNKNOWN_CONTEXT_ELEMENT";
|
||||||
public static final String FHIRPATH_UNKNOWN_NAME = "FHIRPATH_UNWKNOWN_NAME";
|
public static final String FHIRPATH_UNKNOWN_NAME = "FHIRPATH_UNKNOWN_NAME";
|
||||||
public static final String FHIRPATH_WRONG_PARAM_TYPE = "FHIRPATH_WRONG_PARAM_TYPE";
|
public static final String FHIRPATH_WRONG_PARAM_TYPE = "FHIRPATH_WRONG_PARAM_TYPE";
|
||||||
public static final String FIXED_TYPE_CHECKS_DT_ADDRESS_LINE = "Fixed_Type_Checks_DT_Address_Line";
|
public static final String FIXED_TYPE_CHECKS_DT_ADDRESS_LINE = "Fixed_Type_Checks_DT_Address_Line";
|
||||||
public static final String FIXED_TYPE_CHECKS_DT_NAME_FAMILY = "Fixed_Type_Checks_DT_Name_Family";
|
public static final String FIXED_TYPE_CHECKS_DT_NAME_FAMILY = "Fixed_Type_Checks_DT_Name_Family";
|
||||||
|
@ -466,6 +466,7 @@ public class I18nConstants {
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_REGEX = "Type_Specific_Checks_DT_Primitive_Regex";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_REGEX = "Type_Specific_Checks_DT_Primitive_Regex";
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_VALUEEXT = "Type_Specific_Checks_DT_Primitive_ValueExt";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_VALUEEXT = "Type_Specific_Checks_DT_Primitive_ValueExt";
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_WS = "Type_Specific_Checks_DT_Primitive_WS";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_WS = "Type_Specific_Checks_DT_Primitive_WS";
|
||||||
|
public static final String TYPE_SPECIFIC_CHECKS_DT_QTY_NO_ANNOTATIONS = "TYPE_SPECIFIC_CHECKS_DT_QTY_NO_ANNOTATIONS";
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH = "Type_Specific_Checks_DT_String_Length";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH = "Type_Specific_Checks_DT_String_Length";
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_WS = "Type_Specific_Checks_DT_String_WS";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_WS = "Type_Specific_Checks_DT_String_WS";
|
||||||
public static final String TYPE_SPECIFIC_CHECKS_DT_TIME_VALID = "Type_Specific_Checks_DT_Time_Valid";
|
public static final String TYPE_SPECIFIC_CHECKS_DT_TIME_VALID = "Type_Specific_Checks_DT_Time_Valid";
|
||||||
|
|
Loading…
Reference in New Issue