protected Block computeBlock()

in wiki-convert/src/main/java/wikimedia/html/conversion/GithubMarkdownDocumentBuilder.java [281:321]


    protected Block computeBlock(BlockType type, Attributes attributes
    ) {
        switch (type) {

            case PARAGRAPH:
            case QUOTE:
            case BULLETED_LIST:
            case NUMERIC_LIST:
            case LIST_ITEM:
            case CODE:
                return super.computeBlock(type, attributes);
            case PREFORMATTED:
                String language = null;
                if (attributes.getCssClass() != null) {
                    if (attributes.getCssClass().equals("source-java")) {
                        language = "java";
                    } else if (attributes.getCssClass().equals("source-xml")) {
                        language = "xml";
                    } else if (attributes.getCssClass().equals("source-properties")) {
                        language = "yaml";
                    }
                }
                return new GithubPreformattedContentBlock(language);
            case DEFINITION_LIST:
                return new GithubDefinitionListBlock();
            case DEFINITION_TERM:
                return new GithubDefinitionTermBlock();
            case DEFINITION_ITEM:
                return new GithubDefinitionItem();
            case TABLE:
                return new GithubTable(attributes);
            case TABLE_ROW:
                return new GithubTableRow(attributes);
            case TABLE_CELL_HEADER:
                return new GithubTableCellHeader(attributes);
            case TABLE_CELL_NORMAL:
                return new GithubTableCellNormal(attributes);
            default:
                throw new IllegalStateException("Unexpected block type: " + type.name() + ":" + type);
        }
    }