private String buildSectionEditLink(ParserInput parserInput, int section) throws ParserException { if (!parserInput.getAllowSectionEdit()) { return ""; } if (parserInput.getLocale() == null) { logger.info( "Unable to build section edit links for " + parserInput.getTopicName() + " - locale is empty"); return ""; } // FIXME - template inclusion causes section edits to break, so disable for now Integer inclusion = (Integer) parserInput.getTempParam(TemplateTag.TEMPLATE_INCLUSION); boolean disallowInclusion = (inclusion != null && inclusion > 0); if (disallowInclusion) { return ""; } String url = ""; try { url = LinkUtil.buildEditLinkUrl( parserInput.getContext(), parserInput.getVirtualWiki(), parserInput.getTopicName(), null, section); } catch (DataAccessException e) { logger.error( "Failure while building link for topic " + parserInput.getVirtualWiki() + " / " + parserInput.getTopicName(), e); } // arguments are edit link URL and edit label text Object[] args = new Object[2]; args[0] = url; args[1] = Utilities.formatMessage("common.sectionedit", parserInput.getLocale()); try { return WikiUtil.formatFromTemplate(TEMPLATE_HEADER_EDIT_LINK, args); } catch (IOException e) { throw new ParserException(e); } }