Package net.java.textilej.parser

Examples of net.java.textilej.parser.Attributes


  }

  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount == 0) {
      Attributes attributes = new Attributes();
      builder.beginBlock(BlockType.PARAGRAPH, attributes);
    }
   
    if (dialect.isEmptyLine(line)) {
      setClosed(true);
View Full Code Here


        }
      }
      if (pageName.startsWith("#")) {
        builder.link(href, altText);
      } else {
        Attributes attributes = new LinkAttributes();
        attributes.setTitle(pageName);
        builder.link(attributes,href, altText);
      }
    }
View Full Code Here

  }

  @Override
  public int processLineContent(String line, int offset) {
    if (blockLineCount == 0) {
      Attributes attributes = new Attributes();
      builder.beginBlock(BlockType.TABLE, attributes);
    } else if (dialect.isEmptyLine(line)) {
      setClosed(true);
      return 0;
    }
    ++blockLineCount;

    if (offset == line.length()) {
      return -1;
    }

    String textileLine = offset == 0 ? line : line.substring(offset);
    Matcher rowMatcher = TABLE_ROW_PATTERN.matcher(textileLine);
    if (!rowMatcher.find()) {
      setClosed(true);
      return 0;
    }

    builder.beginBlock(BlockType.TABLE_ROW, new Attributes());

    do {
      int start = rowMatcher.start();
      if (start == textileLine.length() - 1) {
        break;
      }

      String headerIndicator = rowMatcher.group(1);
      String text = rowMatcher.group(2);
      int lineOffset = offset + rowMatcher.start(2);

      boolean header = headerIndicator != null && "|".equals(headerIndicator);

      Attributes attributes = new Attributes();
      builder.beginBlock(header ? BlockType.TABLE_CELL_HEADER : BlockType.TABLE_CELL_NORMAL, attributes);

      dialect.emitMarkupLine(getParser(), state, lineOffset, text, 0);

      builder.endBlock(); // table cell
View Full Code Here

  }

  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount == 0) {
      Attributes attributes = new Attributes();

      offset = matcher.start(1);

      builder.beginBlock(BlockType.QUOTE, attributes);
      builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    }
    if (dialect.isEmptyLine(line)) {
      setClosed(true);
      return 0;
    }
View Full Code Here

    } else {
      applyAttributes(attributes);
     
      // create the titled panel effect if a title is specified
      if (attributes.getTitle() != null) {
        beginBlock(BlockType.PARAGRAPH, new Attributes());
        beginSpan(SpanType.BOLD, new Attributes());
        characters(attributes.getTitle());
        endSpan();
        endBlock();
      }
    }
View Full Code Here

    }
   
    @Override
    public void emit() {
      for (SpanType type: spanType) {
        getBuilder().beginSpan(type, new Attributes());
      }
      if (nesting) {
        getDialect().emitMarkupLine(parser, state,state.getLineCharacterOffset()+ getStart(this), getContent(this), 0);
      } else {
        getDialect().emitMarkupText(parser, state, getContent(this));
View Full Code Here

            }
            int contentsStart = cellMatcher.start(2);
            BlockType type = ("!".equals(kind))?BlockType.TABLE_CELL_HEADER:BlockType.TABLE_CELL_NORMAL;
           
            if (!openRow) {
              openRow(cellMatcher.start(),new Attributes());
            }
            emitCells(contentsStart,type,contents);
           
            return -1;
          } else {
View Full Code Here

      this.nesting = nesting;
    }
   
    @Override
    public void emit() {
      Attributes attributes = new Attributes();
      getBuilder().beginSpan(spanType, attributes);
      if (nesting) {
        getDialect().emitMarkupLine(parser, state, state.getLineCharacterOffset() + getStart(this),
            getContent(this), 0);
      } else {
View Full Code Here

  private static class ImagePhraseModifierProcessor extends PatternBasedElementProcessor {
    @Override
    public void emit() {
      String imageUrl = group(CONTENT_GROUP);

      Attributes attributes = new Attributes();
      builder.image(attributes, imageUrl);
    }
View Full Code Here

 
  private static class AnchorReplacementTokenProcessor extends PatternBasedElementProcessor {
    @Override
    public void emit() {
      String name = group(1);
      Attributes attributes = new Attributes();
      attributes.setId(name);
      getBuilder().beginSpan(SpanType.SPAN, attributes);
      getBuilder().endSpan();
    }
View Full Code Here

TOP

Related Classes of net.java.textilej.parser.Attributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.