private String getPageHtml(WikiContext context, String name, String action) throws IOException {
        StringBuilder buffer = new StringBuilder();
        String escapedName = escapeHTML(titlePrefix(action) + unescapedTitleFromName(name));
        addHeader(context, escapedName, getTalkPage(context, name), buffer);

        if ((action.equals("view") && context.getStorage().hasPage(name)) ||
            (action.equals("viewparent") && context.getStorage().hasUnmodifiedPage(name)) ||
            (action.equals("viewrebase") && context.getRemoteChanges().hasChange(name))) {
            buffer.append(renderXHTML(context, getPageWikiText(context, name, action)));
        } else {
            addHtmlForNonExistantPage(context, name, buffer);
        }
        addFooter(context, name, !action.equals("view"), buffer);
        return buffer.toString();
    }