My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
markdown.h File Reference
#include <qcstring.h>
#include "parserintf.h"

Go to the source code of this file.

Classes

class  MarkdownFileParser
 

Functions

QCString processMarkdown (const QCString &fileName, const int lineNr, Entry *e, const QCString &s)
 
QCString markdownFileNameToId (const QCString &fileName)
 

Function Documentation

QCString markdownFileNameToId ( const QCString &  fileName)

Definition at line 2373 of file markdown.cpp.

References stripFromPath(), and substitute().

Referenced by DocRef::DocRef(), and MarkdownFileParser::parseInput().

{
QCString baseFn = stripFromPath(QFileInfo(fileName).absFilePath().utf8());
int i = baseFn.findRev('.');
if (i!=-1) baseFn = baseFn.left(i);
QCString baseName = substitute(substitute(baseFn," ","_"),"/","_");
return "md_"+baseName;
}
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 bool init=FALSE;
if (!init)
{
// setup callback table for special characters
g_actions[(unsigned int)'_']=processEmphasis;
g_actions[(unsigned int)'*']=processEmphasis;
g_actions[(unsigned int)'`']=processCodeSpan;
g_actions[(unsigned int)'\\']=processSpecialCommand;
g_actions[(unsigned int)'@']=processSpecialCommand;
g_actions[(unsigned int)'[']=processLink;
g_actions[(unsigned int)'!']=processLink;
g_actions[(unsigned int)'<']=processHtmlTag;
g_actions[(unsigned int)'-']=processNmdash;
g_actions[(unsigned int)'"']=processQuoted;
init=TRUE;
}
g_linkRefs.setAutoDelete(TRUE);
g_linkRefs.clear();
g_current = e;
g_fileName = fileName;
g_lineNr = lineNr;
static GrowBuf out;
if (input.isEmpty()) return input;
out.clear();
int refIndent;
// for replace tabs by spaces
QCString s = detab(input,refIndent);
//printf("======== DeTab =========\n---- output -----\n%s\n---------\n",s.data());
// then process quotation blocks (as these may contain other blocks)
s = processQuotations(s,refIndent);
//printf("======== Quotations =========\n---- output -----\n%s\n---------\n",s.data());
// then process block items (headers, rules, and code blocks, references)
s = processBlocks(s,refIndent);
//printf("======== Blocks =========\n---- output -----\n%s\n---------\n",s.data());
// finally process the inline markup (links, emphasis and code spans)
processInline(out,s,s.length());
out.addChar(0);
Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",qPrint(input),qPrint(out.get()));
return out.get();
}