@Override public void emit() { String pageName = group(1); String altText = group(2); String href = ((MediaWikiLanguage) getMarkupLanguage()).toInternalHref(pageName.replace(' ', '_')); // category references start with ':' but are not referenced that way in the text if (pageName.startsWith(":")) { // $NON-NLS-1$ pageName = pageName.substring(1); } if (altText == null || altText.trim().length() == 0) { altText = pageName; if (altText.startsWith("#")) { // $NON-NLS-1$ altText = altText.substring(1); } } if (pageName.startsWith("#")) { // $NON-NLS-1$ builder.link(href, altText); } else { Attributes attributes = new LinkAttributes(); attributes.setTitle(pageName); builder.link(attributes, href, altText); } }