org.asciidoctor.ast.Cell Java Examples

The following examples show how to use org.asciidoctor.ast.Cell. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JRubyProcessor.java    From asciidoctorj with Apache License 2.0 5 votes vote down vote up
@Override
public Cell createTableCell(Column column, Document innerDocument, Map<String, Object> attributes) {
    Cell cell = createTableCell(column, (String) null, attributes);
    cell.setStyle("asciidoc");
    cell.setInnerDocument(innerDocument);
    return cell;
}
 
Example #2
Source File: JRubyProcessor.java    From asciidoctorj with Apache License 2.0 5 votes vote down vote up
@Override
public Cell createTableCell(Column column, String text, Map<String, Object> attributes) {
    Ruby rubyRuntime = JRubyRuntimeContext.get(column);

    RubyHash rubyAttributes = RubyHash.newHash(rubyRuntime);
    rubyAttributes.putAll(attributes);

    IRubyObject[] parameters = {
            ((ColumnImpl) column).getRubyObject(),
            text != null ? rubyRuntime.newString(text) : rubyRuntime.getNil(),
            rubyAttributes}; // No cursor parameter yet

    return (Cell) NodeConverter.createASTNode(rubyRuntime, NodeConverter.NodeType.TABLE_CELL_CLASS, parameters);
}
 
Example #3
Source File: PassthroughFixDirective.java    From helidon-build-tools with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(Environment env,
        Map params, TemplateModel[] loopVars,
        TemplateDirectiveBody body)
        throws TemplateException, IOException {

    if (loopVars.length != 0) {
            throw new TemplateModelException(
                "This directive does not allow loop variables.");
    }

    // Check if no parameters were given:
    if (body != null) {
        throw new TemplateModelException(
                "This directive does not allow body content.");
    }

    TemplateModel textVar = env.getVariable("text");
    if (!(textVar instanceof TemplateScalarModel)) {
        throw new TemplateModelException(
                "text variable is not a TemplateScalarModel");
    }

    String text = ((TemplateScalarModel) textVar).getAsString();

    if (PLACEHOLDER.equals(text)) {

        TemplateModel parentVar = env.getVariable("parent");
        if (!(parentVar instanceof ContentNodeHashModel)) {
            throw new TemplateModelException(
                    "pareant variable is not a ContentNodeHashModel");
        }

        ContentNode parent = ((ContentNodeHashModel) parentVar).getContentNode();

        String source;
        if (parent instanceof Block) {
            source = ((Block) parent).getSource();
        } else if (parent instanceof Cell) {
            source = ((Cell) parent).getSource();
        } else {
            throw new TemplateModelException(
                    "parent is not a Block or a Cell");
        }

        if (source == null || source.isEmpty()) {
            throw new TemplateModelException(
                    "source is null or empty");
        }

        String fixed = formatInlineSource(source);
        env.getOut().write(fixed);

    } else {
        // nothing to do, just write the text out
        env.getOut().write(text);
    }
}
 
Example #4
Source File: RowImpl.java    From swagger2markup with Apache License 2.0 4 votes vote down vote up
public RowImpl(List<Cell> cells) {
    this.cells = cells;
}
 
Example #5
Source File: RowImpl.java    From swagger2markup with Apache License 2.0 4 votes vote down vote up
@Override
public List<Cell> getCells() {
    return cells;
}
 
Example #6
Source File: BaseProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, Document innerDocument, Map<String, Object> attributes) {
    return delegate.createTableCell(column, innerDocument, attributes);
}
 
Example #7
Source File: BaseProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, String text, Map<String, Object> attributes) {
    return delegate.createTableCell(column, text, attributes);
}
 
Example #8
Source File: BaseProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, String text) {
    return createTableCell(column, text, new HashMap<>());
}
 
Example #9
Source File: BaseProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, Document innerDocument) {
    return createTableCell(column, innerDocument, new HashMap<>());
}
 
Example #10
Source File: JRubyProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, String text) {
    return createTableCell(column, text, new HashMap<>());
}
 
Example #11
Source File: JRubyProcessor.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public Cell createTableCell(Column column, Document innerDocument) {
    return createTableCell(column, innerDocument, new HashMap<>());
}
 
Example #12
Source File: RowImpl.java    From asciidoctorj with Apache License 2.0 4 votes vote down vote up
@Override
public List<Cell> getCells() {
    return new RubyBlockListDecorator<Cell>((RubyArray) getRubyObject());
}
 
Example #13
Source File: Processor.java    From asciidoctorj with Apache License 2.0 votes vote down vote up
Cell createTableCell(Column column, String text); 
Example #14
Source File: Processor.java    From asciidoctorj with Apache License 2.0 votes vote down vote up
Cell createTableCell(Column column, Document innerDocument); 
Example #15
Source File: Processor.java    From asciidoctorj with Apache License 2.0 votes vote down vote up
Cell createTableCell(Column column, Document innerDocument, Map<String, Object> attributes); 
Example #16
Source File: Processor.java    From asciidoctorj with Apache License 2.0 votes vote down vote up
Cell createTableCell(Column column, String text, Map<String, Object> attributes);