private HtmlTag buildListItem(SourcePage child) { HtmlTag listItem = buildItem(child); if (!child.getChildren().isEmpty()) { if (level < getRecursionLimit()) { listItem.add(new ContentsItemBuilder(contents, level + 1, child).buildLevel(child)); } else if (getRecursionLimit() > 0){ listItem.add(contents.getVariable(Contents.MORE_SUFFIX_TOC, Contents.MORE_SUFFIX_DEFAULT)); } } return listItem; }
public HtmlTag buildLevel(SourcePage page) { HtmlTag list = new HtmlTag("ul"); list.addAttribute("class", "toc" + level); for (SourcePage child: getSortedChildren(page)) { list.add(buildListItem(child)); } return list; }
private String buildBody(SourcePage page) { String itemText = page.getName(); if (hasOption("-g", Contents.REGRACE_TOC)) { //todo: DRY? see wikiwordbuilder itemText = GracefulNamer.regrace(itemText); } if (hasOption("-p", Contents.PROPERTY_TOC)) { String properties = getBooleanProperties(page); if (!properties.isEmpty()) itemText += " " + properties; } if (hasOption("-f", Contents.FILTER_TOC)) { String filters = page.getProperty(WikiPageProperty.SUITES); if (!filters.isEmpty()) itemText += " (" + filters + ")"; } return itemText; }
public HtmlTag buildItem(SourcePage page) { HtmlTag listItem = new HtmlTag("li"); HtmlTag link = new HtmlTag("a", buildBody(page)); link.addAttribute("href", buildReference(page)); link.addAttribute("class", getBooleanPropertiesClasses(page)); listItem.add(link); String help = page.getProperty(WikiPageProperty.HELP); if (!help.isEmpty()) { if (hasOption("-h", Contents.HELP_TOC)) { listItem.add(HtmlUtil.makeSpanTag("pageHelp", ": " + help)); } else if (hasOption("-H", Contents.HELP_INSTEAD_OF_TITLE_TOC)) { link.use(help); } else { link.addAttribute("title", help); } } return listItem; }
@Override public String toTarget(Translator translator, Symbol symbol) { ContentsItemBuilder itemBuilder = new ContentsItemBuilder(symbol, 1, translator.getPage()); HtmlTag contentsDiv = new HtmlTag("div"); contentsDiv.addAttribute("class", "contents"); contentsDiv.add(HtmlUtil.makeBold("Contents:")); contentsDiv.add(itemBuilder.buildLevel(translator.getPage())); return contentsDiv.html(); } }
public HtmlTag buildItem(SourcePage page) { HtmlTag listItem = new HtmlTag("li"); HtmlTag link = new HtmlTag("a", buildBody(page)); link.addAttribute("href", buildReference(page)); link.addAttribute("class", getBooleanPropertiesClasses(page)); listItem.add(link); String help = page.getProperty(WikiPageProperty.HELP); if (!help.isEmpty()) { if (hasOption("-h", Contents.HELP_TOC)) { listItem.add(HtmlUtil.makeSpanTag("pageHelp", ": " + help)); } else if (hasOption("-H", Contents.HELP_INSTEAD_OF_TITLE_TOC)) { link.use(help); } else { link.addAttribute("title", help); } } return listItem; }
@Override public String toTarget(Translator translator, Symbol symbol) { ContentsItemBuilder itemBuilder = new ContentsItemBuilder(symbol, 1, translator.getPage()); HtmlTag contentsDiv = new HtmlTag("div"); contentsDiv.addAttribute("class", "contents"); contentsDiv.add(HtmlUtil.makeBold("Contents:")); contentsDiv.add(itemBuilder.buildLevel(translator.getPage())); return contentsDiv.html(); } }
private HtmlTag buildListItem(SourcePage child) { HtmlTag listItem = buildItem(child); if (!child.getChildren().isEmpty()) { if (level < getRecursionLimit()) { listItem.add(new ContentsItemBuilder(contents, level + 1, child).buildLevel(child)); } else if (getRecursionLimit() > 0){ listItem.add(contents.getVariable(Contents.MORE_SUFFIX_TOC, Contents.MORE_SUFFIX_DEFAULT)); } } return listItem; }
public HtmlTag buildLevel(SourcePage page) { HtmlTag list = new HtmlTag("ul"); list.addAttribute("class", "toc" + level); for (SourcePage child: getSortedChildren(page)) { list.add(buildListItem(child)); } return list; }
private String buildBody(SourcePage page) { String itemText = page.getName(); if (hasOption("-g", Contents.REGRACE_TOC)) { //todo: DRY? see wikiwordbuilder itemText = GracefulNamer.regrace(itemText); } if (hasOption("-p", Contents.PROPERTY_TOC)) { String properties = getBooleanProperties(page); if (!properties.isEmpty()) itemText += " " + properties; } if (hasOption("-f", Contents.FILTER_TOC)) { String filters = page.getProperty(WikiPageProperty.SUITES); if (!filters.isEmpty()) itemText += " (" + filters + ")"; } return itemText; }