Package net.java.textilej.parser

Examples of net.java.textilej.parser.Attributes


  }

  @Override
  protected void beginBlock() {
    if (title != null) {
      Attributes attributes = new Attributes();
      attributes.setTitle(title);
      builder.beginBlock(BlockType.PANEL, attributes);
    }
    Attributes attributes = new Attributes();

    builder.beginBlock(BlockType.PREFORMATTED, new Attributes());
    builder.beginBlock(BlockType.CODE, attributes);
  }
View Full Code Here


    paraLine = 0;
  }
 
  @Override
  protected void beginBlock() {
    Attributes attributes = new Attributes();
    builder.beginBlock(BlockType.QUOTE, attributes);
  }
View Full Code Here

      paraOpen = false;
      paraLine = 0;
      return;
    }
    if (!paraOpen) {
      builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
      paraOpen = true;
    }
    if (paraLine != 0) {
      builder.lineBreak();
    }
View Full Code Here

  }

  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount == 0) {
      Attributes attributes = new Attributes();
      // 0-offset matches may start with the "hn. " prefix.
      level = Integer.parseInt(matcher.group(1));
      offset = matcher.start(2);

      if (attributes.getId() == null) {
        attributes.setId(state.getIdGenerator().newId("h"+level,line.substring(offset)));
      }
      builder.beginHeading(level, attributes);
    }
    if (blockLineCount != 0 || dialect.isEmptyLine(line)) {
      setClosed(true);
View Full Code Here

 
  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount == 0) {
      listState = new Stack<ListState>();
      Attributes attributes = new Attributes();
      String listSpec = matcher.group(1);
      int level = calculateLevel(listSpec);
      BlockType type = calculateType(listSpec);
     
      if (type == BlockType.BULLETED_LIST && "-".equals(listSpec)) {
        attributes.setCssStyle("list-style: square");
      }
     
      // 0-offset matches may start with the "*** " prefix.
      offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET);
   
      listState.push(new ListState(1,type));
      builder.beginBlock(type, attributes);

      adjustLevel(listSpec, level, type);
    } else {
      Matcher matcher = startPattern.matcher(line);
      if (!matcher.matches()) {
        setClosed(true);
        return 0;
      }
      String listSpec = matcher.group(1);
      int level = calculateLevel(listSpec);
      BlockType type = calculateType(listSpec);
     
      offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET);
     
      adjustLevel(listSpec, level, type);
    }
    ++blockLineCount;
   
    ListState listState = this.listState.peek();
    if (listState.openItem) {
      builder.endBlock();
    }
    listState.openItem = true;
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
   
    dialect.emitMarkupLine(getParser(),state,line, offset);
   
    return -1;
  }
View Full Code Here

      level != previousState.level || previousState.type != type;
      previousState = listState.peek()) {
     
      if (level > previousState.level) {
        if (!previousState.openItem) {
          builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
          previousState.openItem = true;
        }

        Attributes blockAttributes = new Attributes();
        if (type == BlockType.BULLETED_LIST && "-".equals(listSpec)) {
          blockAttributes.setCssStyle("list-style: square");
        }   
        listState.push(new ListState(previousState.level+1,type));
        builder.beginBlock(type,blockAttributes);
      } else {
        closeOne();
        if (listState.isEmpty()) {
          Attributes blockAttributes = new Attributes();
          if (type == BlockType.BULLETED_LIST && "-".equals(listSpec)) {
            blockAttributes.setCssStyle("list-style: square");
          }   
         
          listState.push(new ListState(1,type));
          builder.beginBlock(type, blockAttributes);
        }
View Full Code Here

      return;
    }
    if ((item.getLevel()+1) > maxLevel) {
      return;
    }
    Attributes nullAttributes = new Attributes();
   
    builder.beginBlock(BlockType.NUMERIC_LIST, new Attributes(null,null,"list-style: "+style+";",null));
    for (OutlineItem child: item.getChildren()) {
      builder.beginBlock(BlockType.LIST_ITEM, nullAttributes);
      builder.link('#'+child.getId(), child.getLabel());
      emitToc(child);
      builder.endBlock();
View Full Code Here

  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount == 0) {
      setOptions(matcher.group(1));
     
      Attributes attributes = new Attributes();
      attributes.setTitle(title);
     
      offset = matcher.start(2);

      builder.beginBlock(blockType, attributes);
      markupContent = new StringBuilder();
View Full Code Here

  }

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

    super("noformat");
  }
 
  @Override
  protected void beginBlock() {
    Attributes attributes = new Attributes();
    builder.beginBlock(BlockType.PREFORMATTED, attributes);
  }
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.