use of org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent in project kindling by HL7.
the class Publisher method produceIgPage.
private void produceIgPage(ImplementationGuideDefn ig, ImplementationGuideDefinitionPageComponent p) throws Exception {
String actualName = Utilities.path(page.getFolders().rootDir, Utilities.getDirectoryForFile(ig.getSource()), p.getNameUrlType().getValue());
String logicalName = Utilities.fileTitle(actualName);
String src;
if (IgParser.getKind(p) == GuidePageKind.TOC)
src = TextFile.fileToString(Utilities.path(page.getFolders().templateDir, "template-ig-toc.html"));
else
throw new Exception("Unsupported special page kind " + IgParser.getKind(p).toCode());
String file = ig.getCode() + File.separator + logicalName + ".html";
src = page.processPageIncludes(file, src, "page", null, null, null, logicalName, ig, null, null);
// before we save this page out, we're going to figure out what it's index
// is, and number the headers if we can
src = addSectionNumbers(file, logicalName, src, null, 1, null, ig);
TextFile.stringToFile(src, Utilities.path(page.getFolders().dstDir, file));
src = TextFile.fileToString(Utilities.path(page.getFolders().dstDir, file)).replace("<body>", "<body style=\"margin: 10px\">");
src = page.processPageIncludesForBook(file, src, "page", null, ig, null);
cachePage(file, src, logicalName, true);
}
use of org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent in project kindling by HL7.
the class IgParser method processPage.
private void processPage(ImplementationGuideDefinitionPageComponent page, ImplementationGuideDefn igd) throws Exception {
if (!page.hasTitle())
throw new Exception("Page " + page.getNameUrlType().getValue() + " has no name");
if (getKind(page) == null || getKind(page) == GuidePageKind.PAGE || getKind(page) == GuidePageKind.DIRECTORY || getKind(page) == GuidePageKind.LIST || getKind(page) == GuidePageKind.RESOURCE) {
checkExists(igd, page.getNameUrlType().getValue());
igd.getPageList().add(page.getNameUrlType().getValue());
}
for (ImplementationGuideDefinitionPageComponent pp : page.getPage()) {
processPage(pp, igd);
}
}
use of org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent in project kindling by HL7.
the class ImplementationGuideDefn method findLogicalPage.
private boolean findLogicalPage(String n, String type, List<LinkTriple> res, List<ImplementationGuideDefinitionPageComponent> page) throws Exception {
// see if we can find it as an example of an existing profile
String src = Utilities.fileTitle(n) + ".html";
for (ImplementationGuideDefinitionResourceComponent r : ig.getDefinition().getResource()) {
if (src.equals(r.getReference().getReference())) {
if (r.hasExampleCanonicalType()) {
String psrc = r.getExampleCanonicalType().getValueAsString().substring(r.getExampleCanonicalType().getValueAsString().lastIndexOf("/") + 1) + ".html";
if (findPage(psrc, res, page)) {
res.add(new LinkTriple(null, r.getName(), null));
return true;
}
}
}
}
// now, see if we can find a registry to make it a child of
String id = Utilities.fileTitle(n);
for (Example e : examples) {
if (e.getId().equals(id))
if (findRegistryPage(e.getResourceName(), res, page)) {
res.add(new LinkTriple(null, e.getName(), null));
return true;
}
}
if (type.startsWith("profile:"))
if (findRegistryPage("StructureDefinition", res, page)) {
res.add(new LinkTriple(null, "Profile", null));
return true;
}
if (findModified(n, "-operations.html", "Operations", res, page))
return true;
if (findModified(n, "-questionnaire.html", "Questionnaire", res, page))
return true;
if (findModified(n, ".profile.html", "StructureDefinition", res, page))
return true;
return false;
}
use of org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent in project kindling by HL7.
the class ImplementationGuideDefn method addPage.
private void addPage(HierarchicalTableGenerator gen, List<Row> rows, ImplementationGuideDefinitionPageComponent page) throws FHIRException {
Row row = gen.new Row();
rows.add(row);
row.setIcon(getIcon(IgParser.getKind(page)), IgParser.getKind(page).getDisplay());
String ndx = page.getUserString(ToolResourceUtilities.NAME_PAGE_INDEX);
if (ndx == null)
ndx = "";
else
ndx = ndx + " ";
row.getCells().add(gen.new Cell("", page.getNameUrlType().getValue(), ndx + page.getTitle(), null, null));
for (ImplementationGuideDefinitionPageComponent p : page.getPage()) {
addPage(gen, row.getSubRows(), p);
}
}
use of org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent in project kindling by HL7.
the class ImplementationGuideDefn method numberPages.
private void numberPages(List<ImplementationGuideDefinitionPageComponent> list, String prefix) {
for (int i = 0; i < list.size(); i++) {
ImplementationGuideDefinitionPageComponent page = list.get(i);
page.setUserData(ToolResourceUtilities.NAME_PAGE_INDEX, prefix + Integer.toString(i + 1) + (page.hasPage() ? ".0" : ""));
numberPages(page.getPage(), prefix + Integer.toString(i + 1) + ".");
}
}
Aggregations