~jpgleeson/piaine

d797f9de7644d8f07827e84638a93da8f7b27fea — Jack Gleeson 6 months ago 9c34046 master
Add block quote support
2 files changed, 32 insertions(+), 0 deletions(-)

M README.md
M textParser.cs
M README.md => README.md +5 -0
@@ 47,6 47,11 @@ Subtitles are as done in markdown. # at the start of a line delimits that it sho
Images in piaine are defined with the file name and the alt text. The file name should be local to the content folder in the base site folder as shown in the directory structure above.
Moving of images to this content folder is currently manual.

## Quote Blocks
{This is the quote body and next is the} attribution}

Quote blocks and attributions come as pairs. We wrap them as seen in braces.

## Templates

Templates are an optional attribute that can be added in content files. If no template attribute is found, then the post template is used, otherwise, the specified template is loaded for that single file.

M textParser.cs => textParser.cs +27 -0
@@ 49,6 49,7 @@ namespace piaine
                case '+': link(); break;
                case '|': image(); break;
                case '~': code(); break;
                case '{': quote(); break;
                default:
                    text();
                    break;


@@ 146,6 147,32 @@ namespace piaine
            outputString += "<code>" + value + "</code>";
        }

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

            string quoteBody = subString(start + 1, current);

            start = current;

            advance();

            while (peek() != '}' && !isAtEnd())
            {
                advance();
            }

            advance();

            string quoteAttribution = subString(start + 1, current - 1);
            quoteAttribution = quoteAttribution.Trim();

            outputString += "<p class='quoteBody'>" + quoteBody + "</p> <p class='quoteAttribution'>" + quoteAttribution + "</p>";
        }

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