summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cite.cpp2
-rw-r--r--src/commentscan.l45
-rw-r--r--src/context.cpp2
-rw-r--r--src/doxygen.cpp8
-rw-r--r--src/entry.cpp2
-rw-r--r--src/entry.h1
-rw-r--r--src/index.cpp2
-rw-r--r--src/markdown.cpp36
-rw-r--r--src/markdown.h2
-rw-r--r--src/pagedef.cpp26
-rw-r--r--src/pagedef.h4
-rw-r--r--src/reflist.cpp2
-rw-r--r--src/util.cpp17
-rw-r--r--src/util.h2
14 files changed, 90 insertions, 61 deletions
diff --git a/src/cite.cpp b/src/cite.cpp
index 03bdb02..e02641a 100644
--- a/src/cite.cpp
+++ b/src/cite.cpp
@@ -368,7 +368,7 @@ void CitationManager::generatePage()
//printf("doc=[%s]\n",doc.data());
// 7. add it as a page
- addRelatedPage(fileName(),theTranslator->trCiteReferences(),doc,fileName(),1);
+ addRelatedPage(fileName(),theTranslator->trCiteReferences(),doc,fileName(),1,1);
// 8. for latex we just copy the bib files to the output and let
// latex do this work.
diff --git a/src/commentscan.l b/src/commentscan.l
index ce495a1..25086f5 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -438,6 +438,8 @@ static void handleGuard(yyscan_t yyscanner,const QCString &expr);
static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
static void addCite(yyscan_t yyscanner);
+#define unputDocnl for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
+
//-----------------------------------------------------------------------------
#undef YY_INPUT
@@ -872,9 +874,9 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
yyextra->briefEndsAtDot=FALSE;
}
}
-<Comment>\n { // newline
- addOutput(yyscanner,*yytext);
- yyextra->lineNr++;
+<Comment>{DOCNL} { // newline
+ addOutput(yyscanner,yytext);
+ if (*yytext == '\n') yyextra->lineNr++;
}
<Comment>. { // catch-all for anything else
addOutput(yyscanner,*yytext);
@@ -954,7 +956,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
warn(yyextra->fileName,yyextra->lineNr,
"missing argument after \\enum."
);
- unput('\n');
+ unputDocnl;
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
@@ -977,7 +979,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
"missing argument after "
"\\namespace."
);
- unput('\n');
+ unputDocnl;
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
@@ -1000,7 +1002,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
"missing argument after "
"\\package."
);
- unput('\n');
+ unputDocnl;
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
@@ -1038,7 +1040,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
);
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
@@ -1047,7 +1049,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<ClassDocArg2>{DOCNL} {
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<ClassDocArg2>{FILE}|"<>" { // second argument; include file
@@ -1071,7 +1073,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
<ClassDocArg3>{DOCNL} {
//if (*yytext=='\n') yyextra->lineNr++;
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<ClassDocArg3>. { // ignore other stuff
@@ -1102,7 +1104,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
);
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<GroupDocArg1>. { // ignore other stuff
@@ -1125,7 +1127,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
"\\defgroup %s", yyextra->current->name.data()
);
}
- unput('\n');
+ unputDocnl;
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
BEGIN( Comment );
@@ -1150,7 +1152,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
"missing argument after "
"\\page."
);
- unput('\n');
+ unputDocnl;
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
BEGIN( Comment );
@@ -1158,7 +1160,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<PageDocArg1>. { // ignore other stuff
}
<PageDocArg2>{DOCNL} { // second argument; page title
- unput('\n');
+ unputDocnl;
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
BEGIN( Comment );
@@ -1192,7 +1194,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* --------- handle arguments of the file/dir/example command ------------ */
<FileDocArg1>{DOCNL} { // no file name specified
- unput('\n');
+ unputDocnl;
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
BEGIN( Comment );
@@ -1290,7 +1292,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
warn(yyextra->fileName,yyextra->lineNr,
"Missing argument of '\\%s' command",yyextra->currentCmd.data()
);
- unput('\n');
+ unputDocnl;
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
BEGIN( Comment );
@@ -1304,7 +1306,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<LineParam>{DOCNL} { // end of argument
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<LineParam>{LC} { // line continuation
@@ -1668,7 +1670,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<NameParam>{DOCNL} { // end of argument
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<NameParam>{LC} { // line continuation
@@ -1706,7 +1708,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<InGroupParam>{LC} { // line continuation
@@ -1724,7 +1726,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
{
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
yyextra->langParser->parsePrototype(yyextra->functionProto);
BEGIN( Comment );
}
@@ -1811,7 +1813,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
);
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<ExtendsParam>. { // ignore other stuff
@@ -1848,7 +1850,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
);
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
- unput('\n');
+ unputDocnl;
BEGIN( Comment );
}
<CiteLabel>. { // invalid character for cite label
@@ -2783,6 +2785,7 @@ static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s)
yyextra->current->section = s;
yyextra->current->fileName = yyextra->fileName;
yyextra->current->startLine = yyextra->lineNr;
+ yyextra->current->topLine = yyextra->lineNr;
return FALSE;
}
}
diff --git a/src/context.cpp b/src/context.cpp
index ee394d4..3f31747 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -10248,7 +10248,7 @@ void generateOutputViaTemplate()
else
{
// TODO: for LaTeX output index should be main... => solve in template
- Doxygen::mainPage = createPageDef("[generated]",1,"index","",theTranslator->trMainPage());
+ Doxygen::mainPage = createPageDef("[generated]",1,1,"index","",theTranslator->trMainPage());
Doxygen::mainPage->setFileName("index");
SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE));
ctx->set("mainPage",mainPage.get());
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 9b7ec34..9a27934 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -347,7 +347,7 @@ static void addRelatedPage(Entry *root)
}
PageDef *pd = addRelatedPage(root->name,root->args,doc,
- root->docFile,root->docLine,
+ root->docFile,root->docLine,root->topLine,
root->sli,
gd,root->tagInfo(),
FALSE,
@@ -8446,7 +8446,7 @@ static void findMainPage(Entry *root)
QCString title=root->args.stripWhiteSpace();
//QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index";
QCString indexName="index";
- Doxygen::mainPage = createPageDef(root->docFile,root->docLine,
+ Doxygen::mainPage = createPageDef(root->docFile,root->docLine,root->topLine,
indexName, root->brief+root->doc+root->inbodyDocs,title);
//setFileNameForSections(root->anchors,"index",Doxygen::mainPage);
Doxygen::mainPage->setBriefDescription(root->brief,root->briefFile,root->briefLine);
@@ -8485,7 +8485,7 @@ static void findMainPage(Entry *root)
{
warn(root->fileName,root->startLine,
"found more than one \\mainpage comment block! (first occurrence: %s, line %d), Skipping current block!",
- Doxygen::mainPage->docFile().data(),Doxygen::mainPage->docLine());
+ Doxygen::mainPage->docFile().data(),Doxygen::mainPage->topLine());
}
}
for (const auto &e : root->children()) findMainPage(e.get());
@@ -8663,7 +8663,7 @@ static void buildExampleList(Entry *root)
}
else
{
- PageDef *pd=createPageDef(root->fileName,root->startLine,
+ PageDef *pd=createPageDef(root->fileName,root->startLine,root->startLine,
root->name,root->brief+root->doc+root->inbodyDocs,root->args);
pd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE));
diff --git a/src/entry.cpp b/src/entry.cpp
index 6e343b0..78522f7 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -78,6 +78,7 @@ Entry::Entry(const Entry &e)
doc = e.doc;
docLine = e.docLine;
docFile = e.docFile;
+ topLine = e.topLine;
brief = e.brief;
briefLine = e.briefLine;
briefFile = e.briefFile;
@@ -196,6 +197,7 @@ void Entry::reset()
doc.resize(0);
docFile.resize(0);
docLine=-1;
+ topLine=-1;
relates.resize(0);
relatesType=Simple;
brief.resize(0);
diff --git a/src/entry.h b/src/entry.h
index d6c0936..f98eda6 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -264,6 +264,7 @@ class Entry
QCString includeName; //!< include name (3 arg of \\class)
QCString doc; //!< documentation block (partly parsed)
int docLine; //!< line number at which the documentation was found
+ int topLine; //!< line number at which the page / section definition was found
QCString docFile; //!< file in which the documentation was found
QCString brief; //!< brief description (doc block)
int briefLine; //!< line number at which the brief desc. was found
diff --git a/src/index.cpp b/src/index.cpp
index 12f35f2..78a1838 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -4499,7 +4499,7 @@ static void writeIndex(OutputList &ol)
{
ol.startHeaderSection();
ol.startTitleHead(0);
- ol.generateDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->docLine(),
+ ol.generateDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->topLine(),
Doxygen::mainPage,0,Doxygen::mainPage->title(),TRUE,FALSE,
0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
headerWritten = TRUE;
diff --git a/src/markdown.cpp b/src/markdown.cpp
index e268c48..1a7a382 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -2491,18 +2491,20 @@ static bool isExplicitPage(const QCString &docs)
return FALSE;
}
-QCString Markdown::extractPageTitle(QCString &docs,QCString &id)
+QCString Markdown::extractPageTitle(QCString &docs,QCString &id, int &prepend)
{
TRACE(docs.data());
- int ln=0;
// first first non-empty line
+ prepend = 0;
QCString title;
- const char *data = docs.data();
int i=0;
int size=docs.size();
+ QCString docs_org(docs);
+ const char *data = docs_org.data();
+ docs = "";
while (i<size && (data[i]==' ' || data[i]=='\n'))
{
- if (data[i]=='\n') ln++;
+ if (data[i]=='\n') prepend++;
i++;
}
if (i>=size) return "";
@@ -2512,16 +2514,13 @@ QCString Markdown::extractPageTitle(QCString &docs,QCString &id)
// first line from i..end1
if (end1<size)
{
- ln++;
// second line form end1..end2
int end2=end1+1;
while (end2<size && data[end2-1]!='\n') end2++;
if (isHeaderline(data+end1,size-end1,FALSE))
{
convertStringFragment(title,data+i,end1-i-1);
- QCString lns;
- lns.fill('\n',ln);
- docs=lns+docs.mid(end2);
+ docs+="\n\n"+docs_org.mid(end2);
id = extractTitleId(title, 0);
//printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",title.data(),docs.data(),id.data());
return title;
@@ -2529,10 +2528,11 @@ QCString Markdown::extractPageTitle(QCString &docs,QCString &id)
}
if (i<end1 && isAtxHeader(data+i,end1-i,title,id,FALSE)>0)
{
- docs=docs.mid(end1);
+ docs+=docs_org.mid(end1);
}
else
{
+ docs=docs_org;
id = extractTitleId(title, 0);
}
//printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",title.data(),docs.data(),id.data());
@@ -2687,6 +2687,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
ClangTUParser* /*clangParser*/)
{
std::shared_ptr<Entry> current = std::make_shared<Entry>();
+ int prepend = 0; // number of empty lines in front
current->lang = SrcLangExt_Markdown;
current->fileName = fileName;
current->docFile = fileName;
@@ -2694,7 +2695,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
QCString docs = fileBuf;
QCString id;
Markdown markdown(fileName,1,0);
- QCString title=markdown.extractPageTitle(docs,id).stripWhiteSpace();
+ QCString title=markdown.extractPageTitle(docs,id,prepend).stripWhiteSpace();
if (id.startsWith("autotoc_md")) id = "";
int indentLevel=title.isEmpty() ? 0 : -1;
markdown.setIndentLevel(indentLevel);
@@ -2711,21 +2712,22 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
QFileInfo(mdfileAsMainPage).absFilePath()) // file reference with path
)
{
- docs.prepend("@anchor " + id + "\n");
- docs.prepend("@mainpage "+title+"\n");
+ docs.prepend("@anchor " + id + "\\ilinebr ");
+ docs.prepend("@mainpage "+title+"\\ilinebr ");
}
else if (id=="mainpage" || id=="index")
{
if (title.isEmpty()) title = titleFn;
- docs.prepend("@anchor " + id + "\n");
- docs.prepend("@mainpage "+title+"\n");
+ docs.prepend("@anchor " + id + "\\ilinebr ");
+ docs.prepend("@mainpage "+title+"\\ilinebr ");
}
else
{
- if (title.isEmpty()) title = titleFn;
- if (!wasEmpty) docs.prepend("@anchor " + markdownFileNameToId(fileName) + "\n");
- docs.prepend("@page "+id+" "+title+"\n");
+ if (title.isEmpty()) {title = titleFn;prepend=0;}
+ if (!wasEmpty) docs.prepend("@anchor " + markdownFileNameToId(fileName) + "\\ilinebr ");
+ docs.prepend("@page "+id+" "+title+"\\ilinebr ");
}
+ for (int i = 0; i < prepend; i++) docs.prepend("\n");
}
int lineNr=1;
diff --git a/src/markdown.h b/src/markdown.h
index 1210967..dd4ff73 100644
--- a/src/markdown.h
+++ b/src/markdown.h
@@ -34,7 +34,7 @@ class Markdown
public:
Markdown(const char *fileName,int lineNr,int indentLevel=0);
QCString process(const QCString &input, int &startNewlines);
- QCString extractPageTitle(QCString &docs,QCString &id);
+ QCString extractPageTitle(QCString &docs,QCString &id,int &prepend);
void setIndentLevel(int level) { m_indentLevel = level; }
private:
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index 75e50ed..cad0615 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -32,12 +32,13 @@
class PageDefImpl : public DefinitionImpl, public PageDef
{
public:
- PageDefImpl(const char *f,int l,const char *n,const char *d,const char *t);
+ PageDefImpl(const char *f,int l,int p,const char *n,const char *d,const char *t);
virtual ~PageDefImpl();
virtual void setFileName(const char *name);
virtual void setLocalToc(const LocalToc &tl);
virtual void setShowLineNo(bool);
+ virtual void setTopLine(int);
virtual DefType definitionType() const { return TypePage; }
virtual bool isLinkableInProject() const { return /*hasDocumentation() &&*/ !isReference(); }
virtual bool isLinkable() const { return isLinkableInProject() || isReference(); }
@@ -58,6 +59,7 @@ class PageDefImpl : public DefinitionImpl, public PageDef
virtual Definition *getPageScope() const { return m_pageScope; }
virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionImpl::name(); }
virtual bool showLineNo() const;
+ virtual int topLine() const;
virtual void writeDocumentation(OutputList &ol);
virtual void writeTagFile(FTextStream &);
virtual void setNestingLevel(int l);
@@ -71,16 +73,17 @@ class PageDefImpl : public DefinitionImpl, public PageDef
int m_nestingLevel;
LocalToc m_localToc;
bool m_showLineNo;
+ int m_topLine;
};
-PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t)
+PageDef *createPageDef(const char *f,int l,int p,const char *n,const char *d,const char *t)
{
- return new PageDefImpl(f,l,n,d,t);
+ return new PageDefImpl(f,l,p,n,d,t);
}
//------------------------------------------------------------------------------------------
-PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
+PageDefImpl::PageDefImpl(const char *f,int l,int p,const char *n,
const char *d,const char *t)
: DefinitionImpl(f,l,1,n), m_title(t)
{
@@ -90,6 +93,7 @@ PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
m_nestingLevel = 0;
m_fileName = ::convertNameToFile(n,FALSE,TRUE);
m_showLineNo = FALSE;
+ m_topLine=p;
}
PageDefImpl::~PageDefImpl()
@@ -230,7 +234,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
if (si->title() != manPageName)
{
- ol.generateDoc(docFile(),docLine(),this,0,si->title(),TRUE,FALSE,
+ ol.generateDoc(docFile(),topLine(),this,0,si->title(),TRUE,FALSE,
0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endSection(si->label(),si->type());
}
@@ -250,7 +254,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
ol.startPageDoc(si->title());
//ol.startSection(si->label,si->title,si->type);
startTitle(ol,getOutputFileBase(),this);
- ol.generateDoc(docFile(),docLine(),this,0,si->title(),TRUE,FALSE,
+ ol.generateDoc(docFile(),topLine(),this,0,si->title(),TRUE,FALSE,
0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
//stringToSearchIndex(getOutputFileBase(),
// theTranslator->trPage(TRUE,TRUE)+" "+si->title,
@@ -394,6 +398,16 @@ bool PageDefImpl::showLineNo() const
return m_showLineNo;
}
+void PageDefImpl::setTopLine(int p)
+{
+ m_topLine = p;
+}
+
+int PageDefImpl::topLine() const
+{
+ return m_topLine;
+}
+
bool PageDefImpl::hasTitle() const
{
return !m_title.isEmpty() && m_title.lower()!="notitle";
diff --git a/src/pagedef.h b/src/pagedef.h
index e4d0268..5190405 100644
--- a/src/pagedef.h
+++ b/src/pagedef.h
@@ -35,6 +35,7 @@ class PageDef : virtual public Definition
virtual void setFileName(const char *name) = 0;
virtual void setLocalToc(const LocalToc &tl) = 0;
virtual void setShowLineNo(bool) = 0;
+ virtual void setTopLine(int) = 0;
// getters
virtual DefType definitionType() const = 0;
@@ -57,6 +58,7 @@ class PageDef : virtual public Definition
virtual Definition *getPageScope() const = 0;
virtual QCString displayName(bool=TRUE) const = 0;
virtual bool showLineNo() const = 0;
+ virtual int topLine() const = 0;
virtual void writeDocumentation(OutputList &) = 0;
virtual void writeTagFile(FTextStream &) = 0;
@@ -65,7 +67,7 @@ class PageDef : virtual public Definition
};
-PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t);
+PageDef *createPageDef(const char *f,int l,int p,const char *n,const char *d,const char *t);
class PageSDict : public SDict<PageDef>
{
diff --git a/src/reflist.cpp b/src/reflist.cpp
index ed26818..5840138 100644
--- a/src/reflist.cpp
+++ b/src/reflist.cpp
@@ -124,6 +124,6 @@ void RefList::generatePage()
//printf("generatePage('%s')\n",doc.data());
if (cnt>0)
{
- addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,RefItemVector(),0,0,TRUE);
+ addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,1,RefItemVector(),0,0,TRUE);
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 8310862..84e197b 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6004,7 +6004,7 @@ found:
PageDef *addRelatedPage(const char *name,const QCString &ptitle,
const QCString &doc,
- const char *fileName,int startLine,
+ const char *fileName,int startLine,int topLine,
const RefItemVector &sli,
GroupDef *gd,
const TagInfo *tagInfo,
@@ -6016,8 +6016,8 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
//printf("addRelatedPage(name=%s gd=%p)\n",name,gd);
if ((pd=Doxygen::pageSDict->find(name)) && !tagInfo)
{
- if (!xref) warn(fileName,startLine,"multiple use of page label '%s', (other occurrence: %s, line: %d)",
- name,pd->docFile().data(),pd->docLine());
+ if (!xref) warn(fileName,topLine,"multiple use of page label '%s', (other occurrence: %s, line: %d)",
+ name,pd->docFile().data(),pd->topLine());
// append documentation block to the page.
pd->setDocumentation(doc,fileName,startLine);
//printf("Adding page docs '%s' pi=%p name=%s\n",doc.data(),pd,name);
@@ -6033,7 +6033,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length());
QCString title=ptitle.stripWhiteSpace();
- pd=createPageDef(fileName,startLine,baseName,doc,title);
+ pd=createPageDef(fileName,startLine,topLine,baseName,doc,title);
pd->setRefItems(sli);
pd->setLanguage(lang);
@@ -6055,24 +6055,29 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
// a page name is a label as well!
QCString file;
+ QCString orgFile;
+ int line = -1;
if (gd)
{
file=gd->getOutputFileBase();
+ orgFile=gd->getOutputFileBase();
}
else
{
file=pd->getOutputFileBase();
+ orgFile=pd->docFile();
+ line = pd->topLine();
}
const SectionInfo *si = SectionManager::instance().find(pd->name());
if (si)
{
if (si->lineNr() != -1)
{
- warn(file,-1,"multiple use of section label '%s', (first occurrence: %s, line %d)",pd->name().data(),si->fileName().data(),si->lineNr());
+ warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s, line %d)",pd->name().data(),si->fileName().data(),si->lineNr());
}
else
{
- warn(file,-1,"multiple use of section label '%s', (first occurrence: %s)",pd->name().data(),si->fileName().data());
+ warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s)",pd->name().data(),si->fileName().data());
}
}
else
diff --git a/src/util.h b/src/util.h
index 76a9a6c..3a5df60 100644
--- a/src/util.h
+++ b/src/util.h
@@ -337,7 +337,7 @@ void addRefItem(const RefItemVector &sli,
PageDef *addRelatedPage(const char *name,
const QCString &ptitle,
const QCString &doc,
- const char *fileName,int startLine,
+ const char *fileName,int startLine,int topLine,
const RefItemVector &sli = RefItemVector(),
GroupDef *gd=0,
const TagInfo *tagInfo=0,