/** * Gets the "Category:" or equivalent * @return */ public String getNamespaceString(){ return getNamespaceString(this.canonicalTitle); }
public NameSpace getNamespace(){ Matcher m = language.getCategoryPattern().matcher(canonicalTitle); if (m.find()) { return NameSpace.CATEGORY; } String nameSpaceString = this.getNamespaceString(); if (nameSpaceString==null){ return NameSpace.ARTICLE; } else { return NameSpace.getNameSpaceByName(nameSpaceString); } }
if (getNamespaceString(title) != null){ title = getNamespaceString(title) + ":" + StringUtils.capitalize(getTitleStringWithoutNamespace(title));
/** * <p> * Returns the title string of the revised page, including namespace * prefixes and subpages, if any. The string is formatted as it would be on * an HTML page and not as in the URL used by MediaWiki for the page. For * example, spaces are represented as spaces and not as underscores. For * example * </p> * <p> * On a single MediaWiki site, the prefixed page title is a key for a page * at any given moment. However, users may change the title and namespace by * moving pages. The page id provides a better clue to identify pages across * history. * </p> * * @return title string */ @Override public String getPrefixedTitle() { Title t = raw.getTitle(); if (raw.getNamespace() == NameSpace.WIKIPEDIA) { return t.getTitleStringWithoutNamespace(); } else { return t.getNamespaceString() + ":" + t.getTitleStringWithoutNamespace(); } }
/** * <p> * Returns the title string of the revised page, including namespace * prefixes and subpages, if any. The string is formatted as it would be on * an HTML page and not as in the URL used by MediaWiki for the page. For * example, spaces are represented as spaces and not as underscores. For * example * </p> * <p> * On a single MediaWiki site, the prefixed page title is a key for a page * at any given moment. However, users may change the title and namespace by * moving pages. The page id provides a better clue to identify pages across * history. * </p> * * @return title string */ @Override public String getPrefixedTitle() { Title t = raw.getTitle(); if (raw.getNamespace() == NameSpace.WIKIPEDIA) { return t.getTitleStringWithoutNamespace(); } else { return t.getNamespaceString() + ":" + t.getTitleStringWithoutNamespace(); } }