summaryrefslogtreecommitdiffstats
path: root/src/docparser.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2019-02-04 18:31:01 (GMT)
committeralbert-github <albert.tests@gmail.com>2019-02-04 18:31:01 (GMT)
commit64ac36480f407145d8fe1e96ea4cf8f7e30285d5 (patch)
treec2ef84b9d62f4d097db1887691fb9ac2a4814f9e /src/docparser.cpp
parent8a31e77445a94277151666380860defedcc3838d (diff)
downloadDoxygen-64ac36480f407145d8fe1e96ea4cf8f7e30285d5.zip
Doxygen-64ac36480f407145d8fe1e96ea4cf8f7e30285d5.tar.gz
Doxygen-64ac36480f407145d8fe1e96ea4cf8f7e30285d5.tar.bz2
Bug 136299 - attributes to <p> tag get lost
Besides the `p` tag there were a number of other tags were also the attributes were lost: - `br` - `hr` - `a` in case of used as an anchor i.e. with the `name=` attribute In case of a `caption` with a `table` and no `id=` attribute with the `caption` there was still an anchor generated In scanner.l the warnings message was a bit unclear.
Diffstat (limited to 'src/docparser.cpp')
-rw-r--r--src/docparser.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 20ee1f0..1cca00e 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -1037,7 +1037,12 @@ static int handleAHref(DocNode *parent,QList<DocNode> &children,const HtmlAttrib
{
if (!opt->value.isEmpty())
{
- DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE);
+ // copy attributes
+ HtmlAttribList attrList = tagHtmlAttribs;
+ // and remove the href attribute
+ bool result = attrList.remove(index);
+ ASSERT(result);
+ DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE,attrList);
children.append(anc);
break; // stop looking for other tag attribs
}
@@ -1929,7 +1934,7 @@ DocLinkedWord::DocLinkedWord(DocNode *parent,const QCString &word,
//---------------------------------------------------------------------------
-DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor)
+void DocAnchor::docAnchorInit(DocNode *parent,const QCString &id,bool newAnchor)
{
m_parent = parent;
if (id.isEmpty())
@@ -3073,7 +3078,7 @@ int DocHtmlHeader::parse()
}
else if (tagId==HTML_BR)
{
- DocLineBreak *lb = new DocLineBreak(this);
+ DocLineBreak *lb = new DocLineBreak(this,g_token->attribs);
m_children.append(lb);
}
else
@@ -6080,13 +6085,13 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta
break;
case HTML_BR:
{
- DocLineBreak *lb = new DocLineBreak(this);
+ DocLineBreak *lb = new DocLineBreak(this,tagHtmlAttribs);
m_children.append(lb);
}
break;
case HTML_HR:
{
- DocHorRuler *hr = new DocHorRuler(this);
+ DocHorRuler *hr = new DocHorRuler(this,tagHtmlAttribs);
m_children.append(hr);
}
break;
@@ -6861,6 +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")
+ {
+ ((DocPara *)n) -> m_attribs = g_token->attribs;
+ }
INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM ||
retval==TK_ENDLIST || retval>RetVal_OK
);
@@ -7128,7 +7137,7 @@ void DocRoot::parse()
DocPara *par = new DocPara(this);
if (isFirst) { par->markFirst(); isFirst=FALSE; }
retval=par->parse();
- if (!par->isEmpty())
+ if (!par->isEmpty() || par->attribs().count())
{
m_children.append(par);
lastPar=par;