diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/docparser.cpp | 6 | ||||
-rw-r--r-- | src/markdown.cpp | 16 | ||||
-rw-r--r-- | src/markdown.h | 1 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index 9bb80ac..4a18b4e 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -52,6 +52,7 @@ #include "formula.h" #include "config.h" #include "growbuf.h" +#include "markdown.h" // debug off #define DBG(x) do {} while(0) @@ -2417,8 +2418,13 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : QCString anchor; //printf("DocRef::DocRef(target=%s,context=%s)\n",target.data(),context.data()); ASSERT(!target.isEmpty()); + SrcLangExt lang = getLanguageFromFileName(target); m_relPath = g_relPath; SectionInfo *sec = Doxygen::sectionDict->find(target); + if (sec==0 && lang==SrcLangExt_Markdown) // lookup as markdown file + { + sec = Doxygen::sectionDict->find(markdownFileNameToId(target)); + } if (sec) // ref to section or anchor { PageDef *pd = 0; diff --git a/src/markdown.cpp b/src/markdown.cpp index 9d2876b..19c9187 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2249,6 +2249,15 @@ QCString processMarkdown(const QCString &fileName,Entry *e,const QCString &input //--------------------------------------------------------------------------- +QCString markdownFileNameToId(const QCString &fileName) +{ + 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; +} + void MarkdownFileParser::parseInput(const char *fileName, const char *fileBuf, Entry *root, @@ -2270,15 +2279,10 @@ void MarkdownFileParser::parseInput(const char *fileName, QCString docs = output.data(); QCString id; QCString title=extractPageTitle(docs,id).stripWhiteSpace(); - //g_correctSectionLevel = !title.isEmpty(); - QCString baseFn = stripFromPath(QFileInfo(fileName).absFilePath().utf8()); - int i = baseFn.findRev('.'); - if (i!=-1) baseFn = baseFn.left(i); QCString titleFn = QFileInfo(fileName).baseName().utf8(); QCString fn = QFileInfo(fileName).fileName().utf8(); - QCString baseName = substitute(substitute(baseFn," ","_"),"/","_"); static QCString mdfileAsMainPage = Config_getString("USE_MDFILE_AS_MAINPAGE"); - if (id.isEmpty()) id = "md_"+baseName; + if (id.isEmpty()) id = markdownFileNameToId(fileName); if (title.isEmpty()) title = titleFn; if (fn==mdfileAsMainPage) { diff --git a/src/markdown.h b/src/markdown.h index 99d59f0..d3a845e 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -23,6 +23,7 @@ class Entry; /** processes string \a s and converts markdown into doxygen/html commands. */ QCString processMarkdown(const QCString &fileName,Entry *e,const QCString &s); +QCString markdownFileNameToId(const QCString &fileName); class MarkdownFileParser : public ParserInterface { |