MD::ParagraphParser Class

class MD::ParagraphParser

Paragraph parser. More...

Header: #include <md4qt/paragraph_parser.h>
CMake: find_package(md4qt REQUIRED COMPONENTS md4qt)
target_link_libraries(mytarget PRIVATE md4qt::md4qt)
Inherits: MD::BlockParser

Reimplemented Public Functions

virtual bool canBeLazyLine(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const override
virtual MD::BlockState check(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName, bool checkWithoutProcessing = false) override
virtual MD::BlockState continueCheck(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName) override
virtual void finish(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse) override
virtual bool mayBreakParagraph(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const override
virtual MD::BlockState process(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse) override
virtual void reset(MD::Context &ctx) override
virtual void resetOnAllContexts() override

Static Public Members

void makeTextObjects(MD::InlineContext &ctx, MD::ParagraphStream &stream, QSharedPointer<MD::Block> p, const MD::WithPosition &toSkip = {})
QString paragraphToLabel(QSharedPointer<MD::Paragraph> p)

Detailed Description

Paragraph parser.

Member Function Documentation

[override virtual] bool ParagraphParser::canBeLazyLine(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const

Reimplements: BlockParser::canBeLazyLine(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const.

Returns whether this kind of block can be a lazy line.

line Line.

stream Stream.

doc Document.

ctx Context.

[override virtual] MD::BlockState ParagraphParser::check(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName, bool checkWithoutProcessing = false)

Reimplements: BlockParser::check(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName, bool checkWithoutProcessing).

Returns check state for the current line and block type. This method should return BlockState::None if this string is not handled by him. This method should not return BlockState::Stop ever. If this block parser knows how to handle the current line it should return BlockState::Continue.

currentLine Current processing line.

stream Stream of the lines.

doc Current document.

ctx Current parsing context.

path Path to Markdown file.

fileName File name of the Markdown file.

checkWithoutProcessing Flags to don't do real processing, just check this parser handles this line.

[override virtual] MD::BlockState ParagraphParser::continueCheck(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName)

Reimplements: BlockParser::continueCheck(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx, const QString &path, const QString &fileName).

Continue check. If checking knows that block is finished it should return BlockState::Stop.

currentLine Current processing line.

stream Stream of the lines.

doc Current document.

ctx Current parsing context.

path Path to Markdown file.

fileName File name of the Markdown file.

[override virtual] void ParagraphParser::finish(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse)

Reimplements: BlockParser::finish(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse).

Finish things. This method invokes after MD::BlockState::Stop state recieved or at the end of file.

currentLine Current processing line.

stream Stream of the lines.

doc Document.

parent Parent of this block.

ctx Current parsing context.

path Path to Markdown file.

fileName File name of the Markdown file.

linksToParse List of links for further parsing.

[static] void ParagraphParser::makeTextObjects(MD::InlineContext &ctx, MD::ParagraphStream &stream, QSharedPointer<MD::Block> p, const MD::WithPosition &toSkip = {})

Place text objects in paragraph.

ctx Inline context.

stream Stream.

p Paragraph object.

toSkip Position for skipping.

[override virtual] bool ParagraphParser::mayBreakParagraph(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const

Reimplements: BlockParser::mayBreakParagraph(MD::Line &line, MD::TextStream &stream, QSharedPointer<MD::Document> doc, MD::Context &ctx) const.

Return whether this kind of block may break a paragraph.

line Line.

stream Stream.

doc Document.

ctx Context.

[static] QString ParagraphParser::paragraphToLabel(QSharedPointer<MD::Paragraph> p)

Convert MD::Paragraph to label.

p Paragraph.

[override virtual] MD::BlockState ParagraphParser::process(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse)

Reimplements: BlockParser::process(MD::Line &currentLine, MD::TextStream &stream, QSharedPointer<MD::Document> doc, QSharedPointer<MD::Block> parent, MD::Context &ctx, const QString &path, const QString &fileName, QStringList &linksToParse).

Process block - do actual parsing and populating MD::Document. If starting empty line is not a subject for work for this kind of block this method should just skip the line.

This method should call himself on all children contexts till block finish.

currentLine Current processing line.

stream Stream of the lines.

doc Document.

parent Parent of this block.

ctx Current parsing context.

path Path to Markdown file.

fileName File name of the Markdown file.

linksToParse List of links for further parsing.

[override virtual] void ParagraphParser::reset(MD::Context &ctx)

Reimplements: BlockParser::reset(MD::Context &ctx).

Reset state of the block parser for further reuse.

ctx Context.

[override virtual] void ParagraphParser::resetOnAllContexts()

Reimplements: BlockParser::resetOnAllContexts().

Reset state of the block parser for further reuse.