example generation improvements

This commit is contained in:
Grahame Grieve 2022-09-09 09:03:16 +10:00
parent c5e6493106
commit 8ee2480f61
3 changed files with 7 additions and 6 deletions

View File

@ -4,4 +4,5 @@
## Other code changes
* Rendering improvements for Patient and extension summary
* Rendering improvements for Patient and extension summary
* Improved HTML compliance (img.alt)

View File

@ -384,7 +384,7 @@ public class Turtle {
public String asHtml() throws Exception {
StringBuilder b = new StringBuilder();
b.append("<pre class=\"rdf\"><code class=\"language-turtle\">\r\n");
b.append("<pre class=\"rdf\" style=\"white-space: pre; overflow: hidden\"><code class=\"language-turtle\">\r\n");
commitPrefixes(b);
for (Section s : sections) {
commitSection(b, s);

View File

@ -53,7 +53,7 @@ import org.w3c.dom.Text;
public class XhtmlGenerator {
private static final int LINE_LIMIT = 85;
private static final int LINE_LIMIT = 78;
private XhtmlGeneratorAdorner adorner;
public XhtmlGenerator(XhtmlGeneratorAdorner adorner) {
@ -66,7 +66,7 @@ public class XhtmlGenerator {
out.write("<div class=\"example\">\r\n");
out.write("<p>Example Instance \""+name+"\""+(desc == null ? "" : ": "+Utilities.escapeXml(desc))+"</p>\r\n");
out.write("<pre class=\"xml\">\r\n");
out.write("<pre class=\"xml\" style=\"white-space: pre; overflow: hidden\">\r\n");
XhtmlGeneratorAdornerState state = null; // adorner == null ? new XhtmlGeneratorAdornerState("", "") : adorner.getState(this, null, null);
for (int i = 0; i < doc.getChildNodes().getLength(); i++)
@ -86,7 +86,7 @@ public class XhtmlGenerator {
out.write("<div class=\"example\">\r\n");
out.write("<p>"+Utilities.escapeXml(desc)+"</p>\r\n");
if (adorn) {
out.write("<pre class=\"xml\">\r\n");
out.write("<pre class=\"xml\" style=\"white-space: pre; overflow: hidden\">\r\n");
out.write("&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n");
out.write("\r\n");
@ -95,7 +95,7 @@ public class XhtmlGenerator {
writeNode(out, doc.getChildNodes().item(i), state, level);
out.write("</pre>\r\n");
} else {
out.write("<code class=\"xml\">\r\n");
out.write("<code class=\"xml\" style=\"white-space: pre; overflow: hidden\">\r\n");
for (int i = 0; i < doc.getChildNodes().getLength(); i++)
writeNodePlain(out, doc.getChildNodes().item(i), level);