Skip to content

Commit

Permalink
Confusing debug output for markdown
Browse files Browse the repository at this point in the history
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

=========
```
  • Loading branch information
albert-github committed May 11, 2021
1 parent cd998a7 commit 4ba3ff7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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," ");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/markdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit 4ba3ff7

Please sign in to comment.