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 2344 of file markdown.cpp.

2345 {
2346  QCString baseFn = stripFromPath(QFileInfo(fileName).absFilePath().utf8());
2347  int i = baseFn.findRev('.');
2348  if (i!=-1) baseFn = baseFn.left(i);
2349  QCString baseName = substitute(substitute(baseFn," ","_"),"/","_");
2350  return "md_"+baseName;
2351 }
QCString left(uint len) const
Definition: qcstring.cpp:213
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
static QCString stripFromPath(const QCString &path, QStrList &l)
Definition: util.cpp:274
static QCString baseName
Definition: scanner.cpp:10890
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
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 2298 of file markdown.cpp.

2299 {
2300  static bool init=FALSE;
2301  if (!init)
2302  {
2303  // setup callback table for special characters
2304  g_actions[(unsigned int)'_']=processEmphasis;
2305  g_actions[(unsigned int)'*']=processEmphasis;
2306  g_actions[(unsigned int)'`']=processCodeSpan;
2307  g_actions[(unsigned int)'\\']=processSpecialCommand;
2308  g_actions[(unsigned int)'@']=processSpecialCommand;
2309  g_actions[(unsigned int)'[']=processLink;
2310  g_actions[(unsigned int)'!']=processLink;
2311  g_actions[(unsigned int)'<']=processHtmlTag;
2312  g_actions[(unsigned int)'-']=processNmdash;
2313  g_actions[(unsigned int)'"']=processQuoted;
2314  init=TRUE;
2315  }
2316 
2317  g_linkRefs.setAutoDelete(TRUE);
2318  g_linkRefs.clear();
2319  g_current = e;
2320  g_fileName = fileName;
2321  g_lineNr = lineNr;
2322  static GrowBuf out;
2323  if (input.isEmpty()) return input;
2324  out.clear();
2325  int refIndent;
2326  // for replace tabs by spaces
2327  QCString s = detab(input,refIndent);
2328  //printf("======== DeTab =========\n---- output -----\n%s\n---------\n",s.data());
2329  // then process quotation blocks (as these may contain other blocks)
2330  s = processQuotations(s,refIndent);
2331  //printf("======== Quotations =========\n---- output -----\n%s\n---------\n",s.data());
2332  // then process block items (headers, rules, and code blocks, references)
2333  s = processBlocks(s,refIndent);
2334  //printf("======== Blocks =========\n---- output -----\n%s\n---------\n",s.data());
2335  // finally process the inline markup (links, emphasis and code spans)
2336  processInline(out,s,s.length());
2337  out.addChar(0);
2338  Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",qPrint(input),qPrint(out.get()));
2339  return out.get();
2340 }
void clear()
Definition: growbuf.h:15
uint length() const
Definition: qcstring.h:195
static int processEmphasis(GrowBuf &out, const char *data, int offset, int size)
Definition: markdown.cpp:589
static action_t g_actions[256]
Definition: markdown.cpp:92
static int processHtmlTag(GrowBuf &out, const char *data, int offset, int size)
Definition: markdown.cpp:505
const bool FALSE
Definition: qglobal.h:370
static QCString processQuotations(const QCString &s, int refIndent)
Definition: markdown.cpp:1976
init
Definition: train.py:42
static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int size)
Definition: markdown.cpp:996
static QCString processBlocks(const QCString &s, int indent)
Definition: markdown.cpp:2034
static int processNmdash(GrowBuf &out, const char *data, int off, int size)
Definition: markdown.cpp:452
void addChar(char c)
Definition: growbuf.h:16
static int g_lineNr
Definition: markdown.cpp:95
const double e
static int input(void)
Definition: code.cpp:15695
fileName
Definition: dumpTree.py:9
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition: debug.cpp:84
static Entry * g_current
Definition: markdown.cpp:93
static QCString detab(const QCString &s, int &refIndent)
Definition: markdown.cpp:2241
static int processQuoted(GrowBuf &out, const char *data, int, int size)
Definition: markdown.cpp:484
static int processCodeSpan(GrowBuf &out, const char *data, int, int size)
Definition: markdown.cpp:918
const char * get()
Definition: growbuf.h:38
static int processLink(GrowBuf &out, const char *data, int, int size)
Definition: markdown.cpp:631
static QCString g_fileName
Definition: markdown.cpp:94
static void processInline(GrowBuf &out, const char *data, int size)
Definition: markdown.cpp:1045
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
static QDict< LinkRef > g_linkRefs(257)