private Block readLines() throws IOException
    {
        final Block block = new Block();
        final StringBuilder sb = new StringBuilder(80);
        int c = this.reader.read();
        LinkRef lastLinkRef = null;
        while (c != -1)
        {
            sb.setLength(0);
            int pos = 0;
            boolean eol = false;
            while (!eol)
            {
                switch (c)
                {
                case -1:
                    eol = true;
                    break;
                case '\n':
                    c = this.reader.read();
                    if (c == '\r')
                    {
                        c = this.reader.read();
                    }
                    eol = true;
                    break;
                case '\r':
                    c = this.reader.read();
                    if (c == '\n')
                    {
                        c = this.reader.read();
                    }
                    eol = true;
                    break;
                case '\t':
                {
                    final int np = pos + (4 - (pos & 3));
                    while (pos < np)
                    {
                        sb.append(' ');
                        pos++;
                    }
                    c = this.reader.read();
                    break;
                }
                default:
                    if (c != '<' || !this.config.panicMode)
                    {
                        pos++;
                        sb.append((char)c);
                    }
                    else
                    {
                        pos += 4;
                        sb.append("&lt;");
                    }
                    c = this.reader.read();
                    break;
                }
            }

            final Line line = new Line();
            line.value = sb.toString();
            line.init();

            // Check for link definitions
            boolean isLinkRef = false;
            String id = null, link = null, comment = null;
            if (!line.isEmpty && line.leading < 4 && line.value.charAt(line.leading) == '[')
            {
                line.pos = line.leading + 1;
                // Read ID up to ']'
                id = line.readUntil(']');
                // Is ID valid and are there any more characters?
                if (id != null && line.pos + 2 < line.value.length())
                {
                    // Check for ':' ([...]:...)
                    if (line.value.charAt(line.pos + 1) == ':')
                    {
                        line.pos += 2;
                        line.skipSpaces();
                        // Check for link syntax
                        if (line.value.charAt(line.pos) == '<')
                        {
                            line.pos++;
                            link = line.readUntil('>');
                            line.pos++;
                        }
                        else
                        {
                            link = line.readUntil(' ', '\n');
                        }

                        // Is link valid?
                        if (link != null)
                        {
                            // Any non-whitespace characters following?
                            if (line.skipSpaces())
                            {
                                final char ch = line.value.charAt(line.pos);
                                // Read comment
                                if (ch == '\"' || ch == '\'' || ch == '(')
                                {
                                    line.pos++;
                                    comment = line.readUntil(ch == '(' ? ')' : ch);
                                    // Valid linkRef only if comment is valid
                                    if (comment != null)
                                    {
                                        isLinkRef = true;
                                    }
                                }
                            }
                            else
                            {
                                isLinkRef = true;
                            }
                        }
                    }
                }
            }

            // To make compiler happy: add != null checks
            if (isLinkRef && id != null && link != null)
            {
                if (id.toLowerCase().equals("$profile$"))
                {
                    this.emitter.useExtensions = this.useExtensions = link.toLowerCase().equals("extended");
                    lastLinkRef = null;
                }
                else
                {
                    // Store linkRef and skip line
                    final LinkRef lr = new LinkRef(link, comment, comment != null
                            && (link.length() == 1 && link.charAt(0) == '*'));
                    this.emitter.addLinkRef(id, lr);
                    if (comment == null)
                    {
                        lastLinkRef = lr;
                    }
                }
            }
            else
            {
                comment = null;
                // Check for multi-line linkRef
                if (!line.isEmpty && lastLinkRef != null)
                {
                    line.pos = line.leading;
                    final char ch = line.value.charAt(line.pos);
                    if (ch == '\"' || ch == '\'' || ch == '(')
                    {
                        line.pos++;
                        comment = line.readUntil(ch == '(' ? ')' : ch);
                    }
                    if (comment != null)
                    {
                        lastLinkRef.title = comment;
                    }

                    lastLinkRef = null;
                }

                // No multi-line linkRef, store line
                if (comment == null)
                {
                    line.pos = 0;
                    block.appendLine(line);
                }
            }
        }

        return block;
    }
private Block readLines ( ) throws IOException { final Block block = new Block ( ) ; final StringBuilder sb = new StringBuilder ( 80 ) ; int c = this . reader . read ( ) ; LinkRef lastLinkRef = null ; while ( c != - 1 ) { sb . setLength ( 0 ) ; int pos = 0 ; boolean eol = false ; while ( ! eol ) { switch ( c ) { case - 1 : eol = true ; break ; case '\n' : c = this . reader . read ( ) ; if ( c == '\r' ) { c = this . reader . read ( ) ; } eol = true ; break ; case '\r' : c = this . reader . read ( ) ; if ( c == '\n' ) { c = this . reader . read ( ) ; } eol = true ; break ; case '\t' : { final int np = pos + ( 4 - ( pos & 3 ) ) ; while ( pos < np ) { sb . append ( ' ' ) ; pos ++ ; } c = this . reader . read ( ) ; break ; } default : if ( c != '<' || ! this . config . panicMode ) { pos ++ ; sb . append ( ( char ) c ) ; } else { pos += 4 ; sb . append ( "&lt;" ) ; } c = this . reader . read ( ) ; break ; } } final Line line = new Line ( ) ; line . value = sb . toString ( ) ; line . init ( ) ; boolean isLinkRef = false ; String id = null , link = null , comment = null ; if ( ! line . isEmpty && line . leading < 4 && line . value . charAt ( line . leading ) == '[' ) { line . pos = line . leading + 1 ; id = line . readUntil ( ']' ) ; if ( id != null && line . pos + 2 < line . value . length ( ) ) { if ( line . value . charAt ( line . pos + 1 ) == ':' ) { line . pos += 2 ; line . skipSpaces ( ) ; if ( line . value . charAt ( line . pos ) == '<' ) { line . pos ++ ; link = line . readUntil ( '>' ) ; line . pos ++ ; } else { link = line . readUntil ( ' ' , '\n' ) ; } if ( link != null ) { if ( line . skipSpaces ( ) ) { final char ch = line . value . charAt ( line . pos ) ; if ( ch == '\"' || ch == '\'' || ch == '(' ) { line . pos ++ ; comment = line . readUntil ( ch == '(' ? ')' : ch ) ; if ( comment != null ) { isLinkRef = true ; } } } else { isLinkRef = true ; } } } } } if ( isLinkRef && id != null && link != null ) { if ( id . toLowerCase ( ) . equals ( "$profile$" ) ) { this . emitter . useExtensions = this . useExtensions = link . toLowerCase ( ) . equals ( "extended" ) ; lastLinkRef = null ; } else { final LinkRef lr = new LinkRef ( link , comment , comment != null && ( link . length ( ) == 1 && link . charAt ( 0 ) == '*' ) ) ; this . emitter . addLinkRef ( id , lr ) ; if ( comment == null ) { lastLinkRef = lr ; } } } else { comment = null ; if ( ! line . isEmpty && lastLinkRef != null ) { line . pos = line . leading ; final char ch = line . value . charAt ( line . pos ) ; if ( ch == '\"' || ch == '\'' || ch == '(' ) { line . pos ++ ; comment = line . readUntil ( ch == '(' ? ')' : ch ) ; } if ( comment != null ) { lastLinkRef . title = comment ; } lastLinkRef = null ; } if ( comment == null ) { line . pos = 0 ; block . appendLine ( line ) ; } } } return block ; }
Reads all lines from our reader.
<p>
Takes care of markdown link references.
</p>

@return A Block containing all lines.
@throws IOException
If an IO error occurred.