diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-02-17 20:11:29 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-02-17 20:11:29 (GMT) |
commit | 00fdd804310065e0405169c9b389ffcc1f5d09f5 (patch) | |
tree | 177e200b3ac93983f2f4ff7da48189792cc1092b | |
parent | af363c50c64268f473aa5b595a0379f8590c4759 (diff) | |
parent | b4bf112632354be795da81a9c0660eebf2ec81e5 (diff) | |
download | Doxygen-00fdd804310065e0405169c9b389ffcc1f5d09f5.zip Doxygen-00fdd804310065e0405169c9b389ffcc1f5d09f5.tar.gz Doxygen-00fdd804310065e0405169c9b389ffcc1f5d09f5.tar.bz2 |
Merge branch 'albert-github-feature/bug_136299'
-rw-r--r-- | src/docparser.cpp | 20 | ||||
-rw-r--r-- | src/docparser.h | 19 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 18 | ||||
-rw-r--r-- | src/scanner.l | 2 |
4 files changed, 44 insertions, 15 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index bcf4bac..aff7411 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1037,6 +1037,11 @@ static int handleAHref(DocNode *parent,QList<DocNode> &children,const HtmlAttrib { if (!opt->value.isEmpty()) { + // 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); 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) +DocAnchor::DocAnchor(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,11 @@ endparagraph: DocNode *n = g_nodeStack.pop(); ASSERT(n==this); DBG(("DocPara::parse() end retval=%x\n",retval)); + if (!g_token->endTag && n->kind()==DocNode::Kind_Para && + retval==TK_NEWPARA && g_token->name.lower() == "p") + { + ((DocPara *)n)->setAttribs(g_token->attribs); + } INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || retval==TK_ENDLIST || retval>RetVal_OK ); @@ -7128,7 +7138,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()>0) { m_children.append(par); lastPar=par; diff --git a/src/docparser.h b/src/docparser.h index 5d2cc89..d36ed6c 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -300,22 +300,31 @@ class DocURL : public DocNode class DocLineBreak : public DocNode { public: - DocLineBreak(DocNode *parent) { m_parent=parent; } + DocLineBreak(DocNode *parent) { m_parent = parent; } + DocLineBreak(DocNode *parent,const HtmlAttribList &attribs) + : m_attribs(attribs) { m_parent = parent; } Kind kind() const { return Kind_LineBreak; } void accept(DocVisitor *v) { v->visit(this); } + const HtmlAttribList &attribs() const { return m_attribs; } + private: + HtmlAttribList m_attribs; }; /** Node representing a horizontal ruler */ class DocHorRuler : public DocNode { public: - DocHorRuler(DocNode *parent) { m_parent = parent; } + DocHorRuler(DocNode *parent,const HtmlAttribList &attribs) + : m_attribs(attribs) { m_parent = parent; } Kind kind() const { return Kind_HorRuler; } void accept(DocVisitor *v) { v->visit(this); } + const HtmlAttribList &attribs() const { return m_attribs; } + private: + HtmlAttribList m_attribs; }; /** Node representing an anchor */ @@ -328,9 +337,12 @@ class DocAnchor : public DocNode QCString file() const { return m_file; } void accept(DocVisitor *v) { v->visit(this); } + const HtmlAttribList &attribs() const { return m_attribs; } + private: QCString m_anchor; QCString m_file; + HtmlAttribList m_attribs; }; /** Node representing a citation of some bibliographic reference */ @@ -1199,11 +1211,14 @@ class DocPara : public CompAccept<DocPara> int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level); 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; bool m_isFirst; bool m_isLast; + HtmlAttribList m_attribs; }; /** Node representing a parameter list. */ diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 25166bc..2b6b359 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -350,17 +350,17 @@ void HtmlDocVisitor::visit(DocURL *u) } } -void HtmlDocVisitor::visit(DocLineBreak *) +void HtmlDocVisitor::visit(DocLineBreak *br) { if (m_hide) return; - m_t << "<br />\n"; + m_t << "<br "<< htmlAttribsToString(br->attribs()) << " />\n"; } void HtmlDocVisitor::visit(DocHorRuler *hr) { if (m_hide) return; forceEndParagraph(hr); - m_t << "<hr/>\n"; + m_t << "<hr "<< htmlAttribsToString(hr->attribs()) << " />\n"; forceStartParagraph(hr); } @@ -614,7 +614,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) void HtmlDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; - m_t << "<a class=\"anchor\" id=\"" << anc->anchor() << "\"></a>"; + m_t << "<a class=\"anchor\" id=\"" << anc->anchor() << "\"" << htmlAttribsToString(anc->attribs()) << "></a>"; } void HtmlDocVisitor::visit(DocInclude *inc) @@ -1206,9 +1206,9 @@ void HtmlDocVisitor::visitPre(DocPara *p) //printf(" needsTag=%d\n",needsTag); // write the paragraph tag (if needed) if (needsTag) - m_t << "<p" << getDirHtmlClassOfNode(getTextDirByConfig(p), contexts[t]) << ">"; + m_t << "<p" << getDirHtmlClassOfNode(getTextDirByConfig(p), contexts[t]) << htmlAttribsToString(p->attribs()) << ">"; else if(!paragraphAlreadyStarted) - m_t << getHtmlDirEmbedingChar(getTextDirByConfig(p)); + m_t << getHtmlDirEmbedingChar(getTextDirByConfig(p)) << htmlAttribsToString(p->attribs()); } void HtmlDocVisitor::visitPost(DocPara *p) @@ -1492,7 +1492,11 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t) if (t->hasCaption()) { - m_t << "<a class=\"anchor\" id=\"" << t->caption()->anchor() << "\"></a>\n"; + QCString anc = t->caption()->anchor(); + if (!anc.isEmpty()) + { + m_t << "<a class=\"anchor\" id=\"" << anc << "\"></a>\n"; + } } QString attrs = htmlAttribsToString(t->attribs()); diff --git a/src/scanner.l b/src/scanner.l index 6633098..9b3d3f3 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -6732,7 +6732,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <DocCopyBlock><<EOF>> { warn(yyFileName,yyLineNr, - "reached end of file while inside a %s block!\n" + "reached end of file while inside a `%s' block!\n" "The command that should end the block seems to be missing!\n", docBlockName.data()); yyterminate(); |