X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FAbstractDbkViewer.java;fp=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fdocbook%2Fui%2FAbstractDbkViewer.java;h=f2fa79903b2e65a09e80f3984b77843480e220dd;hp=656dd014f64849e4567ffe9ffc1124fe43de4e94;hb=458ef7a014567bef226a340de803b44b4ec51f62;hpb=2824e4dce1c2239500f865efaac23f2880b12277 diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/AbstractDbkViewer.java b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/AbstractDbkViewer.java index 656dd01..f2fa799 100644 --- a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/AbstractDbkViewer.java +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/AbstractDbkViewer.java @@ -109,18 +109,27 @@ public abstract class AbstractDbkViewer extends AbstractPageViewer implements Ke if (style != null) CmsUiUtils.style(textSection, style); + // Title + Node titleNode = null; + // We give priority to ./title vs ./info/title, like the DocBook XSL if (node.hasNode(DbkType.title.get())) { + titleNode = node.getNode(DbkType.title.get()); + } else if (node.hasNode(DbkType.info.get() + '/' + DbkType.title.get())) { + titleNode = node.getNode(DbkType.info.get() + '/' + DbkType.title.get()); + } + + if (titleNode != null) { boolean showTitle = getMainSection() == section ? showMainTitle : true; if (showTitle) { if (section.getHeader() == null) section.createHeader(); - Node titleNode = node.getNode(DbkType.title.get()); DocBookSectionTitle title = newSectionTitle(textSection, titleNode); title.setLayoutData(CmsUiUtils.fillWidth()); updateContent(title); } } + // content for (NodeIterator ni = node.getNodes(); ni.hasNext();) { Node child = ni.nextNode(); SectionPart sectionPart = null; @@ -130,13 +139,19 @@ public abstract class AbstractDbkViewer extends AbstractPageViewer implements Ke // Node imageDataNode = child.getNode(DbkType.imageobject.get()).getNode(DbkType.imagedata.get()); // sectionPart = newImg(textSection, imageDataNode); // } + } else if (isDbk(child, DbkType.info)) { + // TODO enrich UI based on info + } else if (isDbk(child, DbkType.title)) { + // already managed } else if (isDbk(child, para)) { sectionPart = newParagraph(textSection, child); - } else { + } else if (isDbk(child, DbkType.section)) { sectionPart = newSectionPart(textSection, child); // if (sectionPart == null) // throw new IllegalArgumentException("Unsupported node " + child); // TODO list node types in exception + } else { + throw new IllegalArgumentException("Unsupported node type for "+child); } if (sectionPart != null && sectionPart instanceof Control) ((Control) sectionPart).setLayoutData(CmsUiUtils.fillWidth()); @@ -266,7 +281,7 @@ public abstract class AbstractDbkViewer extends AbstractPageViewer implements Ke if (title == getEdited()) title.setText(textInterpreter.read(title.getNode())); else - title.setText(textInterpreter.raw(title.getNode())); + title.setText(textInterpreter.readSimpleHtml(title.getNode())); } }