private void tableCell()

in doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java [1396:1431]


    private void tableCell(boolean headerRow, MutableAttributeSet attributes) {
        Tag t = (headerRow ? HtmlMarkup.TH : HtmlMarkup.TD);

        if (!headerRow
                && cellCountStack != null
                && !cellCountStack.isEmpty()
                && cellJustifStack != null
                && !cellJustifStack.isEmpty()
                && getCellJustif() != null) {
            int cellCount = getCellCount();
            int[] cellJustif = getCellJustif();
            if (cellCount < cellJustif.length) {
                if (attributes == null) {
                    attributes = new SinkEventAttributeSet();
                }
                Map<Integer, String> hash = new HashMap<>();
                hash.put(Sink.JUSTIFY_CENTER, "center");
                hash.put(Sink.JUSTIFY_LEFT, "left");
                hash.put(Sink.JUSTIFY_RIGHT, "right");

                String tdStyle = "text-align: " + hash.get(cellJustif[cellCount]) + ";";
                if (attributes.isDefined(SinkEventAttributes.STYLE)) {
                    tdStyle += " "
                            + attributes.getAttribute(SinkEventAttributes.STYLE).toString();
                }

                attributes.addAttribute(SinkEventAttributes.STYLE, tdStyle);
            }
        }

        if (attributes == null) {
            writeStartTag(t, null);
        } else {
            writeStartTag(t, SinkUtils.filterAttributes(attributes, SinkUtils.SINK_TD_ATTRIBUTES));
        }
    }