use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class Publisher method cloneToXhtml.
private void cloneToXhtml(String n, String description, boolean adorn, String pageType, String crumbTitle, ImplementationGuideDefn igd, ResourceDefn rd, WorkGroup wg) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document xdoc = builder.parse(new CSFileInputStream(new CSFile(page.getFolders().dstDir + n + ".xml")));
XhtmlGenerator xhtml = new XhtmlGenerator(new ExampleAdorner(page.getDefinitions(), page.genlevel(Utilities.charCount(n, File.separatorChar))));
ByteArrayOutputStream b = new ByteArrayOutputStream();
xhtml.generate(xdoc, b, n.toUpperCase().substring(0, 1) + n.substring(1), description, 0, adorn, n + ".xml.html");
String html = TextFile.fileToString(page.getFolders().templateDir + "template-example-xml.html").replace("<%example%>", b.toString());
html = page.processPageIncludes(n + ".xml.html", html, pageType, null, n + ".xml.html", null, null, crumbTitle, (adorn && hasNarrative(xdoc)) ? new Boolean(true) : null, igd, rd, wg);
TextFile.stringToFile(html, page.getFolders().dstDir + n + ".xml.html");
// page.getEpub().registerFile(n + ".xml.html", description, EPubManager.XHTML_TYPE);
page.getHTMLChecker().registerExternal(n + ".xml.html");
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method cloneToXhtml.
private void cloneToXhtml(String src, String dst, String name, String description, int level, boolean adorn, String pageType, String crumbTitle, ImplementationGuideDefn ig, ResourceDefn rd, WorkGroup wg) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document xdoc = builder.parse(new CSFileInputStream(new CSFile(src)));
// XhtmlGenerator xhtml = new XhtmlGenerator(null);
// xhtml.generate(xdoc, new CSFile(dst), name, description, level, adorn);
String n = new File(dst).getName();
n = n.substring(0, n.length() - 9);
XhtmlGenerator xhtml = new XhtmlGenerator(new ExampleAdorner(definitions, genlevel(level)));
ByteArrayOutputStream b = new ByteArrayOutputStream();
xhtml.generate(xdoc, b, name, description, level, adorn, n + ".xml.html");
String html = ("<%setlevel " + Integer.toString(level) + "%>" + TextFile.fileToString(folders.srcDir + "template-example-xml.html")).replace("<%example%>", b.toString());
html = processPageIncludes(n + ".xml.html", html, pageType, null, n + ".xml.html", null, null, crumbTitle, (adorn && hasNarrative(xdoc)) ? new Boolean(true) : null, ig, rd, wg);
TextFile.stringToFile(html, dst);
htmlchecker.registerExternal(dst);
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildResListByCommittee.
private String buildResListByCommittee() {
List<String> res = new ArrayList<String>();
for (ResourceDefn rd : definitions.getBaseResources().values()) res.add(rd.getWg().getName() + ":" + rd.getName());
for (ResourceDefn rd : definitions.getResources().values()) res.add(rd.getWg().getName() + ":" + rd.getName());
Collections.sort(res);
StringBuilder b = new StringBuilder();
for (String s : sorted(definitions.getWorkgroups().keySet())) {
WorkGroup wg = definitions.getWorkgroups().get(s);
boolean first = true;
for (String rn : res) {
if (rn.startsWith(wg.getName() + ":")) {
if (first) {
b.append("<p><b>");
b.append(Utilities.escapeXml(wg.getName()));
b.append("</b></p>\r\n<ul style=\"width: 90%; -moz-column-count: 4; -moz-column-gap: 10px; -webkit-column-count: 4; -webkit-column-gap: 10px; column-count: 4; column-gap: 10px\">\r\n");
first = false;
}
String r = rn.substring(rn.indexOf(":") + 1);
b.append(" <li><a title=\"[%resdesc " + r + "%]\" href=\"" + r.toLowerCase() + ".html\">" + r + " [%fmmshort " + r + "%]</a></li>\r\n");
}
}
if (!first)
b.append("</ul>\r\n");
}
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method genOperationsSummary.
private String genOperationsSummary(List<Operation> oplist, ResourceDefn resource) throws Exception {
StringBuilder b = new StringBuilder();
b.append("<table class=\"list\">\r\n");
for (Operation op : oplist) {
b.append("<tr><td><a href=\"" + resource.getName().toLowerCase() + "-operation-" + op.getName() + ".html\">$" + Utilities.escapeXml(op.getName()) + "</a></td><td>" + Utilities.escapeXml(op.getTitle()) + "</td>");
if (resource.getStatus() == StandardsStatus.NORMATIVE) {
if (op.getStandardsStatus() == null)
b.append("<td><a class=\"" + resource.getStatus().toCode() + "-flag\" href=\"versions.html#std-process\">" + resource.getStatus().toDisplay() + "</a></td>");
else
b.append("<td><a class=\"" + op.getStandardsStatus().toCode() + "-flag\" href=\"versions.html#std-process\">" + op.getStandardsStatus().toDisplay() + "</a></td>");
}
b.append("</tr>\r\n");
}
b.append("</table>\r\n");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildOpReferenceList.
private String buildOpReferenceList(String rt) {
StringBuilder b = new StringBuilder();
b.append("<ul>\r\n");
for (String rn : definitions.sortedResourceNames()) {
ResourceDefn rd = definitions.getResources().get(rn);
for (Operation op : rd.getOperations()) {
boolean ok = false;
for (OperationExample ex : op.getExamples()) {
if (ex.getContent().contains("<" + rt) || ex.getContent().contains("\"" + rt + "\""))
ok = true;
}
for (OperationExample ex : op.getExamples2()) {
if (ex.getContent().contains("<" + rt) || ex.getContent().contains("\"" + rt + "\""))
ok = true;
}
if (ok) {
b.append(" <li><a href=\"" + rn.toLowerCase() + "-operation-" + op.getName().toLowerCase() + ".html#examples\">" + rn + "/$" + op.getName() + "</a></li>\r\n");
}
}
}
b.append("</ul>\r\n");
return b.toString();
}
Aggregations