public static List<String> getActiveTags(final String wikitext, final int position) {
		List<String> activeTags = new ArrayList<String>();
		Matcher m = tagMatcher.matcher(wikitext.substring(0, position));
		while (m.find()) {
			if (m.group(1).equals("/")) {
				// End tag.
				for (int i = activeTags.size() - 1; i >= 0; i--) {
					if (activeTags.get(i).equals(m.group(2))) {
						// This tag matches. Close this one and those inside.
						for (int j = activeTags.size() - 1; j >= i; j--) {
							activeTags.remove(j);
						}
						break;
					}
				}
			} else /*- if (m.group(1).length() == 0) */{
				// Start tag. It may be self-closing, in which case it must not
				// be added.
				if (!(m.end() >= 2 && wikitext.charAt(m.end() - 2) == '/'))
					activeTags.add(m.group(2));
			}
		}
		return activeTags;
	}