Skip to content

Commit

Permalink
issue doxygen#8357 XML output does not include cross-references in co…
Browse files Browse the repository at this point in the history
…de-fragments

In case of explicit code samples the language was not specified for the code and the code was parsed verbatim.
Same was valid for code in the Docbook output.

The LaTeX version has been taken as reference for the implementation.
  • Loading branch information
albert-github committed Jan 27, 2021
1 parent 6dfd523 commit 74bb3ee
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/docbookgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,11 @@ DB_GEN_C
}
}

void DocbookGenerator::writeDoc(DocNode *n,const Definition *,const MemberDef *,int)
void DocbookGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int)
{
DB_GEN_C
DocbookDocVisitor *visitor =
new DocbookDocVisitor(t,*this);
new DocbookDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString(""));
n->accept(visitor);
delete visitor;
}
Expand Down
4 changes: 2 additions & 2 deletions src/docbookvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void DocbookDocVisitor::visitPostEnd(FTextStream &t, bool hasCaption, bool inlin
}
}

DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
: DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci)
DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt)
: DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci),m_langExt(langExt)
{
DB_VIS_C
// m_t << "<section>" << endl;
Expand Down
2 changes: 1 addition & 1 deletion src/docbookvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class QCString;
class DocbookDocVisitor : public DocVisitor
{
public:
DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci);
DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt);
~DocbookDocVisitor();
//--------------------------------------
// visitor functions for leaf nodes
Expand Down
5 changes: 3 additions & 2 deletions src/xmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ static void visitPostEnd(FTextStream &t, const char *cmd)
t << "</" << cmd << ">" << endl;
}

XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci)
: DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt)
: DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE),
m_langExt(langExt)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/xmldocvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class QCString;
class XmlDocVisitor : public DocVisitor
{
public:
XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci);
XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt);

//--------------------------------------
// visitor functions for leaf nodes
Expand Down
2 changes: 1 addition & 1 deletion src/xmlgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ static void writeXMLDocBlock(FTextStream &t,
// create a code generator
XMLCodeGenerator *xmlCodeGen = new XMLCodeGenerator(t);
// create a parse tree visitor for XML
XmlDocVisitor *visitor = new XmlDocVisitor(t,*xmlCodeGen);
XmlDocVisitor *visitor = new XmlDocVisitor(t,*xmlCodeGen,scope?scope->getDefFileExtension():QCString(""));
// visit all nodes
root->accept(visitor);
// clean up
Expand Down
2 changes: 1 addition & 1 deletion testing/014/indexpage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<para>
<programlisting>
<codeline>
<highlight class="normal">//<sp/>implicit<sp/>code<sp/>language</highlight>
<highlight class="comment">//<sp/>implicit<sp/>code<sp/>language</highlight>
</codeline>
</programlisting>
</para>
Expand Down

0 comments on commit 74bb3ee

Please sign in to comment.