fix profile generation issues

This commit is contained in:
Grahame Grieve 2021-01-14 12:21:33 +11:00
parent 9bdd663497
commit e0dabe6f33
4 changed files with 29 additions and 13 deletions

View File

@ -459,6 +459,10 @@ public class ProfileUtilities extends TranslatingUtilities {
}
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff) {
return getChildList(profile, path, id, diff, false);
}
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff, boolean refs) {
List<ElementDefinition> res = new ArrayList<ElementDefinition>();
boolean capturing = id==null;
@ -483,7 +487,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (capturing) {
String p = e.getPath();
if (!Utilities.noString(e.getContentReference()) && path.startsWith(p)) {
if (refs && !Utilities.noString(e.getContentReference()) && path.startsWith(p)) {
if (path.length() > p.length()) {
return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1), null, diff);
} else if (e.getContentReference().startsWith("#")) {
@ -511,6 +515,10 @@ public class ProfileUtilities extends TranslatingUtilities {
return res;
}
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff, boolean refs) {
return getChildList(structure, element.getPath(), element.getId(), diff, refs);
}
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff) {
return getChildList(structure, element.getPath(), element.getId(), diff);
}
@ -3313,7 +3321,7 @@ public class ProfileUtilities extends TranslatingUtilities {
c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath()));
} else {
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null));
c.getPieces().add(gen.new Piece(corePath+ed.getSource().getUserString("path")+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getType()+")", ed.getElement().getPath()));
c.getPieces().add(gen.new Piece(pfx(corePath, ed.getSource().getUserString("path"))+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getType()+")", ed.getElement().getPath()));
}
}
return c;
@ -3446,6 +3454,10 @@ public class ProfileUtilities extends TranslatingUtilities {
}
private String pfx(String prefix, String url) {
return Utilities.isAbsoluteUrl(url) ? url : prefix + url;
}
public void genTargetLink(HierarchicalTableGenerator gen, String profileBaseFileName, String corePath, Cell c, TypeRefComponent t, String u) {
if (u.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u);

View File

@ -149,7 +149,7 @@ public class TestingUtilities extends BaseTestingUtilities {
public static String checkXMLIsSame(String f1, String f2) throws Exception {
String result = compareXml(f1, f2);
if (result != null && SHOW_DIFF) {
String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe");
String diff = Utilities.path(System.getenv("ProgramFiles"), "WinMerge", "WinMergeU.exe");
List<String> command = new ArrayList<String>();
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");

View File

@ -181,7 +181,9 @@ public class ToolingExtensions {
public static final String EXT_EXP_FRAGMENT = "http://hl7.org/fhir/tools/StructureDefinition/expansion-codesystem-fragment";
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";
public static final String EXT_PATTERN = "http://hl7.org/fhir/StructureDefinition/elementdefinition-pattern";
// specific extension helpers
public static Extension makeIssueSource(Source source) {

View File

@ -240,16 +240,18 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
pieces.add(piece);
return this;
}
public Cell addMarkdown(String md) {
try {
Parser parser = Parser.builder().build();
Node document = parser.parse(md);
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
String html = renderer.render(document);
pieces.addAll(htmlToParagraphPieces(html, null));
} catch (Exception e) {
e.printStackTrace();
if (!Utilities.noString(md)) {
try {
Parser parser = Parser.builder().build();
Node document = parser.parse(md);
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
String html = renderer.render(document);
pieces.addAll(htmlToParagraphPieces(html, null));
} catch (Exception e) {
e.printStackTrace();
}
}
return this;
}