My Project
|
#include <stdio.h>
#include <qglobal.h>
#include <qregexp.h>
#include <qfileinfo.h>
#include <qdict.h>
#include "markdown.h"
#include "growbuf.h"
#include "debug.h"
#include "util.h"
#include "doxygen.h"
#include "commentscan.h"
#include "entry.h"
#include "bufstr.h"
#include "commentcnv.h"
#include "config.h"
#include "section.h"
#include "message.h"
Go to the source code of this file.
Classes | |
struct | LinkRef |
Macros | |
#define | isIdChar(i) |
#define | isOpenEmphChar(i) |
#define | ignoreCloseEmphChar(i) |
#define | isLiTag(i) |
Typedefs | |
typedef int(* | action_t )(GrowBuf &out, const char *data, int offset, int size) |
Enumerations | |
enum | Alignment { AlignNone, AlignLeft, AlignCenter, AlignRight } |
Functions | |
static QDict< LinkRef > | g_linkRefs (257) |
static void | processInline (GrowBuf &out, const char *data, int size) |
static QCString | escapeSpecialChars (const QCString &s) |
static void | convertStringFragment (QCString &result, const char *data, int size) |
static Alignment | markersToAlignment (bool leftMarker, bool rightMarker) |
static QCString | isBlockCommand (const char *data, int offset, int size) |
static int | findEmphasisChar (const char *data, int size, char c, int c_size) |
static int | processEmphasis1 (GrowBuf &out, const char *data, int size, char c) |
static int | processEmphasis2 (GrowBuf &out, const char *data, int size, char c) |
static int | processEmphasis3 (GrowBuf &out, const char *data, int size, char c) |
static int | processNmdash (GrowBuf &out, const char *data, int off, int size) |
static int | processQuoted (GrowBuf &out, const char *data, int, int size) |
static int | processHtmlTag (GrowBuf &out, const char *data, int offset, int size) |
static int | processEmphasis (GrowBuf &out, const char *data, int offset, int size) |
static int | processLink (GrowBuf &out, const char *data, int, int size) |
static int | processCodeSpan (GrowBuf &out, const char *data, int, int size) |
static int | processSpecialCommand (GrowBuf &out, const char *data, int offset, int size) |
static int | isHeaderline (const char *data, int size) |
static bool | isBlockQuote (const char *data, int size, int indent) |
static int | isLinkRef (const char *data, int size, QCString &refid, QCString &link, QCString &title) |
static int | isHRuler (const char *data, int size) |
static QCString | extractTitleId (QCString &title, int level) |
static int | isAtxHeader (const char *data, int size, QCString &header, QCString &id) |
static int | isEmptyLine (const char *data, int size) |
static int | computeIndentExcludingListMarkers (const char *data, int size) |
static bool | isFencedCodeBlock (const char *data, int size, int refIndent, QCString &lang, int &start, int &end, int &offset) |
static bool | isCodeBlock (const char *data, int offset, int size, int &indent) |
int | findTableColumns (const char *data, int size, int &start, int &end, int &columns) |
static bool | isTableBlock (const char *data, int size) |
static int | writeTableBlock (GrowBuf &out, const char *data, int size) |
void | writeOneLineHeaderOrRuler (GrowBuf &out, const char *data, int size) |
static int | writeBlockQuote (GrowBuf &out, const char *data, int size) |
static int | writeCodeBlock (GrowBuf &out, const char *data, int size, int refIndent) |
static void | findEndOfLine (GrowBuf &out, const char *data, int size, int &pi, int &i, int &end) |
static void | writeFencedCodeBlock (GrowBuf &out, const char *data, const char *lng, int blockStart, int blockEnd) |
static QCString | processQuotations (const QCString &s, int refIndent) |
static QCString | processBlocks (const QCString &s, int indent) |
static bool | isExplicitPage (const QCString &docs) |
static QCString | extractPageTitle (QCString &docs, QCString &id) |
static QCString | detab (const QCString &s, int &refIndent) |
QCString | processMarkdown (const QCString &fileName, const int lineNr, Entry *e, const QCString &input) |
QCString | markdownFileNameToId (const QCString &fileName) |
Variables | |
static action_t | g_actions [256] |
static Entry * | g_current |
static QCString | g_fileName |
static int | g_lineNr |
const int | codeBlockIndent = 4 |
#define ignoreCloseEmphChar | ( | i | ) |
Definition at line 70 of file markdown.cpp.
Referenced by findEmphasisChar().
#define isIdChar | ( | i | ) |
Definition at line 56 of file markdown.cpp.
Referenced by findEmphasisChar(), processCodeSpan(), processEmphasis(), and processHtmlTag().
#define isLiTag | ( | i | ) |
Definition at line 1307 of file markdown.cpp.
Referenced by computeIndentExcludingListMarkers().
#define isOpenEmphChar | ( | i | ) |
Definition at line 63 of file markdown.cpp.
Referenced by processEmphasis().
typedef int(* action_t)(GrowBuf &out, const char *data, int offset, int size) |
Definition at line 84 of file markdown.cpp.
enum Alignment |
|
static |
Definition at line 1315 of file markdown.cpp.
References isLiTag.
Referenced by isCodeBlock().
|
static |
Definition at line 135 of file markdown.cpp.
Referenced by extractPageTitle(), isAtxHeader(), isBlockCommand(), isFencedCodeBlock(), isLinkRef(), processBlocks(), processCodeSpan(), processHtmlTag(), and processLink().
|
static |
Definition at line 2270 of file markdown.cpp.
References GrowBuf::addChar(), Config_getInt, and GrowBuf::get().
Referenced by processMarkdown().
|
static |
Definition at line 111 of file markdown.cpp.
References GrowBuf::addChar(), and GrowBuf::get().
Referenced by processCodeSpan().
|
static |
Definition at line 2227 of file markdown.cpp.
References convertStringFragment(), extractTitleId(), isAtxHeader(), and isHeaderline().
Referenced by MarkdownFileParser::parseInput().
|
static |
Definition at line 1232 of file markdown.cpp.
References Config_getInt.
Referenced by extractPageTitle(), isAtxHeader(), and processBlocks().
|
static |
looks for the next emph char, skipping other constructs, and stopping when either it is found, or we are at the end of a paragraph.
Definition at line 240 of file markdown.cpp.
References ignoreCloseEmphChar, isBlockCommand(), and isIdChar.
Referenced by processEmphasis1(), processEmphasis2(), and processEmphasis3().
|
static |
Definition at line 1881 of file markdown.cpp.
References GrowBuf::addStr(), isBlockCommand(), and processHtmlTag().
Referenced by processBlocks(), and processQuotations().
int findTableColumns | ( | const char * | data, |
int | size, | ||
int & | start, | ||
int & | end, | ||
int & | columns | ||
) |
Finds the location of the table's contains in the string data. Only one line will be inspected.
[in] | data | pointer to the string buffer. |
[in] | size | the size of the buffer. |
[out] | start | offset of the first character of the table content |
[out] | end | offset of the last character of the table content |
[out] | columns | number of table columns found |
Definition at line 1497 of file markdown.cpp.
Referenced by isTableBlock(), and writeTableBlock().
|
static |
Referenced by processBlocks(), processLink(), and processMarkdown().
|
static |
Definition at line 1258 of file markdown.cpp.
References convertStringFragment(), and extractTitleId().
Referenced by extractPageTitle(), and writeOneLineHeaderOrRuler().
|
static |
Definition at line 186 of file markdown.cpp.
References convertStringFragment().
Referenced by findEmphasisChar(), findEndOfLine(), and processSpecialCommand().
|
static |
returns TRUE if this line starts a block quote
Definition at line 1090 of file markdown.cpp.
References codeBlockIndent.
Referenced by processQuotations().
|
static |
Definition at line 1421 of file markdown.cpp.
References codeBlockIndent, computeIndentExcludingListMarkers(), and isEmptyLine().
Referenced by processBlocks().
|
static |
Definition at line 1295 of file markdown.cpp.
Referenced by isCodeBlock().
|
static |
returns TRUE if input string docs starts with @page or @mainpage command
Definition at line 2205 of file markdown.cpp.
Referenced by MarkdownFileParser::parseInput().
|
static |
Definition at line 1382 of file markdown.cpp.
References convertStringFragment().
Referenced by processBlocks(), and processQuotations().
|
static |
returns whether the line is a setext-style hdr underline
Definition at line 1067 of file markdown.cpp.
Referenced by extractPageTitle(), and processBlocks().
|
static |
Definition at line 1205 of file markdown.cpp.
Referenced by writeOneLineHeaderOrRuler().
|
static |
returns end of the link ref if this is indeed a link reference.
Definition at line 1115 of file markdown.cpp.
References convertStringFragment().
Referenced by processBlocks().
|
static |
Returns TRUE iff data points to the start of a table block
Definition at line 1536 of file markdown.cpp.
References findTableColumns().
Referenced by processBlocks().
QCString markdownFileNameToId | ( | const QCString & | fileName | ) |
Definition at line 2373 of file markdown.cpp.
References stripFromPath(), and substitute().
Referenced by DocRef::DocRef(), and MarkdownFileParser::parseInput().
|
static |
helper function to convert presence of left and/or right alignment markers to a alignment value
Definition at line 146 of file markdown.cpp.
References AlignCenter, AlignLeft, AlignNone, and AlignRight.
Referenced by writeTableBlock().
|
static |
Definition at line 2040 of file markdown.cpp.
References GrowBuf::addChar(), GrowBuf::addStr(), Entry::anchors, SDict< T >::append(), codeBlockIndent, convertStringFragment(), extractTitleId(), SectionInfo::fileName, SDict< T >::find(), findEndOfLine(), g_fileName, g_lineNr, g_linkRefs(), GrowBuf::get(), isCodeBlock(), isFencedCodeBlock(), isHeaderline(), isLinkRef(), isTableBlock(), SectionInfo::lineNr, SectionInfo::Section, Doxygen::sectionDict, SectionInfo::Subsection, warn(), writeCodeBlock(), writeFencedCodeBlock(), writeOneLineHeaderOrRuler(), and writeTableBlock().
Referenced by processMarkdown().
|
static |
'`' parsing a code span (assuming codespan != 0)
Definition at line 921 of file markdown.cpp.
References GrowBuf::addStr(), convertStringFragment(), escapeSpecialChars(), and isIdChar.
Referenced by processMarkdown().
|
static |
Definition at line 592 of file markdown.cpp.
References isIdChar, isOpenEmphChar, processEmphasis1(), processEmphasis2(), and processEmphasis3().
Referenced by processMarkdown().
|
static |
process single emphasis
Definition at line 338 of file markdown.cpp.
References GrowBuf::addStr(), findEmphasisChar(), and processInline().
Referenced by processEmphasis(), and processEmphasis3().
|
static |
process double emphasis
Definition at line 369 of file markdown.cpp.
References GrowBuf::addStr(), findEmphasisChar(), and processInline().
Referenced by processEmphasis(), and processEmphasis3().
|
static |
Parsing tripple emphasis. Finds the first closing tag, and delegates to the other emph
Definition at line 398 of file markdown.cpp.
References GrowBuf::addStr(), findEmphasisChar(), processEmphasis1(), processEmphasis2(), and processInline().
Referenced by processEmphasis().
|
static |
Process a HTML tag. Note that
..
are treated specially, in the sense that all code inside is written unprocessed
Definition at line 508 of file markdown.cpp.
References GrowBuf::addStr(), convertStringFragment(), and isIdChar.
Referenced by findEndOfLine(), and processMarkdown().
|
static |
Definition at line 1043 of file markdown.cpp.
References GrowBuf::addStr(), and g_actions.
Referenced by processEmphasis1(), processEmphasis2(), processEmphasis3(), processLink(), and processMarkdown().
|
static |
Definition at line 634 of file markdown.cpp.
References GrowBuf::addStr(), convertStringFragment(), findFileDef(), g_linkRefs(), getLanguageFromFileName(), Doxygen::imageNameDict, LinkRef::link, processInline(), SrcLangExt_Markdown, Entry::stat, substitute(), and LinkRef::title.
Referenced by processMarkdown().
QCString processMarkdown | ( | const QCString & | fileName, |
const int | lineNr, | ||
Entry * | e, | ||
const QCString & | s | ||
) |
processes string s and converts markdown into doxygen/html commands.
Definition at line 2327 of file markdown.cpp.
References GrowBuf::addChar(), GrowBuf::clear(), detab(), g_actions, g_fileName, g_lineNr, g_linkRefs(), GrowBuf::get(), Config::init(), Debug::Markdown, Debug::print(), processBlocks(), processCodeSpan(), processEmphasis(), processHtmlTag(), processInline(), processLink(), processNmdash(), processQuotations(), processQuoted(), and processSpecialCommand().
|
static |
Process ndash and mdashes
Definition at line 455 of file markdown.cpp.
References GrowBuf::addStr().
Referenced by processMarkdown().
|
static |
Definition at line 1982 of file markdown.cpp.
References GrowBuf::addChar(), GrowBuf::addStr(), findEndOfLine(), GrowBuf::get(), isBlockQuote(), isFencedCodeBlock(), writeBlockQuote(), and writeFencedCodeBlock().
Referenced by processMarkdown().
|
static |
Process quoted section "...", can contain one embedded newline
Definition at line 487 of file markdown.cpp.
References GrowBuf::addStr().
Referenced by processMarkdown().
|
static |
Definition at line 999 of file markdown.cpp.
References GrowBuf::addChar(), GrowBuf::addStr(), and isBlockCommand().
Referenced by processMarkdown().
|
static |
Definition at line 1774 of file markdown.cpp.
References GrowBuf::addStr().
Referenced by processQuotations().
|
static |
Definition at line 1830 of file markdown.cpp.
References GrowBuf::addStr(), and codeBlockIndent.
Referenced by processBlocks().
|
static |
Definition at line 1967 of file markdown.cpp.
References GrowBuf::addStr().
Referenced by processBlocks(), and processQuotations().
void writeOneLineHeaderOrRuler | ( | GrowBuf & | out, |
const char * | data, | ||
int | size | ||
) |
Definition at line 1698 of file markdown.cpp.
References GrowBuf::addStr(), SectionInfo::Anchor, Entry::anchors, SDict< T >::append(), SectionInfo::fileName, SDict< T >::find(), g_fileName, g_lineNr, isAtxHeader(), isHRuler(), SectionInfo::lineNr, SectionInfo::Paragraph, SectionInfo::Section, Doxygen::sectionDict, SectionInfo::Subsection, SectionInfo::Subsubsection, and warn().
Referenced by processBlocks().
|
static |
Definition at line 1574 of file markdown.cpp.
References GrowBuf::addChar(), GrowBuf::addStr(), AlignCenter, AlignLeft, AlignNone, AlignRight, findTableColumns(), and markersToAlignment().
Referenced by processBlocks().
const int codeBlockIndent = 4 |
Definition at line 106 of file markdown.cpp.
Referenced by isBlockQuote(), isCodeBlock(), processBlocks(), and writeCodeBlock().
|
static |
Definition at line 92 of file markdown.cpp.
Referenced by processInline(), and processMarkdown().
|
static |
Definition at line 93 of file markdown.cpp.
|
static |
Definition at line 94 of file markdown.cpp.
Referenced by processBlocks(), processMarkdown(), and writeOneLineHeaderOrRuler().
|
static |
Definition at line 95 of file markdown.cpp.
Referenced by processBlocks(), processMarkdown(), and writeOneLineHeaderOrRuler().