Md4qt

parser.h File Reference
#include "doc.h"
#include "entities_map.h"
#include "traits.h"
#include "utils.h"
#include <QDir>
#include <QFile>
#include <QTextStream>
#include <exception>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <fstream>
#include <functional>
#include <memory>
#include <set>
#include <tuple>
#include <unordered_map>
#include <vector>
Include dependency graph for parser.h:

Go to the source code of this file.

Classes

struct  MD::MdBlock< Trait >
 
struct  MD::MdLineData
 
class  MD::Parser< Trait >
 
struct  MD::RawHtmlBlock< Trait >
 
class  MD::StringListStream< Trait >
 
struct  MD::TextParsingOpts< Trait >::TextData
 
struct  MD::TextParsingOpts< Trait >
 
class  MD::TextStream< QStringTrait >
 
class  MD::TextStream< UnicodeStringTrait >
 
struct  MD::UnprotectedDocsMethods< Trait >
 

Namespaces

namespace  MD
 

Typedefs

template<class Trait >
using MD::TextPluginFunc
 
template<class Trait >
using MD::TextPluginsMap
 

Enumerations

enum class  MD::OptimizeParagraphType { MD::Full , MD::Semi , MD::FullWithoutRawData , MD::SemiWithoutRawData }
 
enum class  MD::Style {
  MD::Italic1 , MD::Italic2 , MD::Bold1 , MD::Bold2 ,
  MD::Strikethrough , MD::Unknown
}
 
enum  MD::TextPlugin : int { MD::UnknownPluginID = 0 , MD::GitHubAutoLinkPluginID = 1 , MD::UserDefinedPluginID = 255 }
 

Functions

template<class Trait >
void MD::appendCloseStyle (TextParsingOpts< Trait > &po, const StyleDelim &s)
 
void MD::appendPossibleDelimiter (std::vector< std::vector< std::pair< std::pair< long long int, bool >, int > > > &vars, long long int len, int type, bool leftAndRight)
 
void MD::applyStyles (int &opts, const std::vector< std::pair< Style, long long int > > &styles)
 
template<class Trait >
std::pair< long long int, long long int > MD::calculateIndent (const typename Trait::String &s, long long int p)
 
template<class Trait >
bool MD::checkForEndHtmlComments (const typename Trait::String &line, long long int pos)
 
template<class Trait >
void MD::checkForHtmlComments (const typename Trait::InternalString &line, StringListStream< Trait > &stream, MdLineData::CommentDataMap &res)
 
template<class Trait >
void MD::checkForTableInParagraph (TextParsingOpts< Trait > &po, long long int lastLine)
 
template<class Trait >
void MD::checkForTextPlugins (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, const TextPluginsMap< Trait > &textPlugins, bool inLink)
 
bool MD::checkStack (std::vector< std::pair< std::pair< long long int, bool >, int > > &s, const std::pair< std::pair< long long int, bool >, int > &v, size_t idx)
 
void MD::closeStyle (std::vector< std::pair< Style, long long int > > &styles, Style s)
 
void MD::collectDelimiterVariants (std::vector< std::vector< std::pair< std::pair< long long int, bool >, int > > > &vars, long long int itLength, int type, bool leftFlanking, bool rightFlanking)
 
template<class Trait >
std::shared_ptr< Text< Trait > > MD::concatenateText (typename Block< Trait >::Items::const_iterator it, typename Block< Trait >::Items::const_iterator last)
 
template<class Trait >
void MD::eatRawHtml (long long int line, long long int pos, long long int toLine, long long int toPos, TextParsingOpts< Trait > &po, bool finish, int htmlRule, bool onLine, bool continueEating=false)
 
template<class Trait >
WithPosition MD::findAndRemoveClosingSequence (typename Trait::InternalString &s)
 
template<class Trait >
std::pair< typename Trait::String, WithPositionMD::findAndRemoveHeaderLabel (typename Trait::InternalString &s)
 
template<class Trait >
void MD::githubAutolinkPlugin (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, const typename Trait::StringList &)
 
bool MD::indentInList (const std::vector< long long int > *indents, long long int indent, bool codeIndentedBySpaces)
 
template<class Trait >
void MD::initLastItemWithOpts (TextParsingOpts< Trait > &po, std::shared_ptr< ItemWithOpts< Trait > > item)
 
bool MD::isClosingStyle (const std::vector< std::pair< Style, long long int > > &styles, Style s)
 
template<class Trait >
bool MD::isCodeFences (const typename Trait::String &s, bool closing=false)
 
template<class Trait >
bool MD::isColumnAlignment (const typename Trait::String &s)
 
template<class Trait >
bool MD::isEmail (const typename Trait::String &url)
 
template<class Trait >
bool MD::isFootnote (const typename Trait::String &s)
 
template<class Trait >
bool MD::isGitHubAutolink (const typename Trait::String &url)
 
template<>
bool MD::isGitHubAutolink< QStringTrait > (const QString &url)
 
template<>
bool MD::isGitHubAutolink< UnicodeStringTrait > (const UnicodeString &url)
 
template<class Trait >
bool MD::isH (const typename Trait::String &s, const typename Trait::Char &c)
 
template<class Trait >
bool MD::isH1 (const typename Trait::String &s)
 
template<class Trait >
bool MD::isH2 (const typename Trait::String &s)
 
template<class Trait >
bool MD::isHorizontalLine (const typename Trait::String &s)
 
template<class Trait >
bool MD::isHtmlComment (const typename Trait::String &s)
 
template<class Trait >
std::tuple< bool, long long int, long long int, bool, typename Trait::String > MD::isHtmlTag (long long int line, long long int pos, TextParsingOpts< Trait > &po, int rule)
 
template<class Trait >
bool MD::isLineBreak (const typename Trait::String &s)
 
template<class Trait >
bool MD::isListItemAndNotNested (const typename Trait::String &s, long long int indent)
 
template<class Trait >
bool MD::isOnlyHtmlTagsAfterOrClosedRule1 (long long int line, long long int pos, TextParsingOpts< Trait > &po, int rule)
 
template<class Trait >
bool MD::isOrderedList (const typename Trait::String &s, int *num=nullptr, int *len=nullptr, typename Trait::Char *delim=nullptr, bool *isFirstLineEmpty=nullptr)
 
bool MD::isSemiOptimization (OptimizeParagraphType t)
 
template<class Trait >
bool MD::isSetextHeadingBetween (const TextParsingOpts< Trait > &po, long long int startLine, long long int endLine)
 
template<class Trait >
bool MD::isSkipAllEmphasis (const std::vector< std::pair< std::pair< long long int, bool >, int > > &s, size_t idx)
 
template<class Trait >
bool MD::isStartOfCode (const typename Trait::String &str, typename Trait::String *syntax=nullptr, WithPosition *delim=nullptr, WithPosition *syntaxPos=nullptr)
 
template<class Trait >
int MD::isTableAlignment (const typename Trait::String &s)
 
template<class Trait >
int MD::isTableHeader (const typename Trait::String &s)
 
template<class Trait >
bool MD::isValidUrl (const typename Trait::String &url)
 
template<>
bool MD::isValidUrl< QStringTrait > (const QString &url)
 
template<>
bool MD::isValidUrl< UnicodeStringTrait > (const UnicodeString &url)
 
bool MD::isWithoutRawDataOptimization (OptimizeParagraphType t)
 
template<class Trait >
long long int MD::lastNonSpacePos (const typename Trait::String &line)
 
template<class Trait >
long long int MD::lastVirginPositionInParagraph (Item< Trait > *item)
 
template<class Trait >
long long int MD::lineBreakLength (const typename Trait::String &s)
 
template<class Trait >
std::tuple< bool, long long int, typename Trait::Char, bool > MD::listItemData (const typename Trait::String &s, bool wasText)
 
long long int MD::listLevel (const std::vector< long long int > &indents, long long int pos)
 
template<class Trait >
std::pair< long long int, long long int > MD::localPosFromVirgin (const MdBlock< Trait > &fr, long long int virginColumn, long long int virginLine)
 
std::vector< std::pair< std::pair< long long int, bool >, int > > MD::longestSequenceWithMoreOpeningsAtStart (const std::vector< std::vector< std::pair< std::pair< long long int, bool >, int > > > &vars)
 
template<class Trait >
void MD::makeHeading (std::shared_ptr< Block< Trait > > parent, std::shared_ptr< Document< Trait > > doc, std::shared_ptr< Paragraph< Trait > > p, long long int lastColumn, long long int lastLine, int level, const typename Trait::String &workingPath, const typename Trait::String &fileName, bool collectRefLinks, const WithPosition &delim, TextParsingOpts< Trait > &po)
 
template<class Trait >
void MD::makeHorLine (const typename MdBlock< Trait >::Line &line, std::shared_ptr< Block< Trait > > parent)
 
template<class Trait >
std::shared_ptr< Paragraph< Trait > > MD::makeParagraph (typename Block< Trait >::Items::const_iterator first, typename Block< Trait >::Items::const_iterator last)
 
template<class Trait >
void MD::makeText (long long int lastLine, long long int lastPos, TextParsingOpts< Trait > &po)
 
template<class Trait >
void MD::makeTextObject (const typename Trait::String &text, TextParsingOpts< Trait > &po, long long int startPos, long long int startLine, long long int endPos, long long int endLine, bool doRemoveSpacesAtEnd=false)
 
template<class Trait >
void MD::makeTextObjectWithLineBreak (const typename Trait::String &text, TextParsingOpts< Trait > &po, long long int startPos, long long int startLine, long long int endPos, long long int endLine)
 
template<class Trait >
std::pair< long long int, long long int > MD::nextPosition (const MdBlock< Trait > &fr, long long int pos, long long int line)
 
void MD::normalizePos (long long int &pos, long long int &line, long long int length, long long int linesCount)
 
template<class Trait >
std::shared_ptr< Paragraph< Trait > > MD::optimizeParagraph (std::shared_ptr< Paragraph< Trait > > &p, TextParsingOpts< Trait > &po, OptimizeParagraphType type=OptimizeParagraphType::Full)
 
template<class Trait >
Trait::String MD::paragraphToLabel (Paragraph< Trait > *p)
 
template<class Trait >
long long int MD::posOfListItem (const typename Trait::String &s, bool ordered)
 
template<class Trait >
Trait::InternalString MD::prepareTableData (typename Trait::InternalString s)
 
template<class Trait >
std::pair< long long int, long long int > MD::prevPosition (const MdBlock< Trait > &fr, long long int pos, long long int line)
 
template<class Trait >
long long int MD::processGitHubAutolinkExtension (std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, long long int idx)
 
template<class Trait >
Trait::String MD::readEscapedSequence (long long int i, const typename Trait::String &str, long long int *endPos=nullptr)
 
template<class Trait >
std::pair< bool, bool > MD::readHtmlAttr (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr, bool checkForSpace)
 
template<class Trait >
std::pair< bool, bool > MD::readHtmlAttrValue (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait >
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > MD::readLinkDestination (long long int line, long long int pos, const TextParsingOpts< Trait > &po, WithPosition *urlPos=nullptr)
 
template<class Trait >
std::tuple< long long int, long long int, bool, typename Trait::String, long long int > MD::readLinkTitle (long long int line, long long int pos, const TextParsingOpts< Trait > &po)
 
template<class Trait >
std::pair< bool, bool > MD::readUnquotedHtmlAttrValue (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class String , class Trait >
String MD::removeBackslashes (const String &s)
 
template<class Trait >
MdBlock< Trait >::Data MD::removeBackslashes (const typename MdBlock< Trait >::Data &d)
 
template<class Trait >
Trait::String MD::removeLineBreak (const typename Trait::String &s)
 
template<class String >
void MD::removeSpacesAtEnd (String &s)
 
template<class Trait >
Trait::String MD::replaceEntity (const typename Trait::String &s)
 
template<class Trait >
void MD::replaceTabs (typename Trait::InternalString &s)
 
template<class Trait >
void MD::resetHtmlTag (RawHtmlBlock< Trait > &html)
 
template<class Trait >
void MD::resolveLinks (typename Trait::StringList &linksToParse, std::shared_ptr< Document< Trait > > doc)
 
template<class Trait >
void MD::setLastPos (std::shared_ptr< Item< Trait > > item, long long int pos, long long int line)
 
template<class Trait >
long long int MD::skipSpaces (long long int i, const typename Trait::String &line)
 
template<class Trait >
void MD::skipSpacesInHtml (long long int &l, long long int &p, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait >
void MD::skipSpacesUpTo1Line (long long int &line, long long int &pos, const typename MdBlock< Trait >::Data &fr)
 
template<class Trait >
std::shared_ptr< Paragraph< Trait > > MD::splitParagraphsAndFreeHtml (std::shared_ptr< Block< Trait > > parent, std::shared_ptr< Paragraph< Trait > > p, TextParsingOpts< Trait > &po, bool collectRefLinks, bool fullyOptimizeParagraphs=true)
 
template<class Trait >
Trait::StringList MD::splitString (const typename Trait::String &str, const typename Trait::Char &ch)
 
template<>
QStringTrait::StringList MD::splitString< QStringTrait > (const QString &str, const QChar &ch)
 
template<>
UnicodeStringTrait::StringList MD::splitString< UnicodeStringTrait > (const UnicodeString &str, const UnicodeChar &ch)
 
template<class Trait >
std::pair< typename Trait::InternalStringList, std::vector< long long int > > MD::splitTableRow (const typename Trait::InternalString &s)
 
template<class Trait >
Trait::String MD::startSequence (const typename Trait::String &line)
 
template<class Trait >
Trait::String MD::stringToLabel (const typename Trait::String &s)
 
TextOption MD::styleToTextOption (Style s)
 
template<class Trait >
long long int MD::textAtIdx (std::shared_ptr< Paragraph< Trait > > p, size_t idx)
 
template<class Trait >
void MD::updateLastPosInList (const RawHtmlBlock< Trait > &html)
 
template<class Trait >
Trait::String MD::virginSubstr (const MdBlock< Trait > &fr, const WithPosition &virginPos)
 

Variables

template<class Trait >
static const Trait::String MD::s_canBeEscaped
 
static const char * MD::s_startComment = "<!--"
 
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.