private void init(boolean preserveUnlikelyCandidates) {
        if (mDocument.body() != null && mBodyCache == null) {
            mBodyCache = mDocument.body().html();
        }

        prepDocument();

        /* Build readability's DOM tree */
        Element overlay = mDocument.createElement("div");
        Element innerDiv = mDocument.createElement("div");
        Element articleTitle = getArticleTitle();
        Element articleContent = grabArticle(preserveUnlikelyCandidates);

        /**
         * If we attempted to strip unlikely candidates on the first run
         * through, and we ended up with no content, that may mean we stripped
         * out the actual content so we couldn't parse it. So re-run init while
         * preserving unlikely candidates to have a better shot at getting our
         * content out properly.
         */
        if (isEmpty(getInnerText(articleContent, false))) {
            if (!preserveUnlikelyCandidates) {
                mDocument.body().html(mBodyCache);
                init(true);
                return;
            } else {
                articleContent
                        .html("<p>Sorry, readability was unable to parse this page for content.</p>");
            }
        }

        /* Glue the structure of our document together. */
        innerDiv.appendChild(articleTitle);
        innerDiv.appendChild(articleContent);
        overlay.appendChild(innerDiv);

        /* Clear the old HTML, insert the new content. */
        mDocument.body().html("");
        mDocument.body().prependChild(overlay);
    }
private void init ( boolean preserveUnlikelyCandidates ) { if ( mDocument . body ( ) != null && mBodyCache == null ) { mBodyCache = mDocument . body ( ) . html ( ) ; } prepDocument ( ) ; Element overlay = mDocument . createElement ( "div" ) ; Element innerDiv = mDocument . createElement ( "div" ) ; Element articleTitle = getArticleTitle ( ) ; Element articleContent = grabArticle ( preserveUnlikelyCandidates ) ; if ( isEmpty ( getInnerText ( articleContent , false ) ) ) { if ( ! preserveUnlikelyCandidates ) { mDocument . body ( ) . html ( mBodyCache ) ; init ( true ) ; return ; } else { articleContent . html ( "<p>Sorry, readability was unable to parse this page for content.</p>" ) ; } } innerDiv . appendChild ( articleTitle ) ; innerDiv . appendChild ( articleContent ) ; overlay . appendChild ( innerDiv ) ; mDocument . body ( ) . html ( "" ) ; mDocument . body ( ) . prependChild ( overlay ) ; }
@formatter:on