summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-02-17 20:09:36 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-02-17 20:09:36 (GMT)
commitb4bf112632354be795da81a9c0660eebf2ec81e5 (patch)
tree177e200b3ac93983f2f4ff7da48189792cc1092b
parentbf0e769bd9771d0a930261f570bafb1a828692aa (diff)
downloadDoxygen-b4bf112632354be795da81a9c0660eebf2ec81e5.zip
Doxygen-b4bf112632354be795da81a9c0660eebf2ec81e5.tar.gz
Doxygen-b4bf112632354be795da81a9c0660eebf2ec81e5.tar.bz2
a named anchor does not need custom attributes and minor other corrections.
-rw-r--r--src/docparser.cpp11
-rw-r--r--src/docparser.h6
-rw-r--r--src/htmldocvisitor.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 47c0c8c..aff7411 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -1042,7 +1042,7 @@ static int handleAHref(DocNode *parent,QList<DocNode> &children,const HtmlAttrib
// and remove the href attribute
bool result = attrList.remove(index);
ASSERT(result);
- DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE,attrList);
+ DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE);
children.append(anc);
break; // stop looking for other tag attribs
}
@@ -1934,7 +1934,7 @@ DocLinkedWord::DocLinkedWord(DocNode *parent,const QCString &word,
//---------------------------------------------------------------------------
-void DocAnchor::docAnchorInit(DocNode *parent,const QCString &id,bool newAnchor)
+DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor)
{
m_parent = parent;
if (id.isEmpty())
@@ -6866,9 +6866,10 @@ endparagraph:
DocNode *n = g_nodeStack.pop();
ASSERT(n==this);
DBG(("DocPara::parse() end retval=%x\n",retval));
- if (!g_token->endTag && retval == TK_NEWPARA && g_token->name.lower() == "p")
+ if (!g_token->endTag && n->kind()==DocNode::Kind_Para &&
+ retval==TK_NEWPARA && g_token->name.lower() == "p")
{
- ((DocPara *)n) -> m_attribs = g_token->attribs;
+ ((DocPara *)n)->setAttribs(g_token->attribs);
}
INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM ||
retval==TK_ENDLIST || retval>RetVal_OK
@@ -7137,7 +7138,7 @@ void DocRoot::parse()
DocPara *par = new DocPara(this);
if (isFirst) { par->markFirst(); isFirst=FALSE; }
retval=par->parse();
- if (!par->isEmpty() || par->attribs().count())
+ if (!par->isEmpty() || par->attribs().count()>0)
{
m_children.append(par);
lastPar=par;
diff --git a/src/docparser.h b/src/docparser.h
index 7363232..d36ed6c 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -331,9 +331,7 @@ class DocHorRuler : public DocNode
class DocAnchor : public DocNode
{
public:
- DocAnchor(DocNode *parent,const QCString &id,bool newAnchor){docAnchorInit(parent,id,newAnchor);}
- DocAnchor(DocNode *parent,const QCString &id,bool newAnchor,const HtmlAttribList &attribs) : m_attribs(attribs)
- {docAnchorInit(parent,id,newAnchor);}
+ DocAnchor(DocNode *parent,const QCString &id,bool newAnchor);
Kind kind() const { return Kind_Anchor; }
QCString anchor() const { return m_anchor; }
QCString file() const { return m_file; }
@@ -345,7 +343,6 @@ class DocAnchor : public DocNode
QCString m_anchor;
QCString m_file;
HtmlAttribList m_attribs;
- void docAnchorInit(DocNode *parent,const QCString &id,bool newAnchor);
};
/** Node representing a citation of some bibliographic reference */
@@ -1215,6 +1212,7 @@ class DocPara : public CompAccept<DocPara>
bool injectToken(int tok,const QCString &tokText);
const HtmlAttribList &attribs() const { return m_attribs; }
+ void setAttribs(const HtmlAttribList &attribs) { m_attribs = attribs; }
private:
QCString m_sectionId;
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 67fc98d..2b6b359 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -1494,7 +1494,9 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t)
{
QCString anc = t->caption()->anchor();
if (!anc.isEmpty())
+ {
m_t << "<a class=\"anchor\" id=\"" << anc << "\"></a>\n";
+ }
}
QString attrs = htmlAttribsToString(t->attribs());