~jpgleeson/piaine

9900746c41f3e8b024f82ec45bf170123d3302ac — Jack Gleeson 1 year, 15 days ago 8906775
ADD: Code block tag

Add code block tag delineated by '~'.
1 files changed, 14 insertions(+), 0 deletions(-)

M textParser.cs
M textParser.cs => textParser.cs +14 -0
@@ 48,6 48,7 @@ namespace piaine
                case '#': header(); break;
                case '+': link(); break;
                case '|': image(); break;
                case '~': code(); break;
                default:
                    text();
                    break;


@@ 132,6 133,19 @@ namespace piaine
            outputString += "<img src='../content/" + imgSource + "' alt='" + altText + "'/>";
        }

        private void code()
        {
            while (peek() != '~' && !isAtEnd())
            {
                advance();
            }

            advance();

            string value = subString(start + 1, current - 1);
            outputString += "<code>" + value + "</code>";
        }

        private void text()
        {
            while (!textBreak(peek()) && !isAtEnd())