use of org.eclipse.ceylon.common.tools.help.model.DescribedSection in project ceylon by eclipse.
the class DocBookVisitor method describedSection.
private void describedSection(int depth, DescribedSection describedSection) {
if (depth <= 2) {
docbook.open("refsect" + (depth + 1)).text("\n");
docbook.markdown(describedSection.getTitle()).text("\n");
docbook.markdown(describedSection.getDescription());
} else {
throw new RuntimeException("No refsect4");
}
for (DescribedSection subsection : describedSection.getSubsections()) {
describedSection(depth + 1, subsection);
}
docbook.close("refsect" + (depth + 1)).text("\n");
}
use of org.eclipse.ceylon.common.tools.help.model.DescribedSection in project ceylon by eclipse.
the class DocBuilder method buildDescription.
private DescribedSection buildDescription(ToolModel<?> model) {
final HashMap<ToolModel<?>, DescribedSection> map = new HashMap<ToolModel<?>, DescribedSection>();
new SubtoolVisitor(model) {
@Override
protected void visit(ToolModel<?> model, SubtoolModel<?> subtoolModel) {
if (model == root) {
map.put(model, buildDescription(model, getDescription(model)));
} else if (model.getSubtoolModel() == null) {
// leaf
DescribedSection section = new DescribedSection();
section.setRole(Role.DESCRIPTION);
StringBuilder sb = new StringBuilder();
for (SubtoolVisitor.ToolModelAndSubtoolModel subtool : ancestors.subList(1, ancestors.size())) {
sb.append(subtool.getModel().getName()).append(" ");
}
sb.append(model.getName());
section.setTitle(Markdown.markdown("###" + CeylonHelpToolMessages.msg("section.DESCRIPTION.sub", sb.toString())));
section.setDescription(Markdown.markdown(getDescription(model)));
section.setAbout(model);
List<DescribedSection> rootSubsections = new ArrayList<>(map.get(root).getSubsections());
rootSubsections.add(section);
map.get(root).setSubsections(rootSubsections);
}
}
}.accept();
return map.get(model);
}
Aggregations