From 4ba3ff7849f4d3291cbbdca8ab0b6888fd549701 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 11 May 2021 10:29:10 +0200 Subject: Confusing debug output for markdown When having debug output one expects to have an overview what goes into the markdown processor and comes out of it. For markdown this happens but there can be a small step in front of it (page handling) and than the input is confusing as some processing already took place. When having a file aa.md: ``` This is a .md file ``` we get with `doxygen -d markdown`: ``` ======== Markdown ========= ---- input ------- @page md_aa aa\ilinebr This is a .md file ---- output ----- @page md_aa aa\ilinebr This is a .md file ========= ``` whilst it would be less confusing when we have: ``` ======== Markdown ========= ---- input ------- This is a .md file ---- output ----- @page md_aa aa\ilinebr This is a .md file ========= ``` --- src/markdown.cpp | 14 +++++++++++--- src/markdown.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 59ef730..48a46cd 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2695,7 +2695,7 @@ QCString Markdown::detab(const QCString &s,int &refIndent) //--------------------------------------------------------------------------- -QCString Markdown::process(const QCString &input, int &startNewlines) +QCString Markdown::process(const QCString &input, int &startNewlines, bool fromParseInput) { if (input.isEmpty()) return input; int refIndent; @@ -2718,7 +2718,14 @@ QCString Markdown::process(const QCString &input, int &startNewlines) m_out.clear(); processInline(s.data(),s.length()); m_out.addChar(0); - Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(m_out.get())); + if (fromParseInput) + { + Debug::print(Debug::Markdown,0,"---- output -----\n%s\n=========\n",qPrint(m_out.get())); + } + else + { + Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(m_out.get())); + } // post processing QCString result = substitute(m_out.get(),g_doxy_nsbp," "); @@ -2785,6 +2792,7 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName, current->docFile = fileName; current->docLine = 1; QCString docs = fileBuf; + Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n",qPrint(fileBuf)); QCString id; Markdown markdown(fileName,1,0); QCString title=markdown.extractPageTitle(docs,id,prepend).stripWhiteSpace(); @@ -2827,7 +2835,7 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName, Protection prot=Public; bool needsEntry = FALSE; int position=0; - QCString processedDocs = markdown.process(docs,lineNr); + QCString processedDocs = markdown.process(docs,lineNr,true); while (p->commentScanner.parseCommentBlock( this, current.get(), diff --git a/src/markdown.h b/src/markdown.h index afed003..9d5343c 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -33,7 +33,7 @@ class Markdown { public: Markdown(const QCString &fileName,int lineNr,int indentLevel=0); - QCString process(const QCString &input, int &startNewlines); + QCString process(const QCString &input, int &startNewlines, bool fromParseInput = false); QCString extractPageTitle(QCString &docs,QCString &id,int &prepend); void setIndentLevel(int level) { m_indentLevel = level; } -- cgit v0.12