From 7340b1c0e767b0ee88ce389df653d3d2a77801cd Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 7 Sep 2018 11:29:20 +0200 Subject: Implementation of standard generator for docbook output Till now docbook had its own output generator, but lot of possibilities were missing (see remark about updating below), with this patch the (more than) basic implementation has been made. Added some docbook tests to the current tests and updated documentation where necessary Tried updating current version but too many issues remained that were generically handled in the standard generator, code is in current version behind '#if 0' construct in doxygen.cpp and name with '_v1' and in docbookgen.cp' --- doc/commands.doc | 2 +- src/classdef.cpp | 11 +- src/commentscan.l | 4 + src/definition.cpp | 103 ++- src/docbookgen.cpp | 1900 ++++++++++++++++++++++++++++++++++++++------- src/docbookgen.h | 347 ++++++++- src/docbookvisitor.cpp | 531 +++++++++++-- src/docbookvisitor.h | 4 + src/docparser.h | 2 + src/dot.cpp | 57 +- src/doxygen.cpp | 38 +- src/filedef.cpp | 11 +- src/index.cpp | 31 +- src/marshal.cpp | 6 + src/memberdef.cpp | 12 + src/outputgen.h | 2 +- src/pagedef.cpp | 4 +- src/types.h | 10 +- src/util.cpp | 62 ++ src/util.h | 2 + testing/031/indexpage.xml | 1 + testing/031_image.dox | 1 + testing/043_page.dox | 2 +- 23 files changed, 2706 insertions(+), 437 deletions(-) diff --git a/doc/commands.doc b/doc/commands.doc index a630aac..beda764 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -2034,7 +2034,7 @@ Make sure you have first read \ref intro "the introduction". \addindex \\tableofcontents Creates a table of contents at the top of a page, listing all sections and subsections in the page. The `option` can be `HTML` or `LaTeX` - or `XML`. When a `level` is specified this means the maximum nesting level + or `XML` or `DocBook`. When a `level` is specified this means the maximum nesting level that is shown. The value of `level` should be in the range 1..5, values outside this range are considered to be 5. In case no `level` is specified `level` is set to 5 (show all) diff --git a/src/classdef.cpp b/src/classdef.cpp index 52aa96b..787cd5e 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1110,7 +1110,15 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.writeRuler(); - ol.parseText(generatedFromFiles()); + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Docbook); + ol.startParagraph(); + ol.parseText(generatedFromFiles()); + ol.endParagraph(); + ol.popGeneratorState(); + ol.disable(OutputGenerator::Docbook); + ol.parseText(generatedFromFiles()); + ol.enable(OutputGenerator::Docbook); bool first=TRUE; QListIterator li(m_impl->files); @@ -1839,6 +1847,7 @@ void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor) // LaTeX + RTF ol.disable(OutputGenerator::Html); ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); if (!(usePDFLatex && pdfHyperlinks)) { ol.disable(OutputGenerator::Latex); diff --git a/src/commentscan.l b/src/commentscan.l index 159f256..ac83729 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -2949,6 +2949,10 @@ static bool handleToc(const QCString &, const QCStringList &optList) { current->localToc.enableXml(level); } + else if (opt == "docbook") + { + current->localToc.enableDocbook(level); + } else { warn(yyFileName,yyLineNr,"Unknown option specified with \\tableofcontents: `%s'", (*it).stripWhiteSpace().data()); diff --git a/src/definition.cpp b/src/definition.cpp index cbfad94..ba0607b 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -921,6 +921,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); + static bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING); ol.pushGeneratorState(); //printf("Definition::writeSourceRef %d %p\n",bodyLine,bodyDef); QCString fn = getSourceFileBase(); @@ -945,11 +946,15 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (!docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (!rtfSourceCode) { ol.disable(OutputGenerator::RTF); } - // write line link (HTML, LaTeX optionally, RTF optionally) + // write line link (HTML and optionally LaTeX, Docbook, RTF) ol.writeObjectLink(0,fn,anchorStr,lineStr); ol.enableAll(); ol.disable(OutputGenerator::Html); @@ -957,6 +962,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -975,6 +984,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (!docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (!rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -987,6 +1000,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1009,6 +1026,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (!docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (!rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1021,6 +1042,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1040,6 +1065,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.enable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.enable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.enable(OutputGenerator::RTF); @@ -1052,6 +1081,10 @@ void Definition::writeSourceDef(OutputList &ol,const char *) { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1145,6 +1178,7 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, const QCString &text,MemberSDict *members,bool /*funcOnly*/) { static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); + static bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); static bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE); @@ -1203,6 +1237,10 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { ol.disable(OutputGenerator::Latex); } + if (!docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (!rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1221,6 +1259,10 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1238,6 +1280,10 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { ol.disable(OutputGenerator::Latex); } + if (!docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (!rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1255,6 +1301,10 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { ol.disable(OutputGenerator::Latex); } + if (docbookSourceCode) + { + ol.disable(OutputGenerator::Docbook); + } if (rtfSourceCode) { ol.disable(OutputGenerator::RTF); @@ -1633,7 +1683,7 @@ void Definition::writeToc(OutputList &ol, const LocalToc &localToc) int level=1,l; char cs[2]; cs[1]='\0'; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE }; + bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; for (li.toFirst();(si=li.current());++li) { if (si->type==SectionInfo::Section || @@ -1681,6 +1731,55 @@ void Definition::writeToc(OutputList &ol, const LocalToc &localToc) ol.popGeneratorState(); } + if (localToc.isDocbookEnabled()) + { + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Docbook); + ol.writeString(" \n"); + ol.writeString(" " + theTranslator->trRTFTableOfContents() + "\n"); + SectionDict *sectionDict = getSectionDict(); + SDict::Iterator li(*sectionDict); + SectionInfo *si; + int level=1,l; + bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; + int maxLevel = localToc.docbookLevel(); + for (li.toFirst();(si=li.current());++li) + { + if (si->type==SectionInfo::Section || + si->type==SectionInfo::Subsection || + si->type==SectionInfo::Subsubsection || + si->type==SectionInfo::Paragraph) + { + //printf(" level=%d title=%s\n",level,si->title.data()); + int nextLevel = (int)si->type; + if (nextLevel>level) + { + for (l=level;l\n"); + } + } + else if (nextLevelnextLevel;l--) + { + inLi[l]=FALSE; + if (l <= maxLevel) ol.writeString(" \n"); + } + } + if (nextLevel <= maxLevel) + { + QCString titleDoc = convertToDocBook(si->title); + ol.writeString(" " + (si->title.isEmpty()?si->label:titleDoc) + "\n"); + } + inLi[nextLevel]=TRUE; + level = nextLevel; + } + } + ol.writeString(" \n"); + ol.popGeneratorState(); + } + if (localToc.isLatexEnabled()) { ol.pushGeneratorState(); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 345629e..3793946 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * -* +* * * Copyright (C) 1997-2015 by Dimitri van Heesch. * @@ -21,11 +21,14 @@ #include #include #include +#include #include "docbookgen.h" #include "doxygen.h" #include "message.h" #include "config.h" #include "classlist.h" +#include "classdef.h" +#include "diagram.h" #include "util.h" #include "defargs.h" #include "outputgen.h" @@ -54,6 +57,17 @@ // debug inside output //#define Docbook_DB(x) QCString __t;__t.sprintf x;m_t << __t +#if 0 +#define DB_GEN_C DB_GEN_C1(t) +#define DB_GEN_C1(x) x << "\n"; +#define DB_GEN_C2(y) DB_GEN_C2a(t,y) +#define DB_GEN_C2a(x,y) x << "\n"; +#else +#define DB_GEN_C +#define DB_GEN_C1(x) +#define DB_GEN_C2(y) +#define DB_GEN_C2a(x,y) +#endif //------------------ class DocbookSectionMapper : public QIntDict @@ -104,7 +118,7 @@ static DocbookSectionMapper g_docbookSectionMapper; inline void writeDocbookString(FTextStream &t,const char *s) { - t << convertToXML(s); + t << convertToDocBook(s); } inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col) @@ -128,27 +142,44 @@ inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col) case '&': t << "&"; col++; break; case '\'': t << "'"; col++; break; case '"': t << """; col++; break; + case '\007': t << "^G"; col++; break; // bell + case '\014': t << "^L"; col++; break; // form feed default: t << c; col++; break; } } } -static void writeDocbookHeaderMainpage(FTextStream &t) +static void writeDocbookHeaderMainpage(FTextStream &t, QCString &pageName) { t << "" << endl;; - t << "" << endl; + t << "" << endl; } static void writeDocbookHeader_ID(FTextStream &t, QCString id) { t << "" << endl;; - t << "
" << endl; + t << "
" << endl; } +static void addIndexTerm(FTextStream &t, QCString prim, QCString sec = "") +{ + t << ""; + t << convertToDocBook(prim); + t << ""; + if (!sec.isEmpty()) + { + t << ""; + t << convertToDocBook(sec); + t << ""; + } + t << "" << endl; +} void writeDocbookLink(FTextStream &t,const char * /*extRef*/,const char *compoundId, const char *anchorId,const char * text,const char * /*tooltip*/) { - t << ""; @@ -175,110 +206,127 @@ class TextGeneratorDocbookImpl : public TextGeneratorIntf FTextStream &m_t; }; -class DocbookCodeGenerator : public CodeOutputInterface +DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) : m_lineNumber(-1), m_col(0), + m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE) { - public: - DocbookCodeGenerator(FTextStream &t) : m_t(t), m_lineNumber(-1), m_col(0), - m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE) {} - virtual ~DocbookCodeGenerator() {} + m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); + setTextStream(t); +} - void codify(const char *text) - { - Docbook_DB(("(codify \"%s\")\n",text)); - writeDocbookCodeString(m_t,text,m_col); - } - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) - { - Docbook_DB(("(writeCodeLink)\n")); - writeDocbookLink(m_t,ref,file,anchor,name,tooltip); - m_col+=strlen(name); - } - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & - ) - { - Docbook_DB(("(writeToolTip)\n")); - } - void startCodeLine(bool) - { - Docbook_DB(("(startCodeLine)\n")); - if (m_lineNumber!=-1) - { - if (!m_refId.isEmpty()) - { - m_t << ""; - } - m_t << m_lineNumber << " "; - if (!m_refId.isEmpty()) - { - m_t << ""; - } - } - m_insideCodeLine=TRUE; - m_col=0; - } - void endCodeLine() - { - m_t << endl; - Docbook_DB(("(endCodeLine)\n")); - m_lineNumber = -1; - m_refId.resize(0); - m_external.resize(0); - m_insideCodeLine=FALSE; - } - void startFontClass(const char *colorClass) - { - Docbook_DB(("(startFontClass)\n")); - m_t << ""; - m_insideSpecialHL=TRUE; - } - void endFontClass() - { - Docbook_DB(("(endFontClass)\n")); - m_t << ""; // non DocBook - m_insideSpecialHL=FALSE; - } - void writeCodeAnchor(const char *) - { - Docbook_DB(("(writeCodeAnchor)\n")); - } - void writeLineNumber(const char *extRef,const char *compId, - const char *anchorId,int l) - { - Docbook_DB(("(writeLineNumber)\n")); - // we remember the information provided here to use it - // at the start tag. - m_lineNumber = l; - if (compId) - { - m_refId=compId; - if (anchorId) m_refId+=(QCString)"_1"+anchorId; - if (extRef) m_external=extRef; - } - } - void setCurrentDoc(Definition *,const char *,bool) - { - } - void addWord(const char *,bool) +DocbookCodeGenerator::DocbookCodeGenerator() : m_lineNumber(-1), m_col(0), + m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE), m_streamSet(FALSE) +{ + m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); +} + +DocbookCodeGenerator::~DocbookCodeGenerator() {} + +void DocbookCodeGenerator::codify(const char *text) +{ + Docbook_DB(("(codify \"%s\")\n",text)); + writeDocbookCodeString(m_t,text,m_col); +} +void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip) +{ + Docbook_DB(("(writeCodeLink)\n")); + writeDocbookLink(m_t,ref,file,anchor,name,tooltip); + m_col+=strlen(name); +} +void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip) +{ + Docbook_DB(("(writeCodeLinkLine)\n")); + m_t << ""; + m_col+=strlen(name); +} +void DocbookCodeGenerator::writeTooltip(const char *, const DocLinkInfo &, const char *, + const char *, const SourceLinkInfo &, const SourceLinkInfo & + ) +{ + Docbook_DB(("(writeToolTip)\n")); +} +void DocbookCodeGenerator::startCodeLine(bool) +{ + Docbook_DB(("(startCodeLine)\n")); + m_insideCodeLine=TRUE; + m_col=0; +} +void DocbookCodeGenerator::endCodeLine() +{ + m_t << endl; + Docbook_DB(("(endCodeLine)\n")); + m_lineNumber = -1; + m_refId.resize(0); + m_external.resize(0); + m_insideCodeLine=FALSE; +} +void DocbookCodeGenerator::startFontClass(const char *colorClass) +{ + Docbook_DB(("(startFontClass)\n")); + m_t << ""; + m_insideSpecialHL=TRUE; +} +void DocbookCodeGenerator::endFontClass() +{ + Docbook_DB(("(endFontClass)\n")); + m_t << ""; // non DocBook + m_insideSpecialHL=FALSE; +} +void DocbookCodeGenerator::writeCodeAnchor(const char *) +{ + Docbook_DB(("(writeCodeAnchor)\n")); +} +void DocbookCodeGenerator::writeLineNumber(const char *ref,const char *fileName, + const char *anchor,int l) +{ + Docbook_DB(("(writeLineNumber)\n")); + m_insideCodeLine = TRUE; + if (m_prettyCode) + { + QCString lineNumber; + lineNumber.sprintf("%05d",l); + + if (fileName && !m_sourceFileName.isEmpty()) { + writeCodeLinkLine(ref,m_sourceFileName,anchor,lineNumber,0); + writeCodeLink(ref,fileName,anchor,lineNumber,0); } - void finish() + else { - if (m_insideCodeLine) endCodeLine(); + codify(lineNumber); } + m_t << " "; + } + else + { + m_t << l << " "; + } - private: - FTextStream &m_t; - QCString m_refId; - QCString m_external; - int m_lineNumber; - int m_col; - bool m_insideCodeLine; - bool m_insideSpecialHL; -}; - +} +void DocbookCodeGenerator::setCurrentDoc(Definition *,const char *,bool) +{ +} +void DocbookCodeGenerator::addWord(const char *,bool) +{ +} +void DocbookCodeGenerator::finish() +{ + if (m_insideCodeLine) endCodeLine(); +} +void DocbookCodeGenerator::startCodeFragment() +{ + m_t << "" << endl; +} +void DocbookCodeGenerator::endCodeFragment() +{ + m_t << "" << endl; +} static void writeTemplateArgumentList(ArgumentList *al, FTextStream &t, @@ -389,10 +437,205 @@ static QCString memberOutputFileBase(MemberDef *md) return md->getOutputFileBase(); } +static void generateTOC(FTextStream &t, PageDef *pd) +{ + if (pd->localToc().isDocbookEnabled()) + { + t << " " << endl; + t << " " << theTranslator->trRTFTableOfContents() << "" << endl; + SectionDict *sectionDict = pd->getSectionDict(); + SDict::Iterator li(*sectionDict); + SectionInfo *si; + int level=1,l; + bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; + int maxLevel = pd->localToc().docbookLevel(); + for (li.toFirst();(si=li.current());++li) + { + if (si->type==SectionInfo::Section || + si->type==SectionInfo::Subsection || + si->type==SectionInfo::Subsubsection || + si->type==SectionInfo::Paragraph) + { + //printf(" level=%d title=%s\n",level,si->title.data()); + int nextLevel = (int)si->type; + if (nextLevel>level) + { + for (l=level;l" << endl; + } + } + else if (nextLevelnextLevel;l--) + { + inLi[l]=FALSE; + if (l <= maxLevel) t << " " << endl; + } + } + if (nextLevel <= maxLevel) + { + QCString titleDoc = convertToDocBook(si->title); + t << " " << (si->title.isEmpty()?si->label:titleDoc) << "" << endl; + } + inLi[nextLevel]=TRUE; + level = nextLevel; + } + } + t << " " << endl; + } +} + +static void generateSourceRefList(FTextStream &t,const char *scopeName, const QCString &text,MemberSDict *members, Definition *def) +{ + static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); + static bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE); -static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *def, bool detailed=0) + if (members) + { + members->sort(); + + t << "" << convertToDocBook(text) << ""; + + QCString ldefLine=theTranslator->trWriteList(members->count()); + + QRegExp marker("@[0-9]+"); + int index=0,newIndex,matchLen; + // now replace all markers in inheritLine with links to the classes + while ((newIndex=marker.match(ldefLine,index,&matchLen))!=-1) + { + bool ok; + t << convertToDocBook(ldefLine.mid(index,newIndex-index)); + uint entryIndex = ldefLine.mid(newIndex+1,matchLen-1).toUInt(&ok); + MemberDef *md=members->at(entryIndex); + if (ok && md) + { + QCString scope=md->getScopeString(); + QCString name=md->name(); + //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),scope.data(),scopeName); + if (!scope.isEmpty() && scope!=scopeName) + { + name.prepend(scope+getLanguageSpecificSeparator(def->getLanguage())); + } + if (!md->isObjCMethod() && + (md->isFunction() || md->isSlot() || + md->isPrototype() || md->isSignal() + ) + ) + { + name+="()"; + } + //Definition *d = md->getOutputFileBase(); + //if (d==Doxygen::globalScope) d=md->getBodyDef(); + if (sourceBrowser && + !(md->isLinkable() && !refLinkSource) && + md->getStartBodyLine()!=-1 && + md->getBodyDef() + ) + { + //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); + + const int maxLineNrStr = 10; + char anchorStr[maxLineNrStr]; + qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); + //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data()); + t << convertToDocBook(name); + // or + // ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name); + } + else if (md->isLinkable() /*&& d && d->isLinkable()*/) + { + t << convertToDocBook(name); + // or + // ol.writeObjectLink(md->getReference(), md->getOutputFileBase(), md->anchor(),name); + } + else + { + t << convertToDocBook(name); + } + } + index=newIndex+matchLen; + } + t << ldefLine.right(ldefLine.length()-index); + t<< "."; + t << ""; + } +} +static void generateInlineCode(FTextStream &t,const char *scopeName, Definition *def) { + static bool inlineSources = Config_getBool(INLINE_SOURCES); + //printf("Source Fragment %s: %d-%d bodyDef=%p\n",name().data(), + // m_startBodyLine,m_endBodyLine,m_bodyDef); + if (inlineSources && def->hasSources()) + { + QCString codeFragment; + int actualStart=def->getStartBodyLine(),actualEnd=def->getEndBodyLine(); + if (readCodeFragment(def->getBodyDef()->absFilePath(), + actualStart,actualEnd,codeFragment) + ) + { + //printf("Adding code fragment '%s' ext='%s'\n", + // codeFragment.data(),m_impl->defFileExt.data()); + ParserInterface *pIntf = Doxygen::parserManager->getParser(def->getDefFileExtension()); + pIntf->resetCodeParserState(); + //printf("Read:\n`%s'\n\n",codeFragment.data()); + MemberDef *thisMd = 0; + if (def->definitionType()==Definition::TypeMember) thisMd = (MemberDef *)def; + + DocbookCodeGenerator *docbookGen = new DocbookCodeGenerator(t); + docbookGen->startCodeFragment(); + pIntf->parseCode(*docbookGen, // codeOutIntf + scopeName, // scope + codeFragment, // input + def->getLanguage(), // lang + FALSE, // isExample + 0, // exampleName + def->getBodyDef(), // fileDef + actualStart, // startLine + actualEnd, // endLine + TRUE, // inlineFragment + thisMd, // memberDef + TRUE // show line numbers + ); + docbookGen->finish(); + docbookGen->endCodeFragment(); + delete docbookGen; + } + } +} + +static void definedAtLine(int line, QCString fileName, FTextStream &t) +{ + QCString refText = theTranslator->trDefinedAtLineInSourceFile(); + int lineMarkerPos = refText.find("@0"); + int fileMarkerPos = refText.find("@1"); + if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this. + { + if (lineMarkerPosgetNamespaceDef()->name(); } - if (detailed==0) + if (detailed==0) { t << " " << endl; t << " " << endl; t << " " << endl; //enum bool closePara=TRUE; - if (md->memberType()==MemberType_Enumeration) + if (md->memberType()==MemberType_Enumeration) { + bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; MemberList *enumFields = md->enumFieldList(); - t << " " << memType << " " << memType << " getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -460,23 +704,23 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de { t << memberOutputFileBase(md); } - t << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << ""; - if (enumFields!=0) + t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; + if (enumFields!=0) { MemberListIterator emli(*enumFields); MemberDef *emd; t << " {" << endl; int cnt=0; - for (emli.toFirst();(emd=emli.current());++emli) + for (emli.toFirst();(emd=emli.current());++emli) { - if (cnt!=0) + if (cnt!=0) { t << "," << endl; } - t << "anchor() << "\">"; + t << "anchor() << "\">"; writeDocbookString(t,emd->name()); t << ""; - if (!emd->initializer().isEmpty()) + if (!emd->initializer().isEmpty()) { writeDocbookString(t,emd->initializer()); } @@ -492,9 +736,9 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << "" << endl; } } - else if (md->memberType()==MemberType_Define) + else if (md->memberType()==MemberType_Define) { - t << " " << "#" << memType << " " << "#" << memType << " getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -503,36 +747,36 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de { t << memberOutputFileBase(md); } - t << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << ""; - if (!md->initializer().isEmpty() && md->initializer().length()<2000) + t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; + if (!md->initializer().isEmpty() && md->initializer().length()<2000) { t << " "; linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->initializer()); } - if (md->briefDescription()) + if (md->briefDescription()) { t << ""; writeDocbookString(t,md->briefDescription()); t << "" << endl; } } - else if (md->memberType()==MemberType_Variable) + else if (md->memberType()==MemberType_Variable) { - if (md->getClassDef()) + if (md->getClassDef()) { - t << " " << convertToXML(md->declaration()); - if (md->briefDescription()) + t << " " << convertToDocBook(md->declaration()); + if (md->briefDescription()) { t << ""; writeDocbookString(t,md->briefDescription()); t << ""; } - } - else + } + else { t << " "; linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -541,7 +785,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de { t << memberOutputFileBase(md); } - t << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << ""; + t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; if (md->briefDescription()) { t << ""; @@ -550,13 +794,13 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de } } } - else if (md->memberType()==MemberType_Typedef) + else if (md->memberType()==MemberType_Typedef) { t << " " << memType; t << " "; linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); t << " "; - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -565,7 +809,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de { t << memberOutputFileBase(md); } - t << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << ""; + t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; if (md->briefDescription()) { t << ""; @@ -573,11 +817,11 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << "" << endl; } } - else if (md->memberType()==MemberType_Function) + else if (md->memberType()==MemberType_Function) { t << " "; linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -586,7 +830,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de { t << memberOutputFileBase(md); } - t << "_1" << md->anchor() << "\">" << convertToXML(md->name()) << ""; + t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; t << " (" << endl; ArgumentList *declAl = md->declArgumentList(); if (declAl && declAl->count()>0) @@ -596,7 +840,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de int cnt=0; for (declAli.toFirst();(a=declAli.current());++declAli) { - if (cnt!=0) + if (cnt!=0) { t << ", "; } @@ -634,7 +878,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de if (md->memberType()==MemberType_Enumeration) { MemberList *enumFields = md->enumFieldList(); - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -644,20 +888,20 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << memberOutputFileBase(md); } t << "_1" << md->anchor() << "\">" << endl; - t << " " << memType << " " << convertToXML(md->name()) << " " << "" << endl; + t << " " << memType << " " << convertToDocBook(md->name()) << " " << "" << endl; t << " "; writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << endl; - if (enumFields!=0) + if (enumFields!=0) { MemberListIterator emli(*enumFields); MemberDef *emd; t << " " << endl; t << " " << theTranslator->trEnumerationValues() << ":" << endl; t << " " << endl; - for (emli.toFirst();(emd=emli.current());++emli) + for (emli.toFirst();(emd=emli.current());++emli) { - t << " anchor() << "\">" << endl; t << " "; writeDocbookString(t,emd->name()); @@ -675,27 +919,30 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << " " << endl; t << " " << endl; t << " "; - t << "Definition at line " << md->getDefLine() << " of file " << stripPath(md->getDefFileName()) << endl; - t << " " << endl; + t << " "; + definedAtLine(md->getDefLine(),stripPath(md->getDefFileName()),t); + t << "" << endl; + + t << " " << endl; t << "{" << endl; - for (emli.toFirst();(emd=emli.current());++emli) + for (emli.toFirst();(emd=emli.current());++emli) { writeDocbookString(t,emd->name()); - if (!emd->initializer().isEmpty()) + if (!emd->initializer().isEmpty()) { writeDocbookString(t,emd->initializer()); } t << ", " << endl; } - t << "}" << convertToXML(md->name()) << ";" << endl; - t << " " << endl; + t << "}" << convertToDocBook(md->name()) << ";" << endl; + t << " " << endl; t << " " << endl; - t << "
" << endl; } + t << "
" << endl; } - else if (md->memberType()==MemberType_Typedef) + else if (md->memberType()==MemberType_Typedef) { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -705,7 +952,7 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << memberOutputFileBase(md); } t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToXML(md->definition()) << ""; + t << " " << convertToDocBook(md->definition()) << ""; if(Config_getBool(REPEAT_BRIEF)) { t << " "; @@ -717,9 +964,9 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << endl; t << "
" << endl; } - else if (md->memberType()==MemberType_Function) + else if (md->memberType()==MemberType_Function) { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -729,23 +976,38 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << memberOutputFileBase(md); } t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToXML(md->definition()) << " " << convertToXML(md->argsString()) << ""; + t << " " << convertToDocBook(md->definition()) << " " << convertToDocBook(md->argsString()) << ""; + addIndexTerm(t,md->name(),def->name()); + addIndexTerm(t,def->name(),md->name()); if(Config_getBool(REPEAT_BRIEF)) { + if (!md->briefDescription().isEmpty()) + { t << " "; writeDocbookString(t,md->briefDescription()); t << "" << endl; + } } t << " "; writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << endl; + + if (Config_getBool(REFERENCED_BY_RELATION)) + { + generateSourceRefList(t,md->name(),theTranslator->trReferencedBy(),md->getReferencedByMembers(),md); + } + if (Config_getBool(REFERENCES_RELATION)) + { + generateSourceRefList(t,md->name(),theTranslator->trReferences(),md->getReferencesMembers(),md); + } + generateInlineCode(t,md->name(),md); t << "
" << endl; } - else if (md->memberType()==MemberType_Define) + else if (md->memberType()==MemberType_Define) { - if (md->documentation()) + if (md->documentation()) { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -755,36 +1017,41 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << memberOutputFileBase(md); } t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToXML(md->definition()) << ""; + t << " " << convertToDocBook(md->definition()) << ""; t << " "; writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << endl; - t << " Definition at line " << md->getDefLine() << " of file " << stripPath(md->getDefFileName()) << "" << endl; - t << " The Documentation for this define was generated from the following file: " << endl; - t << " " << stripPath(md->getDefFileName()) << "" << endl; t << "
" << endl; } } - else if (md->memberType()==MemberType_Variable) + else if (md->memberType()==MemberType_Variable) { - if (md->getClassDef()) + if (md->getClassDef()) { - if (md->documentation()) + if (md->documentation()) { - t << " " << endl; - t << " " << convertToXML(md->definition()) << ""; + t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) + { + t << md->getGroupDef()->getOutputFileBase(); + } + else + { + t << memberOutputFileBase(md); + } + t << "_1" << md->anchor() << "\">" << endl; + t << " " << convertToDocBook(md->definition()) << ""; + addIndexTerm(t,md->name(),def->name()); + addIndexTerm(t,def->name(),md->name()); t << " "; writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << endl; - t << " Definition at line " << md->getDefLine() << " of file " << stripPath(md->getDefFileName()) << "" << endl; - t << " The Documentation for this struct was generated from the following file: " << endl; - t << " " << stripPath(md->getDefFileName()) << "" << endl; - t << " " << endl; + t << "
" << endl; } } - else + else { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) { t << md->getGroupDef()->getOutputFileBase(); @@ -794,7 +1061,9 @@ static void generateDocbookForMember(MemberDef *md,FTextStream &t,Definition *de t << memberOutputFileBase(md); } t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToXML(md->definition()) << ""; + t << " " << convertToDocBook(md->definition()) << ""; + addIndexTerm(t,md->name(),def->name()); + addIndexTerm(t,def->name(),md->name()); if(Config_getBool(REPEAT_BRIEF)) { t << " "; @@ -818,23 +1087,33 @@ static void generateDocbookSection(Definition *d,FTextStream &t,MemberList *ml,c MemberDef *md; int count=0; int doc_count=0; - QCString title, desctitle; + QCString title, desctitle, subtitle; - for (mli.toFirst();(md=mli.current());++mli) + for (mli.toFirst();(md=mli.current());++mli) { // namespace members are also inserted in the file scope, but // to prevent this duplication in the Docbook output, we filter those here. - if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) + if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) { count++; } } - + if (count==0) return; // empty list + subtitle = ""; switch (ml->listType()) { - case MemberListType_decDefineMembers: title=theTranslator->trDefines(); desctitle=theTranslator->trDefineDocumentation(); break; + case MemberListType_pubMethods: d->getLanguage()==SrcLangExt_ObjC ? title = theTranslator->trInstanceMethods() : title = theTranslator->trPublicMembers(); + switch (d->getLanguage()) + { + case SrcLangExt_ObjC: desctitle = theTranslator->trMethodDocumentation(); break; + case SrcLangExt_Fortran: desctitle = theTranslator->trMemberFunctionDocumentationFortran(); break; + default: desctitle = theTranslator->trMemberFunctionDocumentation(); break; + }; + break; + case MemberListType_priMethods: title=theTranslator->trPrivateMembers(); desctitle=""; break; + case MemberListType_decTypedefMembers: title=theTranslator->trTypedefs(); desctitle=theTranslator->trTypedefDocumentation(); break; case MemberListType_decEnumMembers: title=theTranslator->trEnumerations(); desctitle=theTranslator->trEnumerationTypeDocumentation(); break; case MemberListType_decFuncMembers: title=theTranslator->trFunctions(); desctitle=theTranslator->trFunctionDocumentation(); break; @@ -842,10 +1121,13 @@ static void generateDocbookSection(Definition *d,FTextStream &t,MemberList *ml,c case MemberListType_pubAttribs: title=theTranslator->trPublicAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; case MemberListType_priAttribs: title=theTranslator->trPrivateAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; case MemberListType_proAttribs: title=theTranslator->trProtectedAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; - default: title=""; desctitle=""; break; + case MemberListType_decDefineMembers: title=theTranslator->trDefines(); desctitle=theTranslator->trDefineDocumentation(); break; + case MemberListType_related: title=theTranslator->trRelatedFunctions(); desctitle=theTranslator->trRelatedFunctionDocumentation(); + subtitle=theTranslator->trRelatedSubscript(); break; + default: title=""; desctitle=""; } - if (detailed) + if (detailed) { for (mli.toFirst();(md=mli.current());++mli) { @@ -857,40 +1139,45 @@ static void generateDocbookSection(Definition *d,FTextStream &t,MemberList *ml,c break; } - if(doc_count == 0) + if(doc_count == 0) return; + + if (!QCString(header).isEmpty()) { - return; + t << "
" << endl; + t << " " << convertToDocBook(header) << "" << endl; } - - if (desctitle) + else if (desctitle) { - t << "
" << endl; - t << " " << desctitle << "" << endl; + t << "
" << endl; + t << " " << desctitle << "" << endl; } - } else + } + else { t << "
" << endl; - if (header) + if (!QCString(header).isEmpty()) { - t << " " << convertToXML(header) << "" << endl; - } - else + t << " " << convertToDocBook(header) << "" << endl; + } + else { t << " " << title << "" << endl; } + if (!subtitle.isEmpty()) + t << " " << subtitle << "" << endl; } - if (documentation) + if (documentation) { t << " "; writeDocbookDocBlock(t,d->docFile(),d->docLine(),d,0,documentation); t << "" << endl; } - for (mli.toFirst();(md=mli.current());++mli) + for (mli.toFirst();(md=mli.current());++mli) { // namespace members are also inserted in the file scope, but // to prevent this duplication in the Docbook output, we filter those here. - if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) + if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) { if (detailed && md->documentation().isEmpty() && !Config_getBool(REPEAT_BRIEF)) { @@ -900,14 +1187,18 @@ static void generateDocbookSection(Definition *d,FTextStream &t,MemberList *ml,c generateDocbookForMember(md,t,d,detailed); } } - if (detailed) + if (detailed) { - if (desctitle) + if (!QCString(header).isEmpty()) + { + t << "
" << endl; + } + else if (desctitle) { - t << "
" << endl; + t << "
" << endl; } - } - else + } + else { t << "
" << endl; } @@ -921,19 +1212,19 @@ static void writeInnerClasses(const ClassSDict *cl,FTextStream &t) ClassDef *cd; QCString title = theTranslator->trClasses(); - if (cli.toFirst()) + if (cli.toFirst()) { t << "
" << endl; t << " " << title << " " << endl; } for (cli.toFirst();(cd=cli.current());++cli) { - if (!cd->isHidden() && cd->name().find('@')==-1) + if (!cd->isHidden() && cd->name().find('@')==-1) { t << " " << endl; t << " " << endl; t << " " << endl; - t << " " << "struct " << convertToXML(cd->name()) << ""; + t << " " << "struct " << convertToDocBook(cd->name()) << ""; t << "" << endl; if (cd->briefDescription()) { @@ -946,7 +1237,7 @@ static void writeInnerClasses(const ClassSDict *cl,FTextStream &t) t << " " << endl; } } - if (cli.toFirst()) + if (cli.toFirst()) { t << "
" << endl; } @@ -961,7 +1252,7 @@ static void writeInnerNamespaces(const NamespaceSDict *nl,FTextStream &t) NamespaceDef *nd; QCString title = theTranslator->trNamespaces(); - if (nli.toFirst()) + if (nli.toFirst()) { t << " " << endl; t << " " << title << " " << endl; @@ -973,14 +1264,14 @@ static void writeInnerNamespaces(const NamespaceSDict *nl,FTextStream &t) t << " " << endl; t << " " << endl; t << " " << endl; - t << " " << "struct getOutputFileBase() << "\">" << convertToXML(nd->name()) << ""; + t << " " << "struct getOutputFileBase() << "\">" << convertToDocBook(nd->name()) << ""; t << "" << endl; t << " " << endl; t << " " << endl; t << " " << endl; } } - if (nli.toFirst()) + if (nli.toFirst()) { t << " " << endl; } @@ -995,23 +1286,23 @@ static void writeInnerFiles(const FileList *fl,FTextStream &t) FileDef *fd; QCString title = theTranslator->trFile(TRUE,TRUE); - if (fli.toFirst()) + if (fli.toFirst()) { t << " " << endl; t << " " << title << " " << endl; } - for (fli.toFirst();(fd=fli.current());++fli) + for (fli.toFirst();(fd=fli.current());++fli) { t << " " << endl; t << " " << endl; t << " " << endl; - t << " " << "file getOutputFileBase() << "\">" << convertToXML(fd->name()) << ""; + t << " " << "file getOutputFileBase() << "\">" << convertToDocBook(fd->name()) << ""; t << "" << endl; t << " " << endl; t << " " << endl; t << " " << endl; } - if (fli.toFirst()) + if (fli.toFirst()) { t << " " << endl; } @@ -1040,7 +1331,7 @@ static void writeInnerGroups(const GroupList *gl,FTextStream &t) GroupDef *sgd; //Docbook header tags for inner groups - if (gli.toFirst()) + if (gli.toFirst()) { t << " " << endl; t << " " << theTranslator->trModules() << "" << endl; @@ -1051,11 +1342,11 @@ static void writeInnerGroups(const GroupList *gl,FTextStream &t) for (gli.toFirst();(sgd=gli.current());++gli) { - t << " getOutputFileBase() << "\">" << convertToXML(sgd->groupTitle()) << "" << endl; + t << " getOutputFileBase() << "\">" << convertToDocBook(sgd->groupTitle()) << "" << endl; } //Docbook footer tags for inner groups - if (gli.toFirst()) + if (gli.toFirst()) { t << " " << endl; t << " " << endl; @@ -1071,7 +1362,7 @@ static void writeInnerDirs(const DirList *dl,FTextStream &t) QListIterator subdirs(*dl); DirDef *subdir; QCString title = theTranslator->trDirectories(); - if (subdirs.toFirst()) + if (subdirs.toFirst()) { t << " " << endl; t << " " << title << " " << endl; @@ -1081,13 +1372,13 @@ static void writeInnerDirs(const DirList *dl,FTextStream &t) t << " " << endl; t << " " << endl; t << " " << endl; - t << " " << "dir getOutputFileBase() << "\">" << convertToXML(subdir->displayName()) << ""; + t << " " << "dir getOutputFileBase() << "\">" << convertToDocBook(subdir->displayName()) << ""; t << "" << endl; t << " " << endl; t << " " << endl; t << " " << endl; } - if (subdirs.toFirst()) + if (subdirs.toFirst()) { t << " " << endl; } @@ -1152,8 +1443,15 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) writeDocbookHeader_ID(t, classOutputFileBase(cd)); t << ""; writeDocbookString(t,cd->name()); + addIndexTerm(t,cd->name()); t << " " << cd->compoundTypeString() << " Reference"; t << "" << endl; + if (cd->briefDescription()) + { + t << " " << endl; + writeDocbookDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); + t << " " << endl; + } IncludeInfo *ii=cd->includeInfo(); if (ii) @@ -1166,7 +1464,7 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) t << " #include "; if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references { - t << "fileDef->getOutputFileBase() << "\">"; + t << "fileDef->getOutputFileBase() << "\">"; } if (ii->local) { @@ -1176,7 +1474,7 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) { t << "<"; } - t << convertToXML(nm); + t << convertToDocBook(nm); if (ii->local) { t << """; @@ -1196,14 +1494,14 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) if (Config_getBool(HAVE_DOT) && (Config_getBool(CLASS_DIAGRAMS) || Config_getBool(CLASS_GRAPH))) { - t << "Inheritance diagram for " << convertToXML(cd->name()) << "" << endl; + t << "Inheritance diagram for " << convertToDocBook(cd->name()) << "" << endl; DotClassGraph inheritanceGraph(cd,DotNode::Inheritance); inheritanceGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE); } if (Config_getBool(HAVE_DOT) && Config_getBool(COLLABORATION_GRAPH)) { - t << "Collaboration diagram for " << convertToXML(cd->name()) << "" << endl; + t << "Collaboration diagram for " << convertToDocBook(cd->name()) << "" << endl; DotClassGraph collaborationGraph(cd,DotNode::Collaboration); collaborationGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE); } @@ -1222,7 +1520,6 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) } } - QListIterator mli(cd->getMemberLists()); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) @@ -1233,28 +1530,41 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) } } - if(Config_getBool(REPEAT_BRIEF)) + if ((Config_getBool(REPEAT_BRIEF) && cd->briefDescription()) || cd->documentation()) { - if (cd->briefDescription()) + t << " " << endl; + t << " " << theTranslator->trDetailedDescription() << "" << endl; + + if(Config_getBool(REPEAT_BRIEF)) + { + if (cd->briefDescription()) { - t << " " << endl; + t << " " << endl; // A title as 'Brief Description' may not be necessary. //t << " " << theTranslator->trBriefDescription() << "" << endl; writeDocbookDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); - t << " " << endl; + t << " " << endl; } + } + + if (cd->documentation()) + { + writeDocbookDocBlock(t,cd->docFile(),cd->docLine(),cd,0,cd->documentation()); + } + t << " " << endl; } - if (cd->documentation()) + if (cd->getMemberGroupSDict()) { - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,cd->docFile(),cd->docLine(),cd,0,cd->documentation()); - t << " Definition at line " << cd->getDefLine() << " of file " << stripPath(cd->getDefFileName()) << "" << endl; - t << " The Documentation for this struct was generated from the following file: " << endl; - t << " " << stripPath(cd->getDefFileName()) << "" << endl; - t << " " << endl; + MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + generateDocbookSection(cd,t,mg->members(),"user-defined",1,mg->header(), + mg->documentation()); + } } + for (mli.toFirst();(ml=mli.current());++mli) { if ((ml->listType()&MemberListType_detailedLists)==0) @@ -1295,6 +1605,8 @@ static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) writeListOfAllMembers(cd,t); */ + t << " " << cd->generatedFromFiles() << "" << endl; + t << " " << stripPath(cd->getDefFileName()) << "" << endl; t << "
" << endl; } @@ -1329,9 +1641,16 @@ static void generateDocbookForNamespace(NamespaceDef *nd,FTextStream &ti) writeDocbookHeader_ID(t, nd->getOutputFileBase()); t << ""; - writeDocbookString(t,nd->name()); + addIndexTerm(t,nd->displayName()); + writeDocbookString(t,nd->title()); t << "" << endl; + if (nd->briefDescription()) + { + t << " " << endl; + //t << " " << theTranslator->trBriefDescription() << "" << endl; + t << " " << endl; + } writeInnerClasses(nd->getClassSDict(),t); writeInnerNamespaces(nd->getNamespaceSDict(),t); @@ -1356,27 +1675,52 @@ static void generateDocbookForNamespace(NamespaceDef *nd,FTextStream &ti) } } - if(Config_getBool(REPEAT_BRIEF)) + if ((Config_getBool(REPEAT_BRIEF) && nd->briefDescription()) || nd->documentation()) { - if (nd->briefDescription()) + t << " " << endl; + t << " " << theTranslator->trDetailedDescription() << "" << endl; + + if(Config_getBool(REPEAT_BRIEF)) + { + if (nd->briefDescription()) { - t << " " << endl; + t << " " << endl; //t << " " << theTranslator->trBriefDescription() << "" << endl; writeDocbookDocBlock(t,nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription()); - t << " " << endl; + t << " " << endl; } + } + + if (nd->documentation()) + { + writeDocbookDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); + } + t << " " << endl; } - if (nd->documentation()) + if (nd->getMemberGroupSDict()) { - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); - t << " Definition at line " << nd->getDefLine() << " of file " << stripPath(nd->getDefFileName()) << "" << endl; - t << " The Documentation for this struct was generated from the following file: " << endl; - t << " " << stripPath(nd->getDefFileName()) << "" << endl; - t << " " << endl; + MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + generateDocbookSection(nd,t,mg->members(),"user-defined",1,mg->header(), + mg->documentation()); + } + } + + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberListType_detailedLists)==0) + { + if (ml->listType() != MemberListType_allMembersList && + ml->listType() != MemberListType_docFuncMembers) + generateDocbookSection(nd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); + } } + // we actually need here "namespace" + // t << " " << theTranslator->trGeneratedFromFiles(ClassDef::Struct, FALSE) << "" << endl; + // t << " " << stripPath(nd->getDefFileName()) << "" << endl; t << "
" << endl; } @@ -1421,6 +1765,13 @@ static void generateDocbookForFile(FileDef *fd,FTextStream &ti) t << " File Reference"; t << "" << endl; + if (fd->briefDescription()) + { + t << " " << endl; + writeDocbookDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); + t << " " << endl; + } + IncludeInfo *inc; if (fd->includeFileList()) @@ -1437,7 +1788,7 @@ static void generateDocbookForFile(FileDef *fd,FTextStream &ti) { t << "<"; } - t << convertToXML(inc->includeName); + t << convertToDocBook(inc->includeName); if (inc->local) { t << """; @@ -1453,13 +1804,13 @@ static void generateDocbookForFile(FileDef *fd,FTextStream &ti) { if (Config_getBool(INCLUDE_GRAPH)) { - t << "Include dependency diagram for " << convertToXML(fd->name()) << "" << endl; + t << "Include dependency diagram for " << convertToDocBook(fd->name()) << "" << endl; DotInclDepGraph idepGraph(fd, FALSE); idepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); } if (Config_getBool(INCLUDED_BY_GRAPH)) { - t << "Included by dependency diagram for " << convertToXML(fd->name()) << "" << endl; + t << "Included by dependency diagram for " << convertToDocBook(fd->name()) << "" << endl; DotInclDepGraph ibdepGraph(fd, TRUE); ibdepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); } @@ -1497,9 +1848,15 @@ static void generateDocbookForFile(FileDef *fd,FTextStream &ti) t << " " << endl; t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); + if(Config_getBool(REPEAT_BRIEF)) + { + if (fd->briefDescription()) + { + writeDocbookDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); + } + } writeDocbookDocBlock(t,fd->docFile(),fd->docLine(),fd,0,fd->documentation()); - if (Config_getBool(FULL_PATH_NAMES)) + if (Config_getBool(FULL_PATH_NAMES)) { t << " Definition in file " << fd->getDefFileName() << "" << endl; } @@ -1509,9 +1866,17 @@ static void generateDocbookForFile(FileDef *fd,FTextStream &ti) } t << " " << endl; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberListType_declarationLists)!=0) + { + generateDocbookSection(fd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); + } + } + if (Config_getBool(DOCBOOK_PROGRAMLISTING)) { - t << " " << endl; + t << " " << endl;; writeDocbookCodeBlock(t,fd); t << " " << endl; } @@ -1535,7 +1900,7 @@ static void generateDocbookForGroup(GroupDef *gd,FTextStream &ti) if (gd->isReference()) return; // skip external references - if (!gd->isASubGroup()) + if (!gd->isASubGroup()) { QCString fileDocbook=gd->getOutputFileBase()+".xml"; //Add the file Documentation info to index file @@ -1557,31 +1922,21 @@ static void generateDocbookForGroup(GroupDef *gd,FTextStream &ti) //t.setEncoding(FTextStream::UnicodeUTF8); writeDocbookHeader_ID(t, gd->getOutputFileBase()); - t << " " << convertToXML(gd->groupTitle()) << "" << endl; + t << " " << convertToDocBook(gd->groupTitle()) << "" << endl; + if (gd->briefDescription()) + { + t << " " << endl; + writeDocbookDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); + t << " " << endl; + } if (Config_getBool(GROUP_GRAPHS) && Config_getBool(HAVE_DOT)) { - t << "Collaboration diagram for " << convertToXML(gd->groupTitle()) << "" << endl; + t << "Collaboration diagram for " << convertToDocBook(gd->groupTitle()) << "" << endl; DotGroupCollaboration collaborationGraph(gd); collaborationGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); } - if (gd->briefDescription()) - { - //t << "
" << endl; - //t << " " << theTranslator->trBriefDescription() << "" << endl; - writeDocbookDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); - //t << "
" << endl; - } - - if (gd->documentation()) - { - t << "
" << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,gd->docFile(),gd->docLine(),gd,0,gd->documentation()); - t << "
" << endl; - } - writeInnerFiles(gd->getFiles(),t); writeInnerClasses(gd->getClasses(),t); writeInnerNamespaces(gd->getNamespaces(),t); @@ -1608,6 +1963,26 @@ static void generateDocbookForGroup(GroupDef *gd,FTextStream &ti) generateDocbookSection(gd,t,ml,g_docbookSectionMapper.find(ml->listType())); } } + + if(Config_getBool(REPEAT_BRIEF)) + { + if (gd->briefDescription()) + { + //t << "
" << endl; + //t << " " << theTranslator->trBriefDescription() << "" << endl; + writeDocbookDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); + //t << "
" << endl; + } + } + + if (gd->documentation()) + { + t << " " << endl; + t << " " << theTranslator->trDetailedDescription() << "" << endl; + writeDocbookDocBlock(t,gd->docFile(),gd->docLine(),gd,0,gd->documentation()); + t << " " << endl; + } + for (mli.toFirst();(ml=mli.current());++mli) { if ((ml->listType()&MemberListType_declarationLists)!=0) @@ -1648,9 +2023,13 @@ static void generateDocbookForDir(DirDef *dd,FTextStream &ti) t << " "; t << theTranslator->trDirReference(dd->displayName()); t << "" << endl; + if (dd->briefDescription()) + { + writeDocbookDocBlock(t,dd->briefFile(),dd->briefLine(),dd,0,dd->briefDescription()); + } if (Config_getBool(DIRECTORY_GRAPH) && Config_getBool(HAVE_DOT)) { - t << "Directory dependency diagram for " << convertToXML(dd->displayName()) << "" << endl; + t << "Directory dependency diagram for " << convertToDocBook(dd->displayName()) << "" << endl; DotDirDeps dirdepGraph(dd); dirdepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); } @@ -1660,7 +2039,12 @@ static void generateDocbookForDir(DirDef *dd,FTextStream &ti) t << " " << endl; t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,dd->briefFile(),dd->briefLine(),dd,0,dd->briefDescription()); + if (dd->briefDescription()) + { + t << " " << endl; + writeDocbookDocBlock(t,dd->briefFile(),dd->briefLine(),dd,0,dd->briefDescription()); + t << " " << endl; + } writeDocbookDocBlock(t,dd->docFile(),dd->docLine(),dd,0,dd->documentation()); t << " Directory location is " << dd->name() << "" << endl; t << " " << endl; @@ -1681,7 +2065,7 @@ static void generateDocbookForPage(PageDef *pd,FTextStream &ti,bool isExample) { pageName+=(QCString)"_"+pd->name(); } - if (pageName=="index") + if (pageName=="index") { pageName="mainpage"; // to prevent overwriting the generated index page. } @@ -1709,9 +2093,9 @@ static void generateDocbookForPage(PageDef *pd,FTextStream &ti,bool isExample) QCString fileDocbook=pageName+".xml"; //Add the file Documentation info to index file ti << " " << endl; - writeDocbookHeaderMainpage(t); - } - else + writeDocbookHeaderMainpage(t,pageName); + } + else { QCString pid; if(isExample) @@ -1728,13 +2112,17 @@ static void generateDocbookForPage(PageDef *pd,FTextStream &ti,bool isExample) SectionInfo *si = Doxygen::sectionDict->find(pd->name()); if (si) { - t << " " << convertToXML(si->title) << "" << endl; - } - else + if ( pageName == "mainpage") + t << " " << convertToDocBook(theTranslator->trMainPage()) << "" << endl; + else + t << " " << convertToDocBook(si->title) << "" << endl; + } + else { - t << " " << convertToXML(pd->name()) << "" << endl; + t << " " << convertToDocBook(pd->name()) << "" << endl; } + generateTOC(t, pd); if (isExample) { writeDocbookDocBlock(t,pd->docFile(),pd->docLine(),pd,0, @@ -1750,14 +2138,13 @@ static void generateDocbookForPage(PageDef *pd,FTextStream &ti,bool isExample) if (!pd->hasParentPage() && !isExample) { t << endl << "
" << endl; - } - else + } + else { t << endl << "" << endl; } } - -void generateDocbook() +void generateDocbook_v1() { // + classes @@ -1824,7 +2211,7 @@ void generateDocbook() t << "" << endl;; t << "" << endl; t << " " << endl; - t << " " << dbk_projectName << "" << endl; + t << " " << convertToDocBook(dbk_projectName) << "" << endl; t << " " << endl; // NAMESPACE DOCUMENTATION @@ -1832,7 +2219,7 @@ void generateDocbook() NamespaceDef *nd; //Namespace Documentation index header - if (nli.toFirst()) + if (nli.toFirst()) { t << " " << endl; t << " Namespace Documentation" << endl; @@ -1845,7 +2232,7 @@ void generateDocbook() } //Namespace Documentation index footer - if (nli.toFirst()) + if (nli.toFirst()) { t << " " << endl; } @@ -1876,7 +2263,7 @@ void generateDocbook() GroupDef *gd; //Module group Documentation index header - if (gli.toFirst()) + if (gli.toFirst()) { t << " " << endl; t << " " << theTranslator->trModuleDocumentation() << "" << endl; @@ -1889,7 +2276,7 @@ void generateDocbook() } //Module group Documentation index footer - if (gli.toFirst()) + if (gli.toFirst()) { t << " " << endl; } @@ -1901,7 +2288,7 @@ void generateDocbook() ClassDef *cd; //Class Documentation index header - if (cli.toFirst()) + if (cli.toFirst()) { t << " " << endl; t << " " << theTranslator->trClassDocumentation() << "" << endl; @@ -1913,7 +2300,7 @@ void generateDocbook() } //Class Documentation index footer - if (cli.toFirst()) + if (cli.toFirst()) { t << " " << endl; } @@ -1928,7 +2315,7 @@ void generateDocbook() FileName *fn; //File Documentation index header - if (fnli.toFirst()) + if (fnli.toFirst()) { t << " " << endl; t << " " << theTranslator->trFileDocumentation() << "" << endl; @@ -1946,7 +2333,7 @@ void generateDocbook() } //File Documentation index footer - if (fnli.toFirst()) + if (fnli.toFirst()) { t << " " << endl; } @@ -1959,7 +2346,7 @@ void generateDocbook() DirSDict::Iterator sdi(*Doxygen::directories); //Directory Documentation index header - if (sdi.toFirst()) + if (sdi.toFirst()) { t << " " << endl; t << " " << theTranslator->trDirDocumentation() << "" << endl; @@ -1972,7 +2359,7 @@ void generateDocbook() } //Module group Documentation index footer - if (sdi.toFirst()) + if (sdi.toFirst()) { t << " " << endl; } @@ -1985,7 +2372,7 @@ void generateDocbook() PageDef *pd=0; //Example Page Documentation index header - if (pdi.toFirst()) + if (pdi.toFirst()) { t << " " << endl; t << " " << theTranslator->trExampleDocumentation() << "" << endl; @@ -1998,14 +2385,937 @@ void generateDocbook() } //Example Page Documentation index footer - if (pdi.toFirst()) + if (pdi.toFirst()) { t << " " << endl; } } + t << "" << endl; t << "" << endl; } +DocbookGenerator::DocbookGenerator() : OutputGenerator() +{ +DB_GEN_C + dir=Config_getString(DOCBOOK_OUTPUT); + //insideTabbing=FALSE; + //firstDescItem=TRUE; + //disableLinks=FALSE; + //m_indent=0; + //templateMemberItem = FALSE; + m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); + for (int i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE; + for (int i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE; +} + +DocbookGenerator::~DocbookGenerator() +{ +DB_GEN_C +} + +void DocbookGenerator::init() +{ + QCString dir=Config_getString(DOCBOOK_OUTPUT); + QDir d(dir); + if (!d.exists() && !d.mkdir(dir)) + { + err("Could not create output directory %s\n",dir.data()); + exit(1); + } + createSubDirs(d); +} + +void DocbookGenerator::startFile(const char *name,const char *,const char *) +{ +DB_GEN_C + QCString fileName=name; + QCString pageName; + QCString fileType="section"; + if (fileName == "refman") + { + fileName="index"; + fileType="book"; + } + else if (fileName == "index") + { + fileName="mainpage"; + fileType="chapter"; + } + pageName = fileName; + relPath = relativePathToRoot(fileName); + if (fileName.right(4)!=".xml") fileName+=".xml"; + startPlainFile(fileName); + m_codeGen.setTextStream(t); + m_codeGen.setRelativePath(relPath); + m_codeGen.setSourceFileName(stripPath(fileName)); + + t << "" << endl;; + t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""; + if (!pageName.isEmpty()) t << " xml:id=\"_" << stripPath(pageName) << "\""; + t << ">" << endl; +} + +void DocbookGenerator::endFile() +{ +DB_GEN_C + if (m_inDetail) t << "" << endl; + m_inDetail = FALSE; + while (m_inLevel != -1) + { + t << "" << endl; + m_inLevel--; + } + if (m_inGroup) t << "" << endl; + m_inGroup = FALSE; + + QCString fileType="section"; + QCString fileName= m_codeGen.sourceFileName(); + if (fileName == "index.xml") + { + fileType="book"; + } + else if (fileName == "mainpage.xml") + { + fileType="chapter"; + } + t << "" << endl; + endPlainFile(); + m_codeGen.setSourceFileName(""); +} + +void DocbookGenerator::startIndexSection(IndexSections is) +{ +DB_GEN_C2("IndexSections " << is) + switch (is) + { + case isTitlePageStart: + { + QCString dbk_projectName = Config_getString(PROJECT_NAME); + t << " " << endl; + t << " " << convertToDocBook(dbk_projectName) << "" << endl; + t << " " << endl; + } + break; + case isTitlePageAuthor: + break; + case isMainPage: + t << "" << endl; + t << " "; + break; + case isModuleIndex: + //Module Index}\n" + break; + case isDirIndex: + //Directory Index}\n" + break; + case isNamespaceIndex: + //Namespace Index}\n" + break; + case isClassHierarchyIndex: + //Hierarchical Index}\n" + break; + case isCompoundIndex: + //t << "{"; //Class Index}\n" + break; + case isFileIndex: + //Annotated File Index}\n" + break; + case isPageIndex: + //Annotated Page Index}\n" + break; + case isModuleDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isDirDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isNamespaceDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isClassDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isFileDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isExampleDocumentation: + t << "<chapter>\n"; + t << " <title>"; + break; + case isPageDocumentation: + break; + case isPageDocumentation2: + break; + case isEndIndex: + break; + } +} + +void DocbookGenerator::endIndexSection(IndexSections is) +{ +DB_GEN_C2("IndexSections " << is) + static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); + switch (is) + { + case isTitlePageStart: + break; + case isTitlePageAuthor: + break; + case isMainPage: + t << "" << endl; + t << " " << endl; + t << "" << endl; + break; + case isModuleIndex: + //t << "
" << endl; + break; + case isDirIndex: + //t << ""; + //t << "" << endl; + break; + case isNamespaceIndex: + //t << ""; + //t << "" << endl; + break; + case isClassHierarchyIndex: + //t << ""; + //t << "" << endl; + break; + case isCompoundIndex: + //t << "" << endl; + break; + case isFileIndex: + //t << ""; + //t << "" << endl; + break; + case isPageIndex: + //t << ""; + //t << "" << endl; + break; + case isModuleDocumentation: + { + t << "" << endl; + GroupSDict::Iterator gli(*Doxygen::groupSDict); + GroupDef *gd; + bool found=FALSE; + for (gli.toFirst();(gd=gli.current()) && !found;++gli) + { + if (!gd->isReference()) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + found=TRUE; + } + } + for (;(gd=gli.current());++gli) + { + if (!gd->isReference()) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + } + } + t << "\n"; + break; + case isDirDocumentation: + { + t << "" << endl; + SDict::Iterator dli(*Doxygen::directories); + DirDef *dd; + bool found=FALSE; + for (dli.toFirst();(dd=dli.current()) && !found;++dli) + { + if (dd->isLinkableInProject()) + { + t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + found=TRUE; + } + } + for (;(dd=dli.current());++dli) + { + if (dd->isLinkableInProject()) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + } + } + t << "\n"; + break; + case isNamespaceDocumentation: + { + t << "" << endl; + NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); + NamespaceDef *nd; + bool found=FALSE; + for (nli.toFirst();(nd=nli.current()) && !found;++nli) + { + if (nd->isLinkableInProject()) + { + t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + found=TRUE; + } + } + while ((nd=nli.current())) + { + if (nd->isLinkableInProject()) + { + t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + ++nli; + } + } + t << "\n"; + break; + case isClassDocumentation: + { + t << "" << endl; + ClassSDict::Iterator cli(*Doxygen::classSDict); + ClassDef *cd=0; + bool found=FALSE; + for (cli.toFirst();(cd=cli.current()) && !found;++cli) + { + if (cd->isLinkableInProject() && + cd->templateMaster()==0 && + !cd->isEmbeddedInOuterScope() + ) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + found=TRUE; + } + } + for (;(cd=cli.current());++cli) + { + if (cd->isLinkableInProject() && + cd->templateMaster()==0 && + !cd->isEmbeddedInOuterScope() + ) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + } + } + t << "\n"; + break; + case isFileDocumentation: + { + t << "" << endl; + bool isFirst=TRUE; + FileNameListIterator fnli(*Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) + { + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) + { + if (fd->isLinkableInProject()) + { + if (isFirst) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) + { + t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + isFirst=FALSE; + } + else + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) + { + t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + } + } + } + } + } + t << "\n"; + break; + case isExampleDocumentation: + { + t << "" << endl; + PageSDict::Iterator pdi(*Doxygen::exampleSDict); + PageDef *pd=pdi.toFirst(); + if (pd) + { + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + for (++pdi;(pd=pdi.current());++pdi) + { + fprintf(stderr,"==> Done calling from HTML\n"); + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + } + } + t << "\n"; + break; + case isPageDocumentation: + break; + case isPageDocumentation2: + break; + case isEndIndex: + t << "" << endl; + break; + } +} +void DocbookGenerator::writePageLink(const char *name, bool /*first*/) +{ +DB_GEN_C + PageSDict::Iterator pdi(*Doxygen::pageSDict); + PageDef *pd = pdi.toFirst(); + for (pd = pdi.toFirst();(pd=pdi.current());++pdi) + { + if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name)) + { + t << "\n"; + if (!pd->title().isEmpty()) + { + t << " " << convertToDocBook(pd->title()) << "" << endl; + } + else + { + t << " " << convertToDocBook(pd->name()) << "" << endl; + } + t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; + t << "\n"; + } + } +} +void DocbookGenerator::writeDoc(DocNode *n,Definition *ctx,MemberDef *) +{ +DB_GEN_C + DocbookDocVisitor *visitor = + new DocbookDocVisitor(t,*this); + n->accept(visitor); + delete visitor; +} + +void DocbookGenerator::startParagraph(const char *) +{ +DB_GEN_C + t << "" << endl; +} + +void DocbookGenerator::endParagraph() +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::writeString(const char *text) +{ +DB_GEN_C + t << text; +} +void DocbookGenerator::startMemberHeader(const char *name,int) +{ +DB_GEN_C + t << "" << endl; + m_inSimpleSect[m_levelListItem] = TRUE; + t << " "; +} + +void DocbookGenerator::endMemberHeader() +{ +DB_GEN_C + t << " " << endl; +} +void DocbookGenerator::docify(const char *str) +{ +DB_GEN_C + t << convertToDocBook(str); +} +void DocbookGenerator::writeObjectLink(const char *ref, const char *f, + const char *anchor, const char *text) +{ +DB_GEN_C + if (anchor) + if (f) t << ""; + else t << ""; + else + t << ""; + docify(text); + t << ""; +} +void DocbookGenerator::startMemberList() +{ +DB_GEN_C + t << " " << endl; + m_levelListItem++; +} +void DocbookGenerator::endMemberList() +{ +DB_GEN_C + if (m_inListItem[m_levelListItem]) t << "" << endl; + m_inListItem[m_levelListItem] = FALSE; + t << " " << endl; + m_levelListItem = (m_levelListItem> 0 ? m_levelListItem - 1 : 0); + if (m_inSimpleSect[m_levelListItem]) t << "" << endl; + m_inSimpleSect[m_levelListItem] = FALSE; +} +void DocbookGenerator::startMemberItem(const char *,int,const char *) +{ +DB_GEN_C + if (m_inListItem[m_levelListItem]) t << "" << endl; + t << " "; + m_inListItem[m_levelListItem] = TRUE; +} +void DocbookGenerator::endMemberItem() +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::startBold(void) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endBold(void) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::startGroupHeader(int extraIndentLevel) +{ +DB_GEN_C2("m_inLevel " << m_inLevel) +DB_GEN_C2("extraIndentLevel " << extraIndentLevel) + m_firstMember = TRUE; + if (m_inSimpleSect[m_levelListItem]) t << "" << endl; + m_inSimpleSect[m_levelListItem] = FALSE; + if (m_inLevel != -1) m_inGroup = TRUE; + if (m_inLevel == extraIndentLevel) t << "" << endl; + m_inLevel = extraIndentLevel; + t << "
" << endl; + t << ""; +} +void DocbookGenerator::writeRuler(void) +{ +DB_GEN_C2("m_inLevel " << m_inLevel) +DB_GEN_C2("m_inGroup " << m_inGroup) + if (m_inGroup) t << "</section>" << endl; + m_inGroup = FALSE; +} + +void DocbookGenerator::endGroupHeader(int) +{ +DB_GEN_C + t << "" << endl; +} + +void DocbookGenerator::startParameterList(bool openBracket) +{ +DB_GEN_C + if (openBracket) t << "("; +} +void DocbookGenerator::endParameterList() +{ +DB_GEN_C +} +void DocbookGenerator::writeNonBreakableSpace(int n) +{ +DB_GEN_C + for (int i=0;i"; +} +void DocbookGenerator::endTypewriter() +{ +DB_GEN_C + if (!m_denseText) t << "" << endl; +} +void DocbookGenerator::startTextBlock(bool dense) +{ +DB_GEN_C + if (dense) + { + m_denseText = TRUE; + t << ""; + } +} +void DocbookGenerator::endTextBlock(bool dense) +{ +DB_GEN_C + if (m_denseText) + { + m_denseText = FALSE; + t << ""; + } +} +void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *anchor, const char *title, + int memCount, int memTotal, bool showInline) +{ +DB_GEN_C2("m_inLevel " << m_inLevel) + t << "
" << endl; + t << " " << convertToDocBook(title); + if (memTotal>1) + { + t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>"; + } + t << "" << endl; + if (memname && memname[0]!='@') + { + addIndexTerm(t,memname,clname); + addIndexTerm(t,clname,memname); + } +} +void DocbookGenerator::endMemberDoc(bool) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::startTitleHead(const char *) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endTitleHead(const char *fileName,const char *name) +{ +DB_GEN_C + t << "" << endl; + if (name) addIndexTerm(t, name); +} +void DocbookGenerator::startDoxyAnchor(const char *fName,const char *manName, + const char *anchor,const char *name, + const char *args) +{ +DB_GEN_C + if (!m_inListItem[m_levelListItem] && !m_descTable) + { + if (!m_firstMember) t << "
"; + m_firstMember = FALSE; + } + if (anchor) + { + t << ""; + } +} +void DocbookGenerator::endDoxyAnchor(const char *fileName,const char *anchor) +{ +DB_GEN_C +} +void DocbookGenerator::startMemberDocName(bool) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endMemberDocName() +{ +DB_GEN_C +} +void DocbookGenerator::startMemberGroupHeader(bool hasHeader) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endMemberGroupHeader() +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::startMemberGroup() +{ +DB_GEN_C +} +void DocbookGenerator::endMemberGroup(bool) +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::startClassDiagram() +{ +DB_GEN_C + t << ""; +} + +void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *) +{ +DB_GEN_C + visitPreStart(t, FALSE, relPath + fileName + ".png", NULL, NULL); + d.writeImage(t,dir,relPath,fileName,FALSE); + visitPostEnd(t, FALSE); + t << "" << endl; +} +void DocbookGenerator::startLabels() +{ +DB_GEN_C +} + +void DocbookGenerator::writeLabel(const char *l,bool isLast) +{ +DB_GEN_C + t << "[" << l << "]"; + if (!isLast) t << ", "; +} + +void DocbookGenerator::endLabels() +{ +DB_GEN_C +} +void DocbookGenerator::startExamples() +{ +DB_GEN_C + t << ""; + docify(theTranslator->trExamples()); + t << ""; +} + +void DocbookGenerator::endExamples() +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::startSubsubsection(void) +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endSubsubsection(void) +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::writeChar(char c) +{ +DB_GEN_C + char cs[2]; + cs[0]=c; + cs[1]=0; + docify(cs); +} +void DocbookGenerator::startMemberDocPrefixItem() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endMemberDocPrefixItem() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::exceptionEntry(const char* prefix,bool closeBracket) +{ +DB_GEN_C + if (prefix) + t << " " << prefix << "("; + else if (closeBracket) + t << ")"; + t << " "; +} +void DocbookGenerator::startParameterName(bool) +{ +DB_GEN_C + t << " "; +} +void DocbookGenerator::endParameterName(bool last,bool /*emptyList*/,bool closeBracket) +{ +DB_GEN_C + if (last) + { + if (closeBracket) t << ")"; + } +} +void DocbookGenerator::startCodeFragment() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endCodeFragment() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::startMemberTemplateParams() +{ +DB_GEN_C +} + +void DocbookGenerator::endMemberTemplateParams(const char *,const char *) +{ +DB_GEN_C + t << ""; + t << ""; +} +void DocbookGenerator::startSection(const char *lab,const char *,SectionInfo::SectionType type) +{ +DB_GEN_C + t << "
"; + t << ""; +} +void DocbookGenerator::endSection(const char *lab,SectionInfo::SectionType) +{ +DB_GEN_C + t << ""; + t << "
"; +} +void DocbookGenerator::addIndexItem(const char *prim,const char *sec) +{ +DB_GEN_C + addIndexTerm(t, prim, sec); +} + +void DocbookGenerator::startDescTable(const char *title) +{ +DB_GEN_C + int ncols = 2; + t << "" << endl; + if (title)t << "" << convertToDocBook(title) << "" << endl; + t << " " << endl; + for (int i = 0; i < ncols; i++) + { + t << " \n"; + } + t << "\n"; + m_descTable = TRUE; +} + +void DocbookGenerator::endDescTable() +{ +DB_GEN_C + t << " " << endl; + t << " " << endl; + t << "" << endl; + m_descTable = FALSE; +} + +void DocbookGenerator::startDescTableRow() +{ +DB_GEN_C + t << ""; + t << ""; +} + +void DocbookGenerator::endDescTableRow() +{ +DB_GEN_C + t << ""; +} + +void DocbookGenerator::startDescTableTitle() +{ +DB_GEN_C +} + +void DocbookGenerator::endDescTableTitle() +{ +DB_GEN_C +} + +void DocbookGenerator::startDescTableData() +{ +DB_GEN_C + t << ""; +} + +void DocbookGenerator::endDescTableData() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::startGroupCollaboration() +{ +DB_GEN_C +} +void DocbookGenerator::endGroupCollaboration(const DotGroupCollaboration &g) +{ +DB_GEN_C + g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); +} +void DocbookGenerator::startDotGraph() +{ +DB_GEN_C +} +void DocbookGenerator::endDotGraph(const DotClassGraph &g) +{ +DB_GEN_C + g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE); +} +void DocbookGenerator::startInclDepGraph() +{ +DB_GEN_C +} +void DocbookGenerator::endInclDepGraph(const DotInclDepGraph &g) +{ +DB_GEN_C + QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE); +} +void DocbookGenerator::startCallGraph() +{ +DB_GEN_C +} +void DocbookGenerator::endCallGraph(const DotCallGraph &g) +{ +DB_GEN_C + QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE); +} +void DocbookGenerator::startDirDepGraph() +{ +DB_GEN_C +} +void DocbookGenerator::endDirDepGraph(const DotDirDeps &g) +{ +DB_GEN_C + QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT), fileName,relPath,FALSE); +} +void DocbookGenerator::startMemberDocList() +{ +DB_GEN_C +} +void DocbookGenerator::endMemberDocList() +{ +DB_GEN_C + m_inGroup = TRUE; +} +void DocbookGenerator::startConstraintList(const char *header) +{ +DB_GEN_C + t << ""; + docify(header); + t << "" << endl; +} +void DocbookGenerator::startConstraintParam() +{ +DB_GEN_C + t << ""; +} +void DocbookGenerator::endConstraintParam() +{ +DB_GEN_C +} +void DocbookGenerator::startConstraintType() +{ +DB_GEN_C + t << ":"; +} +void DocbookGenerator::endConstraintType() +{ +DB_GEN_C + t << "" << endl; +} +void DocbookGenerator::startConstraintDocs() +{ +DB_GEN_C +} +void DocbookGenerator::endConstraintDocs() +{ +DB_GEN_C +} +void DocbookGenerator::endConstraintList() +{ +DB_GEN_C + t << "" << endl; +} diff --git a/src/docbookgen.h b/src/docbookgen.h index 866d056..3fafff1 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -15,6 +15,351 @@ #ifndef DOCBOOKGEN_H #define DOCBOOKGEN_H -void generateDocbook(); +#include "outputgen.h" + +void generateDocbook_v1(); + +class DocbookCodeGenerator : public CodeOutputInterface +{ + public: + DocbookCodeGenerator(FTextStream &t); + DocbookCodeGenerator(); + virtual ~DocbookCodeGenerator(); + void setTextStream(FTextStream &t) + { + m_streamSet = t.device()!=0; + m_t.setDevice(t.device()); + } + void setRelativePath(const QCString &path) { m_relPath = path; } + void setSourceFileName(const QCString &sourceFileName) { m_sourceFileName = sourceFileName; } + QCString sourceFileName() { return m_sourceFileName; } + + void codify(const char *text); + void writeCodeLink(const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip); + void writeCodeLinkLine(const char *ref,const char *file, + const char *anchor,const char *name, + const char *tooltip); + void writeTooltip(const char *, const DocLinkInfo &, const char *, + const char *, const SourceLinkInfo &, const SourceLinkInfo & + ); + void startCodeLine(bool); + void endCodeLine(); + void startFontClass(const char *colorClass); + void endFontClass(); + void writeCodeAnchor(const char *); + void writeLineNumber(const char *extRef,const char *compId, + const char *anchorId,int l); + void setCurrentDoc(Definition *,const char *,bool); + void addWord(const char *,bool); + void finish(); + void startCodeFragment(); + void endCodeFragment(); + + private: + FTextStream m_t; + bool m_streamSet; + QCString m_refId; + QCString m_external; + int m_lineNumber; + int m_col; + bool m_insideCodeLine; + bool m_insideSpecialHL; + QCString m_relPath; + QCString m_sourceFileName; + bool m_prettyCode; +}; + + +#if 0 +// define for cases that have been implemented with an empty body +#define DB_GEN_EMPTY t << "\n"; +#else +#define DB_GEN_EMPTY +#endif + +#if 0 +// Generic debug statements +#define DB_GEN_H DB_GEN_H1(t) +#define DB_GEN_H1(x) x << "\n"; +#define DB_GEN_H2(y) DB_GEN_H2a(t,y) +#define DB_GEN_H2a(x,y) x << "\n"; +// define for cases that have NOT yet been implemented / considered +#define DB_GEN_NEW fprintf(stderr,"DBG_GEN_head %d\n",__LINE__); DB_GEN_H +#else +#define DB_GEN_H +#define DB_GEN_H1(x) +#define DB_GEN_H2(y) +#define DB_GEN_H2a(x,y) +#define DB_GEN_NEW +#endif + +class DocbookGenerator : public OutputGenerator +{ + public: + DocbookGenerator(); + ~DocbookGenerator(); + static void init(); + + /////////////////////////////////////////////////////////////// + // generic generator methods + /////////////////////////////////////////////////////////////// + void enable() + { if (genStack->top()) active=*genStack->top(); else active=TRUE; } + void disable() { active=FALSE; } + void enableIf(OutputType o) { if (o==Docbook) enable(); } + void disableIf(OutputType o) { if (o==Docbook) disable(); } + void disableIfNot(OutputType o) { if (o!=Docbook) disable(); } + bool isEnabled(OutputType o) { return (o==Docbook && active); } + OutputGenerator *get(OutputType o) { return (o==Docbook) ? this : 0; } + + // --- CodeOutputInterface + void codify(const char *text) + { m_codeGen.codify(text); } + void writeCodeLink(const char *ref, const char *file, + const char *anchor,const char *name, + const char *tooltip) + { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); } + void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber) + { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); } + void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, + const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo + ) + { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); } + void startCodeLine(bool hasLineNumbers) + { m_codeGen.startCodeLine(hasLineNumbers); } + void endCodeLine() + { m_codeGen.endCodeLine(); } + void startFontClass(const char *s) + { m_codeGen.startFontClass(s); } + void endFontClass() + { m_codeGen.endFontClass(); } + void writeCodeAnchor(const char *anchor) + { m_codeGen.writeCodeAnchor(anchor); } + // --------------------------- + + void writeDoc(DocNode *,Definition *ctx,MemberDef *md); + + /////////////////////////////////////////////////////////////// + // structural output interface + /////////////////////////////////////////////////////////////// + void startFile(const char *name,const char *manName, + const char *title); + void writeSearchInfo(){DB_GEN_EMPTY}; + void writeFooter(const char *navPath){DB_GEN_NEW}; + void endFile(); + void startIndexSection(IndexSections); + void endIndexSection(IndexSections); + void writePageLink(const char *,bool); + void startProjectNumber(){DB_GEN_NEW}; + void endProjectNumber(){DB_GEN_NEW}; + void writeStyleInfo(int part){DB_GEN_EMPTY}; + void startTitleHead(const char *); + void endTitleHead(const char *fileName,const char *name); + void startIndexListItem(){DB_GEN_NEW}; + void endIndexListItem(){DB_GEN_NEW}; + void startIndexList(){DB_GEN_NEW}; + void endIndexList(){DB_GEN_NEW}; + void startIndexKey(){DB_GEN_NEW}; + void endIndexKey(){DB_GEN_NEW}; + void startIndexValue(bool){DB_GEN_NEW}; + void endIndexValue(const char *,bool){DB_GEN_NEW}; + void startItemList() {DB_GEN_EMPTY}; + void endItemList() {DB_GEN_EMPTY}; + + void startIndexItem(const char *ref,const char *file){DB_GEN_NEW}; + void endIndexItem(const char *ref,const char *file){DB_GEN_NEW}; + void startItemListItem() {DB_GEN_EMPTY}; + void endItemListItem() {DB_GEN_EMPTY}; + void docify(const char *text); + void writeChar(char); + void writeString(const char *); + void startParagraph(const char *); + void endParagraph(void); + void writeObjectLink(const char *,const char *,const char *,const char *); + void startHtmlLink(const char *){DB_GEN_NEW}; + void endHtmlLink(void){DB_GEN_NEW}; + void startBold(void); + void endBold(void); + void startTypewriter(void); + void endTypewriter(void); + void startEmphasis(void){DB_GEN_NEW}; + void endEmphasis(void){DB_GEN_NEW}; + void startCodeFragment(void); + void endCodeFragment(void); + void writeRuler(void); + void startDescription(void){DB_GEN_NEW}; + void endDescription(void){DB_GEN_NEW}; + void startDescItem(void){DB_GEN_NEW}; + void startDescForItem(void){DB_GEN_EMPTY}; + void endDescForItem(void){DB_GEN_EMPTY}; + void endDescItem(void){DB_GEN_NEW}; + void startCenter(void){DB_GEN_NEW}; + void endCenter(void){DB_GEN_NEW}; + void startSmall(void){DB_GEN_NEW}; + void endSmall(void){DB_GEN_NEW}; + void startExamples(void); + void endExamples(void); + void startParamList(BaseOutputDocInterface::ParamListTypes,const char *){DB_GEN_NEW}; + void endParamList(void){DB_GEN_NEW}; + void startTitle(void){DB_GEN_NEW}; + void endTitle(void){DB_GEN_NEW}; + void writeAnchor(const char *,const char *){DB_GEN_EMPTY}; + void startSection(const char *,const char *,SectionInfo::SectionType); + void endSection(const char *,SectionInfo::SectionType); + void lineBreak(const char *); + void addIndexItem(const char *,const char *); + void writeNonBreakableSpace(int); + void startDescTable(const char *); + void endDescTable(void); + void startDescTableRow(void); + void endDescTableRow(void); + void startDescTableTitle(void); + void endDescTableTitle(void); + void startDescTableData(void); + void endDescTableData(void); + void startTextLink(const char *,const char *){DB_GEN_NEW}; + void endTextLink(void){DB_GEN_NEW}; + void startPageRef(void){DB_GEN_NEW}; + void endPageRef(const char *,const char *){DB_GEN_NEW}; + void startSubsection(void){DB_GEN_NEW}; + void endSubsection(void){DB_GEN_NEW}; + void startSubsubsection(void); + void endSubsubsection(void); + + + void startGroupHeader(int); + void endGroupHeader(int); + void startMemberSections(){DB_GEN_EMPTY}; + void endMemberSections(){DB_GEN_EMPTY}; + void startHeaderSection(){DB_GEN_EMPTY}; + void endHeaderSection(){DB_GEN_EMPTY}; + void startMemberHeader(const char *anchor, int typ); + void endMemberHeader(); + void startMemberSubtitle(){DB_GEN_EMPTY}; + void endMemberSubtitle(){DB_GEN_EMPTY}; + void startMemberDocList(); + void endMemberDocList(); + void startMemberList(); + void endMemberList(); + void startInlineHeader(){DB_GEN_NEW}; + void endInlineHeader(){DB_GEN_NEW}; + void startAnonTypeScope(int){DB_GEN_EMPTY}; + void endAnonTypeScope(int){DB_GEN_EMPTY}; + void startMemberItem(const char *,int,const char *); + void endMemberItem(); + void startMemberTemplateParams(); + void endMemberTemplateParams(const char *,const char *); + void startMemberGroupHeader(bool); + void endMemberGroupHeader(); + void startMemberGroupDocs(){DB_GEN_EMPTY}; + void endMemberGroupDocs(){DB_GEN_EMPTY}; + void startMemberGroup(); + void endMemberGroup(bool); + void insertMemberAlign(bool){DB_GEN_EMPTY}; + void insertMemberAlignLeft(int,bool){DB_GEN_EMPTY}; + void startMemberDoc(const char *,const char *, + const char *,const char *,int,int,bool); + void endMemberDoc(bool); + void startDoxyAnchor(const char *fName,const char *manName, + const char *anchor,const char *name, + const char *args); + void endDoxyAnchor(const char *fileName,const char *anchor); + void writeLatexSpacing(){DB_GEN_EMPTY} + void writeStartAnnoItem(const char *type,const char *file, + const char *path,const char *name){DB_GEN_NEW}; + void writeEndAnnoItem(const char *name){DB_GEN_NEW}; + void startMemberDescription(const char *anchor,const char *inheritId, bool typ){DB_GEN_EMPTY}; + void endMemberDescription(){DB_GEN_EMPTY}; + void startMemberDeclaration(){DB_GEN_EMPTY}; + void endMemberDeclaration(const char *anchor,const char *inheritId){DB_GEN_EMPTY}; + void writeInheritedSectionTitle(const char *id,const char *ref, + const char *file,const char *anchor, + const char *title,const char *name){DB_GEN_NEW}; + void startIndent(){DB_GEN_EMPTY}; + void endIndent(){DB_GEN_EMPTY}; + void writeSynopsis(){DB_GEN_EMPTY}; + void startClassDiagram(); + void endClassDiagram(const ClassDiagram &,const char *,const char *); + void startDotGraph(); + void endDotGraph(const DotClassGraph &g); + void startInclDepGraph(); + void endInclDepGraph(const DotInclDepGraph &g); + void startGroupCollaboration(); + void endGroupCollaboration(const DotGroupCollaboration &g); + void startCallGraph(); + void endCallGraph(const DotCallGraph &g); + void startDirDepGraph(); + void endDirDepGraph(const DotDirDeps &g); + void writeGraphicalHierarchy(const DotGfxHierarchyTable &g){DB_GEN_NEW}; + void startQuickIndices(){DB_GEN_EMPTY}; + void endQuickIndices(){DB_GEN_EMPTY}; + void writeSplitBar(const char *){DB_GEN_EMPTY}; + void writeNavigationPath(const char *){DB_GEN_NEW}; + void writeLogo(){DB_GEN_NEW}; + void writeQuickLinks(bool compact,HighlightedItem hli,const char *file){DB_GEN_EMPTY}; + void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first){DB_GEN_EMPTY}; + void startContents(){DB_GEN_EMPTY}; + void endContents(){DB_GEN_EMPTY}; + void startPageDoc(const char *pageTitle){DB_GEN_EMPTY} + void endPageDoc() {DB_GEN_EMPTY} + void startTextBlock(bool); + void endTextBlock(bool); + void lastIndexPage(){DB_GEN_EMPTY}; + void startMemberDocPrefixItem(); + void endMemberDocPrefixItem(); + void startMemberDocName(bool); + void endMemberDocName(); + void startParameterType(bool,const char *key){DB_GEN_EMPTY}; + void endParameterType(){DB_GEN_EMPTY}; + void startParameterName(bool); + void endParameterName(bool,bool,bool); + void startParameterList(bool); + void endParameterList(); + void exceptionEntry(const char*,bool); + + void startConstraintList(const char *); + void startConstraintParam(); + void endConstraintParam(); + void startConstraintType(); + void endConstraintType(); + void startConstraintDocs(); + void endConstraintDocs(); + void endConstraintList(); + + void startMemberDocSimple(bool){DB_GEN_NEW}; + void endMemberDocSimple(bool){DB_GEN_NEW}; + void startInlineMemberType(){DB_GEN_NEW}; + void endInlineMemberType(){DB_GEN_NEW}; + void startInlineMemberName(){DB_GEN_NEW}; + void endInlineMemberName(){DB_GEN_NEW}; + void startInlineMemberDoc(){DB_GEN_NEW}; + void endInlineMemberDoc(){DB_GEN_NEW}; + + void startLabels(); + void writeLabel(const char *,bool); + void endLabels(); + + void setCurrentDoc(Definition *,const char *,bool) {DB_GEN_EMPTY} + void addWord(const char *,bool) {DB_GEN_EMPTY} + +private: + DocbookGenerator(const DocbookGenerator &o); + DocbookGenerator &operator=(const DocbookGenerator &o); + + QCString relPath; + DocbookCodeGenerator m_codeGen; + bool m_prettyCode = FALSE; + bool m_denseText = FALSE; + bool m_inGroup = FALSE; + bool m_inDetail = FALSE; + int m_levelListItem = 0; + bool m_inListItem[20]; + bool m_inSimpleSect[20]; + bool m_descTable = FALSE; + int m_inLevel = -1; + bool m_firstMember = FALSE; +}; #endif diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index b83317c..da84931 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -36,17 +36,34 @@ #include "htmlentity.h" #include "plantuml.h" -static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height) +#if 0 +#define DB_VIS_C DB_VIS_C1(m_t) +#define DB_VIS_C1(x) x << "\n"; +#define DB_VIS_C2(y) DB_VIS_C2a(m_t,y) +#define DB_VIS_C2a(x,y) x << "\n"; +#else +#define DB_VIS_C +#define DB_VIS_C1(x) +#define DB_VIS_C2(y) +#define DB_VIS_C2a(x,y) +#endif +void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height) { QCString tmpStr; - t << "
" << endl; - t << " " << endl; + if (hasCaption) + { + t << "
" << endl; + } + else + { + t << " " << endl; + } t << " " << endl; t << " " << endl; t << " "; + t << " align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << name << "\">"; t << "" << endl; t << " " << endl; if (hasCaption) { - t << " " << endl; + t << " " << endl; } } -static void visitPostEnd(FTextStream &t, const bool hasCaption) +void visitPostEnd(FTextStream &t, const bool hasCaption) { t << endl; if (hasCaption) { - t << " </caption>" << endl; + t << " " << endl; } t << " " << endl; - t << "
" << endl; + if (hasCaption) + { + t << "
" << endl; + } + else + { + t << " " << endl; + } } static void visitCaption(DocbookDocVisitor *parent, QList children) @@ -86,6 +110,13 @@ static void visitCaption(DocbookDocVisitor *parent, QList children) DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) { +DB_VIS_C + // m_t << "
" << endl; +} +DocbookDocVisitor::~DocbookDocVisitor() +{ +DB_VIS_C + // m_t << "
" << endl; } //-------------------------------------- @@ -94,12 +125,14 @@ DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) void DocbookDocVisitor::visit(DocWord *w) { +DB_VIS_C if (m_hide) return; filter(w->word()); } void DocbookDocVisitor::visit(DocLinkedWord *w) { +DB_VIS_C if (m_hide) return; startLink(w->file(),w->anchor()); filter(w->word()); @@ -108,6 +141,7 @@ void DocbookDocVisitor::visit(DocLinkedWord *w) void DocbookDocVisitor::visit(DocWhiteSpace *w) { +DB_VIS_C if (m_hide) return; if (m_insidePre) { @@ -121,6 +155,7 @@ void DocbookDocVisitor::visit(DocWhiteSpace *w) void DocbookDocVisitor::visit(DocSymbol *s) { +DB_VIS_C if (m_hide) return; const char *res = HtmlEntityMapper::instance()->docbook(s->symbol()); if (res) @@ -135,6 +170,7 @@ void DocbookDocVisitor::visit(DocSymbol *s) void DocbookDocVisitor::visit(DocURL *u) { +DB_VIS_C if (m_hide) return; m_t << "isEmail()) m_t << "mailto:"; @@ -146,12 +182,16 @@ void DocbookDocVisitor::visit(DocURL *u) void DocbookDocVisitor::visit(DocLineBreak *) { +DB_VIS_C if (m_hide) return; - m_t << endl << "\n" << endl; + m_t << endl << "  " << endl; + // gives nicer results but gives problems as it is not allowed in and also problems with dblatex + // m_t << endl << "" << endl; } void DocbookDocVisitor::visit(DocHorRuler *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; m_t << "\n"; @@ -159,6 +199,7 @@ void DocbookDocVisitor::visit(DocHorRuler *) void DocbookDocVisitor::visit(DocStyleChange *s) { +DB_VIS_C if (m_hide) return; switch (s->style()) { @@ -205,6 +246,7 @@ void DocbookDocVisitor::visit(DocStyleChange *s) void DocbookDocVisitor::visit(DocVerbatim *s) { +DB_VIS_C if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(m_langExt); switch(s->type()) @@ -217,9 +259,9 @@ void DocbookDocVisitor::visit(DocVerbatim *s) m_t << ""; break; case DocVerbatim::Verbatim: - m_t << ""; + m_t << ""; filter(s->text()); - m_t << ""; + m_t << ""; break; case DocVerbatim::HtmlOnly: break; @@ -232,7 +274,6 @@ void DocbookDocVisitor::visit(DocVerbatim *s) case DocVerbatim::XmlOnly: break; case DocVerbatim::DocbookOnly: - break; m_t << s->text(); break; case DocVerbatim::Dot: @@ -304,12 +345,14 @@ void DocbookDocVisitor::visit(DocVerbatim *s) void DocbookDocVisitor::visit(DocAnchor *anc) { +DB_VIS_C if (m_hide) return; - m_t << "file() << "_1" << anc->anchor() << "\"/>"; + m_t << "file()) << "_1" << anc->anchor() << "\"/>"; } void DocbookDocVisitor::visit(DocInclude *inc) { +DB_VIS_C if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(inc->extension()); switch(inc->type()) @@ -345,9 +388,9 @@ void DocbookDocVisitor::visit(DocInclude *inc) case DocInclude::LatexInclude: break; case DocInclude::VerbInclude: - m_t << ""; + m_t << ""; filter(inc->text()); - m_t << ""; + m_t << ""; break; case DocInclude::Snippet: m_t << ""; @@ -393,6 +436,7 @@ void DocbookDocVisitor::visit(DocInclude *inc) void DocbookDocVisitor::visit(DocIncOperator *op) { +DB_VIS_C if (op->isFirst()) { if (!m_hide) @@ -429,27 +473,37 @@ void DocbookDocVisitor::visit(DocIncOperator *op) void DocbookDocVisitor::visit(DocFormula *f) { +DB_VIS_C if (m_hide) return; - m_t << "" << f->name() << ""; - filter(f->text()); - m_t << ""; + + if (f->isInline()) m_t << "" << endl; + else m_t << " " << endl; + m_t << " " << endl; + m_t << " relPath() << f->name() << ".png\"/>" << endl; + m_t << " " << endl; + if (f->isInline()) m_t << "" << endl; + else m_t << " " << endl; } void DocbookDocVisitor::visit(DocIndexEntry *ie) { +DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << ""; filter(ie->entry()); - m_t << "" << endl; + m_t << "" << endl; } void DocbookDocVisitor::visit(DocSimpleSectSep *) { - m_t << ""; +DB_VIS_C + // m_t << ""; } void DocbookDocVisitor::visit(DocCite *cite) { +DB_VIS_C if (m_hide) return; if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor()); filter(cite->text()); @@ -462,6 +516,7 @@ void DocbookDocVisitor::visit(DocCite *cite) void DocbookDocVisitor::visitPre(DocAutoList *l) { +DB_VIS_C if (m_hide) return; if (l->isEnumList()) { @@ -475,6 +530,7 @@ void DocbookDocVisitor::visitPre(DocAutoList *l) void DocbookDocVisitor::visitPost(DocAutoList *l) { +DB_VIS_C if (m_hide) return; if (l->isEnumList()) { @@ -488,18 +544,21 @@ void DocbookDocVisitor::visitPost(DocAutoList *l) void DocbookDocVisitor::visitPre(DocAutoListItem *) { +DB_VIS_C if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocAutoListItem *) { +DB_VIS_C if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocPara *) { +DB_VIS_C if (m_hide) return; m_t << endl; m_t << ""; @@ -507,6 +566,7 @@ void DocbookDocVisitor::visitPre(DocPara *) void DocbookDocVisitor::visitPost(DocPara *) { +DB_VIS_C if (m_hide) return; m_t << ""; m_t << endl; @@ -514,16 +574,19 @@ void DocbookDocVisitor::visitPost(DocPara *) void DocbookDocVisitor::visitPre(DocRoot *) { +DB_VIS_C //m_t << "

New parser:

\n"; } void DocbookDocVisitor::visitPost(DocRoot *) { +DB_VIS_C //m_t << "

Old parser:

\n"; } void DocbookDocVisitor::visitPre(DocSimpleSect *s) { +DB_VIS_C if (m_hide) return; switch(s->type()) { @@ -534,7 +597,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trSeeAlso()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trSeeAlso()) << ": " << endl; } break; case DocSimpleSect::Return: @@ -544,7 +607,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trReturns()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trReturns()) << ": " << endl; } break; case DocSimpleSect::Author: @@ -554,7 +617,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trAuthor(TRUE, TRUE)) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << ": " << endl; } break; case DocSimpleSect::Authors: @@ -564,7 +627,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trAuthor(TRUE, FALSE)) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << ": " << endl; } break; case DocSimpleSect::Version: @@ -574,7 +637,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trVersion()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trVersion()) << ": " << endl; } break; case DocSimpleSect::Since: @@ -584,7 +647,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trSince()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trSince()) << ": " << endl; } break; case DocSimpleSect::Date: @@ -594,27 +657,27 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trDate()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trDate()) << ": " << endl; } break; case DocSimpleSect::Note: if (m_insidePre) { - m_t << "" << theTranslator->trNote() << ": " << endl; + m_t << "" << theTranslator->trNote() << ": " << endl; } else { - m_t << "" << convertToXML(theTranslator->trNote()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trNote()) << ": " << endl; } break; case DocSimpleSect::Warning: if (m_insidePre) { - m_t << "" << theTranslator->trWarning() << ": " << endl; + m_t << "" << theTranslator->trWarning() << ": " << endl; } else { - m_t << "" << convertToXML(theTranslator->trWarning()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trWarning()) << ": " << endl; } break; case DocSimpleSect::Pre: @@ -624,7 +687,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trPrecondition()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trPrecondition()) << ": " << endl; } break; case DocSimpleSect::Post: @@ -634,7 +697,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trPostcondition()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trPostcondition()) << ": " << endl; } break; case DocSimpleSect::Copyright: @@ -644,7 +707,7 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trCopyright()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trCopyright()) << ": " << endl; } break; case DocSimpleSect::Invar: @@ -654,85 +717,121 @@ void DocbookDocVisitor::visitPre(DocSimpleSect *s) } else { - m_t << "" << convertToXML(theTranslator->trInvariant()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trInvariant()) << ": " << endl; } break; case DocSimpleSect::Remark: + // is miising the possibility if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trRemarks() << ": " << endl; } else { - m_t << "" << convertToXML(theTranslator->trRemarks()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trRemarks()) << ": " << endl; } break; case DocSimpleSect::Attention: if (m_insidePre) { - m_t << "" << theTranslator->trAttention() << ": " << endl; + m_t << "" << theTranslator->trAttention() << ": " << endl; } else { - m_t << "" << convertToXML(theTranslator->trAttention()) << ": " << endl; + m_t << "" << convertToDocBook(theTranslator->trAttention()) << ": " << endl; } break; case DocSimpleSect::User: - m_t << "" << endl; + if (s->hasTitle()) + m_t << "" << endl; + else + m_t << "" << endl; break; case DocSimpleSect::Rcs: - m_t << "" << endl; + case DocSimpleSect::Unknown: + m_t << "" << endl; break; - case DocSimpleSect::Unknown: m_t << "" << endl; break; } } -void DocbookDocVisitor::visitPost(DocSimpleSect *) +void DocbookDocVisitor::visitPost(DocSimpleSect *s) { +DB_VIS_C if (m_hide) return; - m_t << "" << endl; + switch(s->type()) + { + case DocSimpleSect::Rcs: + case DocSimpleSect::Unknown: + m_t << "" << endl; + break; + case DocSimpleSect::User: + if (s->hasTitle()) + m_t << "" << endl; + else + m_t << "" << endl; + break; + case DocSimpleSect::Note: + m_t << "" << endl; + break; + case DocSimpleSect::Attention: + m_t << "" << endl; + break; + case DocSimpleSect::Warning: + m_t << "" << endl; + break; + default: + m_t << "" << endl; + break; + } } -void DocbookDocVisitor::visitPre(DocTitle *) +void DocbookDocVisitor::visitPre(DocTitle *t) { +DB_VIS_C if (m_hide) return; - m_t << ""; + if (t->hasTitle()) m_t << "<title>"; } -void DocbookDocVisitor::visitPost(DocTitle *) +void DocbookDocVisitor::visitPost(DocTitle *t) { +DB_VIS_C if (m_hide) return; - m_t << ""; + if (t->hasTitle()) m_t << ""; } void DocbookDocVisitor::visitPre(DocSimpleList *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPost(DocSimpleList *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocSimpleListItem *) { +DB_VIS_C if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocSimpleListItem *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocSection *s) { +DB_VIS_C if (m_hide) return; - m_t << "
file(); + m_t << "
file()); if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor(); m_t << "\">" << endl; m_t << ""; @@ -742,11 +841,13 @@ void DocbookDocVisitor::visitPre(DocSection *s) void DocbookDocVisitor::visitPost(DocSection *) { +DB_VIS_C m_t << "</section>\n"; } void DocbookDocVisitor::visitPre(DocHtmlList *s) { +DB_VIS_C if (m_hide) return; if (s->type()==DocHtmlList::Ordered) m_t << "<orderedlist>\n"; @@ -756,6 +857,7 @@ void DocbookDocVisitor::visitPre(DocHtmlList *s) void DocbookDocVisitor::visitPost(DocHtmlList *s) { +DB_VIS_C if (m_hide) return; if (s->type()==DocHtmlList::Ordered) m_t << "</orderedlist>\n"; @@ -765,143 +867,276 @@ void DocbookDocVisitor::visitPost(DocHtmlList *s) void DocbookDocVisitor::visitPre(DocHtmlListItem *) { +DB_VIS_C if (m_hide) return; m_t << "<listitem>\n"; } void DocbookDocVisitor::visitPost(DocHtmlListItem *) { +DB_VIS_C if (m_hide) return; m_t << "</listitem>\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescList *) { +DB_VIS_C if (m_hide) return; m_t << "<variablelist>\n"; } void DocbookDocVisitor::visitPost(DocHtmlDescList *) { +DB_VIS_C if (m_hide) return; m_t << "</variablelist>\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescTitle *) { +DB_VIS_C if (m_hide) return; m_t << "<varlistentry><term>"; } void DocbookDocVisitor::visitPost(DocHtmlDescTitle *) { +DB_VIS_C if (m_hide) return; m_t << "</term>\n"; } void DocbookDocVisitor::visitPre(DocHtmlDescData *) { +DB_VIS_C if (m_hide) return; m_t << "<listitem>"; } void DocbookDocVisitor::visitPost(DocHtmlDescData *) { +DB_VIS_C if (m_hide) return; m_t << "</listitem></varlistentry>\n"; } +static int colCnt = 0; +static bool bodySet = FALSE; // it is possible to have tables without a header void DocbookDocVisitor::visitPre(DocHtmlTable *t) { +DB_VIS_C + bodySet = FALSE; if (m_hide) return; - m_t << "<table frame=\"all\">" << endl; - m_t << " <title>" << endl; + m_t << "" << endl; m_t << " numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl; - m_t << " " << endl; + for (int i = 0; i numColumns(); i++) + { + // do something with colwidth based of cell width specification (be aware of possible colspan in the header)? + m_t << " \n"; + } } void DocbookDocVisitor::visitPost(DocHtmlTable *) { +DB_VIS_C if (m_hide) return; m_t << " " << endl; m_t << " " << endl; - m_t << "" << endl; + m_t << "" << endl; } -void DocbookDocVisitor::visitPre(DocHtmlRow *) +void DocbookDocVisitor::visitPre(DocHtmlRow *tr) { +DB_VIS_C + colCnt = 0; if (m_hide) return; - m_t << "\n"; + + if (tr->isHeading()) m_t << "\n"; + else if (!bodySet) + { + bodySet = TRUE; + m_t << "\n"; + } + + m_t << " attribs()); + HtmlAttrib *opt; + for (li.toFirst();(opt=li.current());++li) + { + if (opt->name=="class") + { + // just skip it + } + else if (opt->name=="style") + { + // just skip it + } + else if (opt->name=="height") + { + // just skip it + } + else if (opt->name=="filter") + { + // just skip it + } + else + { + m_t << " " << opt->name << "='" << opt->value << "'"; + } + } + m_t << ">\n"; } -void DocbookDocVisitor::visitPost(DocHtmlRow *) +void DocbookDocVisitor::visitPost(DocHtmlRow *tr) { +DB_VIS_C if (m_hide) return; m_t << "\n"; + if (tr->isHeading()) + { + bodySet = TRUE; + m_t << "\n"; + } } -void DocbookDocVisitor::visitPre(DocHtmlCell *) +void DocbookDocVisitor::visitPre(DocHtmlCell *c) { +DB_VIS_C + colCnt++; if (m_hide) return; - m_t << ""; + m_t << "attribs()); + HtmlAttrib *opt; + for (li.toFirst();(opt=li.current());++li) + { + if (opt->name=="colspan") + { + m_t << " namest='c" << colCnt << "'"; + int cols = opt->value.toInt(); + colCnt += (cols - 1); + m_t << " nameend='c" << colCnt << "'"; + } + else if (opt->name=="rowspan") + { + int extraRows = opt->value.toInt() - 1; + m_t << " morerows='" << extraRows << "'"; + } + else if (opt->name=="class") + { + if (opt->value == "markdownTableBodyRight") + { + m_t << " align='right'"; + } + else if (opt->value == "markdownTableBodyLeftt") + { + m_t << " align='left'"; + } + else if (opt->value == "markdownTableBodyCenter") + { + m_t << " align='center'"; + } + else if (opt->value == "markdownTableHeadRight") + { + m_t << " align='right'"; + } + else if (opt->value == "markdownTableHeadLeftt") + { + m_t << " align='left'"; + } + else if (opt->value == "markdownTableHeadCenter") + { + m_t << " align='center'"; + } + } + else if (opt->name=="style") + { + // just skip it + } + else if (opt->name=="width") + { + // just skip it + } + else if (opt->name=="height") + { + // just skip it + } + else + { + m_t << " " << opt->name << "='" << opt->value << "'"; + } + } + m_t << ">"; } -void DocbookDocVisitor::visitPost(DocHtmlCell *) +void DocbookDocVisitor::visitPost(DocHtmlCell *c) { +DB_VIS_C if (m_hide) return; m_t << ""; } -void DocbookDocVisitor::visitPre(DocHtmlCaption *) +void DocbookDocVisitor::visitPre(DocHtmlCaption *c) { +DB_VIS_C if (m_hide) return; - m_t << ""; + m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlCaption *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocInternal *) { +DB_VIS_C if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocInternal *) { +DB_VIS_C if (m_hide) return; // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocHRef *href) { +DB_VIS_C if (m_hide) return; - m_t << "url() << "\">"; + m_t << "url()) << "\">"; } void DocbookDocVisitor::visitPost(DocHRef *) { +DB_VIS_C if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPre(DocHtmlHeader *) { +DB_VIS_C if (m_hide) return; m_t << ""; } void DocbookDocVisitor::visitPost(DocHtmlHeader *) { +DB_VIS_C if (m_hide) return; m_t << "\n"; } void DocbookDocVisitor::visitPre(DocImage *img) { +DB_VIS_C if (img->type()==DocImage::DocBook) { if (m_hide) return; @@ -912,7 +1147,7 @@ void DocbookDocVisitor::visitPre(DocImage *img) { baseName=baseName.right(baseName.length()-i-1); } - visitPreStart(m_t, img -> hasCaption(), baseName, img -> width(), img -> height()); + visitPreStart(m_t, img -> hasCaption(), img->relPath() + baseName, img -> width(), img -> height()); } else { @@ -923,6 +1158,7 @@ void DocbookDocVisitor::visitPre(DocImage *img) void DocbookDocVisitor::visitPost(DocImage *img) { +DB_VIS_C if (img->type()==DocImage::DocBook) { if (m_hide) return; @@ -963,96 +1199,118 @@ void DocbookDocVisitor::visitPost(DocImage *img) void DocbookDocVisitor::visitPre(DocDotFile *df) { +DB_VIS_C if (m_hide) return; startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); } void DocbookDocVisitor::visitPost(DocDotFile *df) { +DB_VIS_C if (m_hide) return; endDotFile(df->hasCaption()); } void DocbookDocVisitor::visitPre(DocMscFile *df) { +DB_VIS_C if (m_hide) return; startMscFile(df->file(),df->width(),df->height(),df->hasCaption()); } void DocbookDocVisitor::visitPost(DocMscFile *df) { +DB_VIS_C if (m_hide) return; endMscFile(df->hasCaption()); } void DocbookDocVisitor::visitPre(DocDiaFile *df) { +DB_VIS_C if (m_hide) return; startDiaFile(df->file(),df->width(),df->height(),df->hasCaption()); } void DocbookDocVisitor::visitPost(DocDiaFile *df) { +DB_VIS_C if (m_hide) return; endDiaFile(df->hasCaption()); } void DocbookDocVisitor::visitPre(DocLink *lnk) { +DB_VIS_C if (m_hide) return; startLink(lnk->file(),lnk->anchor()); } void DocbookDocVisitor::visitPost(DocLink *) { +DB_VIS_C if (m_hide) return; endLink(); } void DocbookDocVisitor::visitPre(DocRef *ref) { +DB_VIS_C if (m_hide) return; - if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor()); + if (ref->isSubPage()) + { + startLink(0,ref->anchor()); + } + else + { + if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor()); + } + if (!ref->hasLinkText()) filter(ref->targetTitle()); } void DocbookDocVisitor::visitPost(DocRef *ref) { +DB_VIS_C if (m_hide) return; if (!ref->file().isEmpty()) endLink(); } void DocbookDocVisitor::visitPre(DocSecRefItem *ref) { +DB_VIS_C if (m_hide) return; - m_t << "file() << "_1" << ref->anchor() << "\">"; + //m_t << "file()) << "_1" << ref->anchor() << "\">"; + m_t << ""; } void DocbookDocVisitor::visitPost(DocSecRefItem *) { +DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "" << endl; } void DocbookDocVisitor::visitPre(DocSecRefList *) { +DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "" << endl; } void DocbookDocVisitor::visitPost(DocSecRefList *) { +DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "" << endl; } void DocbookDocVisitor::visitPre(DocParamSect *s) { +DB_VIS_C if (m_hide) return; m_t << endl; m_t << " " << endl; - m_t << " " << endl; - m_t << " <table frame=\"all\">" << endl; - m_t << " <title>"; + m_t << " <title>" << endl; switch(s->type()) { case DocParamSect::Param: m_t << theTranslator->trParameters(); break; @@ -1062,29 +1320,96 @@ void DocbookDocVisitor::visitPre(DocParamSect *s) default: ASSERT(0); } - m_t << " " << endl; - m_t << " " << endl; - m_t << " " << endl; - m_t << " " << endl; + m_t << " " << endl; + m_t << " " << endl; + m_t << " " << endl; + int ncols = 2; + if (s->type() == DocParamSect::Param) + { + bool hasInOutSpecs = s->hasInOutSpecifier(); + bool hasTypeSpecs = s->hasTypeSpecifier(); + if (hasInOutSpecs && hasTypeSpecs) ncols += 2; + else if (hasInOutSpecs || hasTypeSpecs) ncols += 1; + } + m_t << " " << endl; + for (int i = 1; i <= ncols; i++) + { + if (i == ncols) m_t << " " << endl; + else m_t << " " << endl; + } m_t << " " << endl; } void DocbookDocVisitor::visitPost(DocParamSect *) { +DB_VIS_C if (m_hide) return; m_t << " " << endl; m_t << " " << endl; m_t << "
" << endl; + m_t << "
" << endl; m_t << "
" << endl; m_t << " "; } void DocbookDocVisitor::visitPre(DocParamList *pl) { +DB_VIS_C if (m_hide) return; + m_t << " " << endl; + + DocParamSect::Type parentType = DocParamSect::Unknown; + DocParamSect *sect = 0; + if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) + { + parentType = ((DocParamSect*)pl->parent())->type(); + sect=(DocParamSect*)pl->parent(); + } + + if (sect && sect->hasInOutSpecifier()) + { + m_t << " "; + if (pl->direction()!=DocParamSect::Unspecified) + { + if (pl->direction()==DocParamSect::In) + { + m_t << "in"; + } + else if (pl->direction()==DocParamSect::Out) + { + m_t << "out"; + } + else if (pl->direction()==DocParamSect::InOut) + { + m_t << "in,out"; + } + } + m_t << " "; + } + + if (sect && sect->hasTypeSpecifier()) + { + QListIterator li(pl->paramTypes()); + DocNode *type; + bool first=TRUE; + m_t << " "; + for (li.toFirst();(type=li.current());++li) + { + if (!first) m_t << " | "; else first=FALSE; + if (type->kind()==DocNode::Kind_Word) + { + visit((DocWord*)type); + } + else if (type->kind()==DocNode::Kind_LinkedWord) + { + visit((DocLinkedWord*)type); + } + } + m_t << " "; + } + QListIterator li(pl->parameters()); DocNode *param; - m_t << " " << endl; if (!li.toFirst()) { m_t << " " << endl; @@ -1116,6 +1441,7 @@ void DocbookDocVisitor::visitPre(DocParamList *pl) void DocbookDocVisitor::visitPost(DocParamList *) { +DB_VIS_C if (m_hide) return; m_t << "" << endl; m_t << " " << endl; @@ -1123,10 +1449,11 @@ void DocbookDocVisitor::visitPost(DocParamList *) void DocbookDocVisitor::visitPre(DocXRefItem *x) { +DB_VIS_C if (m_hide) return; if (x->title().isEmpty()) return; - m_t << "file() << "_1" << x->anchor(); + m_t << "file()) << "_1" << x->anchor(); m_t << "\">"; filter(x->title()); m_t << ""; @@ -1135,6 +1462,7 @@ void DocbookDocVisitor::visitPre(DocXRefItem *x) void DocbookDocVisitor::visitPost(DocXRefItem *x) { +DB_VIS_C if (m_hide) return; if (x->title().isEmpty()) return; m_t << ""; @@ -1142,12 +1470,14 @@ void DocbookDocVisitor::visitPost(DocXRefItem *x) void DocbookDocVisitor::visitPre(DocInternalRef *ref) { +DB_VIS_C if (m_hide) return; startLink(ref->file(),ref->anchor()); } void DocbookDocVisitor::visitPost(DocInternalRef *) { +DB_VIS_C if (m_hide) return; endLink(); m_t << " "; @@ -1155,6 +1485,7 @@ void DocbookDocVisitor::visitPost(DocInternalRef *) void DocbookDocVisitor::visitPre(DocCopy *) { +DB_VIS_C if (m_hide) return; // TODO: to be implemented } @@ -1162,6 +1493,7 @@ void DocbookDocVisitor::visitPre(DocCopy *) void DocbookDocVisitor::visitPost(DocCopy *) { +DB_VIS_C if (m_hide) return; // TODO: to be implemented } @@ -1169,72 +1501,89 @@ void DocbookDocVisitor::visitPost(DocCopy *) void DocbookDocVisitor::visitPre(DocText *) { +DB_VIS_C // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocText *) { +DB_VIS_C // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocHtmlBlockQuote *) { +DB_VIS_C if (m_hide) return; m_t << "
"; } void DocbookDocVisitor::visitPost(DocHtmlBlockQuote *) { +DB_VIS_C if (m_hide) return; m_t << "
"; } void DocbookDocVisitor::visitPre(DocVhdlFlow *) { +DB_VIS_C // TODO: to be implemented } void DocbookDocVisitor::visitPost(DocVhdlFlow *) { +DB_VIS_C // TODO: to be implemented } void DocbookDocVisitor::visitPre(DocParBlock *) { +DB_VIS_C } void DocbookDocVisitor::visitPost(DocParBlock *) { +DB_VIS_C } void DocbookDocVisitor::filter(const char *str) { - m_t << convertToXML(str); +DB_VIS_C + m_t << convertToDocBook(str); } void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor) { - m_t << ""; } void DocbookDocVisitor::endLink() { +DB_VIS_C m_t << ""; } void DocbookDocVisitor::pushEnabled() { +DB_VIS_C m_enabled.push(new bool(m_hide)); } void DocbookDocVisitor::popEnabled() { +DB_VIS_C bool *v=m_enabled.pop(); ASSERT(v!=0); m_hide = *v; @@ -1243,6 +1592,7 @@ void DocbookDocVisitor::popEnabled() void DocbookDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s) { +DB_VIS_C QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) @@ -1251,13 +1601,14 @@ void DocbookDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s) } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); - visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); + visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); } void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s) { +DB_VIS_C QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) @@ -1266,7 +1617,7 @@ void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim } QCString outDir = Config_getString(DOCBOOK_OUTPUT); generatePlantUMLOutput(baseName,outDir,PUML_BITMAP); - visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); + visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); } @@ -1277,6 +1628,7 @@ void DocbookDocVisitor::startMscFile(const QCString &fileName, bool hasCaption ) { +DB_VIS_C QCString baseName=fileName; int i; if ((i=baseName.findRev('/'))!=-1) @@ -1296,6 +1648,7 @@ void DocbookDocVisitor::startMscFile(const QCString &fileName, void DocbookDocVisitor::endMscFile(bool hasCaption) { +DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); m_t << "
" << endl; @@ -1303,6 +1656,7 @@ void DocbookDocVisitor::endMscFile(bool hasCaption) void DocbookDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s) { +DB_VIS_C QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) @@ -1322,6 +1676,7 @@ void DocbookDocVisitor::startDiaFile(const QCString &fileName, bool hasCaption ) { +DB_VIS_C QCString baseName=fileName; int i; if ((i=baseName.findRev('/'))!=-1) @@ -1341,6 +1696,7 @@ void DocbookDocVisitor::startDiaFile(const QCString &fileName, void DocbookDocVisitor::endDiaFile(bool hasCaption) { +DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); m_t << "" << endl; @@ -1348,6 +1704,7 @@ void DocbookDocVisitor::endDiaFile(bool hasCaption) void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s) { +DB_VIS_C QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) @@ -1356,7 +1713,7 @@ void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s) } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); - visitPreStart(m_t, s->hasCaption(), baseName + ".dot", s->width(),s->height()); + visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); } @@ -1367,6 +1724,7 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName, bool hasCaption ) { +DB_VIS_C QCString baseName=fileName; int i; if ((i=baseName.findRev('/'))!=-1) @@ -1387,6 +1745,7 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName, void DocbookDocVisitor::endDotFile(bool hasCaption) { +DB_VIS_C if (m_hide) return; m_t << endl; visitPostEnd(m_t, hasCaption); diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index 6c7976c..40f8a68 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -26,11 +26,15 @@ class FTextStream; class CodeOutputInterface; class QCString; +void visitPreStart(FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height); +void visitPostEnd(FTextStream &t, const bool hasCaption); + /*! @brief Concrete visitor implementation for Docbook output. */ class DocbookDocVisitor : public DocVisitor { public: DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci); + ~DocbookDocVisitor(); //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- diff --git a/src/docparser.h b/src/docparser.h index 6b75426..9776d0b 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -707,6 +707,7 @@ class DocTitle : public CompAccept void parse(); void parseFromString(const QCString &title); Kind kind() const { return Kind_Title; } + bool hasTitle() const { return !m_children.isEmpty(); } private: }; @@ -1092,6 +1093,7 @@ class DocSimpleSect : public CompAccept int parseRcs(); int parseXml(); void appendLinkWord(const QCString &word); + bool hasTitle() const { return m_title->hasTitle(); } private: Type m_type; diff --git a/src/dot.cpp b/src/dot.cpp index 7b29569..5f52210 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -1383,6 +1383,11 @@ bool DotManager::run() setDotFontPath(Config_getString(RTF_OUTPUT)); setPath=TRUE; } + else if (Config_getBool(GENERATE_DOCBOOK)) + { + setDotFontPath(Config_getString(DOCBOOK_OUTPUT)); + setPath=TRUE; + } portable_sysTimerStart(); // fill work queue with dot operations DotRunner *dr; @@ -3242,29 +3247,15 @@ QCString DotClassGraph::writeGraph(FTextStream &out, if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook) { out << "" << endl; - out << "
" << endl; - out << " "; - switch (m_graphType) - { - case DotNode::Collaboration: - out << "Collaboration graph"; - break; - case DotNode::Inheritance: - out << "Inheritance graph"; - break; - default: - ASSERT(0); - break; - } - out << "" << endl; + out << " " << endl; out << " " << endl; out << " " << endl; out << " "; + out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << baseName << "." << imgExt << "\">"; out << "" << endl; out << " " << endl; out << " " << endl; - out << "
" << endl; + out << " " << endl; out << "
" << endl; } else if (graphFormat==GOF_BITMAP && generateImageMap) // produce HTML to include the image @@ -3601,17 +3592,15 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out, if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook) { out << "" << endl; - out << "
" << endl; - out << " Dependency diagram"; - out << "" << endl; + out << " " << endl; out << " " << endl; out << " " << endl; out << " "; + out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << baseName << "." << imgExt << "\">"; out << "" << endl; out << " " << endl; out << " " << endl; - out << "
" << endl; + out << " " << endl; out << "
" << endl; } else if (graphFormat==GOF_BITMAP && generateImageMap) @@ -3922,17 +3911,15 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook) { out << "" << endl; - out << "
" << endl; - out << " Call diagram"; - out << "" << endl; + out << " " << endl; out << " " << endl; out << " " << endl; out << " "; + out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << baseName << "." << imgExt << "\">"; out << "" << endl; out << " " << endl; out << " " << endl; - out << "
" << endl; + out << " " << endl; out << "
" << endl; } else if (graphFormat==GOF_BITMAP && generateImageMap) @@ -4087,17 +4074,15 @@ QCString DotDirDeps::writeGraph(FTextStream &out, if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook) { out << "" << endl; - out << "
" << endl; - out << " Directory Dependency diagram"; - out << "" << endl; + out << " " << endl; out << " " << endl; out << " " << endl; out << " "; + out << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << baseName << "." << imgExt << "\">"; out << "" << endl; out << " " << endl; out << " " << endl; - out << "
" << endl; + out << " " << endl; out << "
" << endl; } else if (graphFormat==GOF_BITMAP && generateImageMap) @@ -4650,17 +4635,15 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, if (graphFormat==GOF_BITMAP && textFormat==EOF_DocBook) { t << "" << endl; - t << "
" << endl; - t << " Group Collaboration diagram"; - t << "" << endl; + t << " " << endl; t << " " << endl; t << " " << endl; t << " "; + t << " width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << baseName << "." << imgExt << "\">"; t << "" << endl; t << " " << endl; t << " " << endl; - t << "
" << endl; + t << " " << endl; t << "
" << endl; } else if (graphFormat==GOF_BITMAP && writeImageMap) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index bf93a9b..21ae289 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11100,14 +11100,20 @@ void parseInput() // Notice: the order of the function calls below is very important! - if (Config_getBool(GENERATE_HTML)) + if (Config_getBool(GENERATE_HTML) && !Config_getBool(USE_MATHJAX)) { readFormulaRepository(Config_getString(HTML_OUTPUT)); } if (Config_getBool(GENERATE_RTF)) { // in case GENERRATE_HTML is set we just have to compare, both repositories should be identical - readFormulaRepository(Config_getString(RTF_OUTPUT),Config_getBool(GENERATE_HTML)); + readFormulaRepository(Config_getString(RTF_OUTPUT),Config_getBool(GENERATE_HTML) && !Config_getBool(USE_MATHJAX)); + } + if (Config_getBool(GENERATE_DOCBOOK)) + { + // in case GENERRATE_HTML is set we just have to compare, both repositories should be identical + readFormulaRepository(Config_getString(DOCBOOK_OUTPUT), + (Config_getBool(GENERATE_HTML) && !Config_getBool(USE_MATHJAX)) || Config_getBool(GENERATE_RTF)); } /************************************************************************** @@ -11456,6 +11462,7 @@ void generateOutput() bool generateLatex = Config_getBool(GENERATE_LATEX); bool generateMan = Config_getBool(GENERATE_MAN); bool generateRtf = Config_getBool(GENERATE_RTF); + bool generateDocbook = Config_getBool(GENERATE_DOCBOOK); g_outputList = new OutputList(TRUE); @@ -11483,6 +11490,13 @@ void generateOutput() g_outputList->add(new LatexGenerator); LatexGenerator::init(); } +#if 1 + if (generateDocbook) + { + g_outputList->add(new DocbookGenerator); + DocbookGenerator::init(); + } +#endif if (generateMan) { g_outputList->add(new ManGenerator); @@ -11509,6 +11523,7 @@ void generateOutput() if (generateHtml) writeDoxFont(Config_getString(HTML_OUTPUT)); if (generateLatex) writeDoxFont(Config_getString(LATEX_OUTPUT)); + if (generateDocbook) writeDoxFont(Config_getString(DOCBOOK_OUTPUT)); if (generateRtf) writeDoxFont(Config_getString(RTF_OUTPUT)); g_s.begin("Generating style sheet...\n"); @@ -11602,6 +11617,13 @@ void generateOutput() g_s.end(); } + if (Doxygen::formulaList->count()>0 && generateDocbook) + { + g_s.begin("Generating bitmaps for formulas in Docbook...\n"); + Doxygen::formulaList->generateBitmaps(Config_getString(DOCBOOK_OUTPUT)); + g_s.end(); + } + if (Config_getBool(SORT_GROUP_NAMES)) { Doxygen::groupSDict->sort(); @@ -11634,6 +11656,8 @@ void generateOutput() removeDoxFont(Config_getString(RTF_OUTPUT)); if (generateLatex) removeDoxFont(Config_getString(LATEX_OUTPUT)); + if (generateDocbook) + removeDoxFont(Config_getString(DOCBOOK_OUTPUT)); } if (Config_getBool(GENERATE_XML)) @@ -11651,12 +11675,14 @@ void generateOutput() g_s.end(); } - if (Config_getBool(GENERATE_DOCBOOK)) +#if 0 + if (generateDocbook) { g_s.begin("Generating Docbook output...\n"); - generateDocbook(); + generateDocbook_v1(); g_s.end(); } +#endif if (Config_getBool(GENERATE_AUTOGEN_DEF)) { @@ -11728,6 +11754,10 @@ void generateOutput() copyLogo(Config_getString(LATEX_OUTPUT)); copyExtraFiles(Config_getList(LATEX_EXTRA_FILES),"LATEX_EXTRA_FILES",Config_getString(LATEX_OUTPUT)); } + if (generateDocbook) + { + copyLogo(Config_getString(DOCBOOK_OUTPUT)); + } if (generateRtf) { copyLogo(Config_getString(RTF_OUTPUT)); diff --git a/src/filedef.cpp b/src/filedef.cpp index e2df9be..d9eaa4b 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -348,6 +348,10 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) { ol.disable(OutputGenerator::Latex); } + if (ol.isEnabled(OutputGenerator::Docbook) && !Config_getBool(DOCBOOK_PROGRAMLISTING)) + { + ol.disable(OutputGenerator::Docbook); + } if (ol.isEnabled(OutputGenerator::RTF) && !Config_getBool(RTF_SOURCE_CODE)) { ol.disable(OutputGenerator::RTF); @@ -937,6 +941,7 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); + static bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); DevNullCodeDocInterface devNullIntf; QCString title = m_docname; @@ -947,6 +952,7 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) QCString pageTitle = theTranslator->trSourceFile(title); ol.disable(OutputGenerator::Man); if (!latexSourceCode) ol.disable(OutputGenerator::Latex); + if (!docbookSourceCode) ol.disable(OutputGenerator::Docbook); if (!rtfSourceCode) ol.disable(OutputGenerator::RTF); bool isDocFile = isDocumentationFile(); @@ -978,13 +984,14 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) if (isLinkable()) { + ol.pushGeneratorState(); if (latexSourceCode) ol.disable(OutputGenerator::Latex); if (rtfSourceCode) ol.disable(OutputGenerator::RTF); + if (docbookSourceCode) ol.disable(OutputGenerator::Docbook); ol.startTextLink(getOutputFileBase(),0); ol.parseText(theTranslator->trGotoDocumentation()); ol.endTextLink(); - if (latexSourceCode) ol.enable(OutputGenerator::Latex); - if (rtfSourceCode) ol.enable(OutputGenerator::RTF); + ol.popGeneratorState(); } (void)sameTu; diff --git a/src/index.cpp b/src/index.cpp index 8e5f266..503387c 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -94,9 +94,12 @@ static void startIndexHierarchy(OutputList &ol,int level) ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Html); if (level<6) ol.startIndexList(); - ol.enableAll(); + ol.popGeneratorState(); + + ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); + ol.disable(OutputGenerator::Docbook); ol.startItemList(); ol.popGeneratorState(); } @@ -107,8 +110,11 @@ static void endIndexHierarchy(OutputList &ol,int level) ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Html); if (level<6) ol.endIndexList(); - ol.enableAll(); + ol.popGeneratorState(); + + ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.disable(OutputGenerator::RTF); ol.endItemList(); ol.popGeneratorState(); @@ -959,6 +965,7 @@ static void writeHierarchicalIndex(OutputList &ol) ol.pushGeneratorState(); //1.{ ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ClassHierarchy); QCString title = lne ? lne->title() : theTranslator->trClassHierarchy(); @@ -973,15 +980,16 @@ static void writeHierarchicalIndex(OutputList &ol) if (Config_getBool(HAVE_DOT) && Config_getBool(GRAPHICAL_HIERARCHY)) { + ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); + ol.disable(OutputGenerator::Docbook); ol.startParagraph(); ol.startTextLink("inherits",0); ol.parseText(theTranslator->trGotoGraphicalHierarchy()); ol.endTextLink(); ol.endParagraph(); - ol.enable(OutputGenerator::Latex); - ol.enable(OutputGenerator::RTF); + ol.popGeneratorState(); } ol.parseText(lne ? lne->intro() : theTranslator->trClassHierarchyDescription()); ol.endTextBlock(); @@ -1170,6 +1178,7 @@ static void writeFileIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); if (documentedFiles==0) ol.disableAllBut(OutputGenerator::Html); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::FileList); @@ -1450,6 +1459,7 @@ static void writeNamespaceIndex(OutputList &ol) if (documentedNamespaces==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::NamespaceList); if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Namespaces); // fall back QCString title = lne ? lne->title() : theTranslator->trNamespaceList(); @@ -1603,6 +1613,7 @@ static void writeAnnotatedClassList(OutputList &ol) if (cd->isEmbeddedInOuterScope()) { ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.disable(OutputGenerator::RTF); } if (cd->isLinkableInProject() && cd->templateMaster()==0) @@ -2021,6 +2032,7 @@ static void writeAlphabeticalIndex(OutputList &ol) if (annotatedClasses==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + ol.disable(OutputGenerator::Docbook); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ClassIndex); QCString title = lne ? lne->title() : theTranslator->trCompoundIndex(); bool addToIndex = lne==0 || lne->visible(); @@ -2053,6 +2065,7 @@ static void writeAnnotatedIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); if (annotatedClassesPrinted==0) { ol.disable(OutputGenerator::Latex); @@ -3022,6 +3035,7 @@ static void writeExampleIndex(OutputList &ol) if (Doxygen::exampleSDict->count()==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Examples); QCString title = lne ? lne->title() : theTranslator->trExamples(); bool addToIndex = lne==0 || lne->visible(); @@ -3621,6 +3635,7 @@ static void writeGroupIndex(OutputList &ol) ol.pushGeneratorState(); // 1.{ ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Modules); QCString title = lne ? lne->title() : theTranslator->trModules(); bool addToIndex = lne==0 || lne->visible(); @@ -3910,6 +3925,7 @@ static void writeIndex(OutputList &ol) // write LaTeX/RTF index //-------------------------------------------------------------------- ol.enable(OutputGenerator::Latex); + ol.enable(OutputGenerator::Docbook); ol.enable(OutputGenerator::RTF); ol.startFile("refman",0,0); @@ -3918,6 +3934,7 @@ static void writeIndex(OutputList &ol) { ol.disable(OutputGenerator::Latex); } + ol.disable(OutputGenerator::Docbook); if (projPrefix.isEmpty()) { @@ -3939,6 +3956,7 @@ static void writeIndex(OutputList &ol) ol.parseText(theTranslator->trGeneratedBy()); ol.endIndexSection(isTitlePageAuthor); ol.enable(OutputGenerator::Latex); + ol.enable(OutputGenerator::Docbook); ol.lastIndexPage(); if (Doxygen::mainPage) @@ -3978,9 +3996,11 @@ static void writeIndex(OutputList &ol) QCString title = pd->title(); if (title.isEmpty()) title=pd->name(); + ol.disable(OutputGenerator::Docbook); ol.startIndexSection(isPageDocumentation); ol.parseText(title); ol.endIndexSection(isPageDocumentation); + ol.enable(OutputGenerator::Docbook); ol.pushGeneratorState(); // write TOC title (RTF only) ol.disableAllBut(OutputGenerator::RTF); @@ -4002,6 +4022,7 @@ static void writeIndex(OutputList &ol) } } + ol.disable(OutputGenerator::Docbook); if (!Config_getBool(LATEX_HIDE_INDICES)) { //if (indexedPages>0) @@ -4049,6 +4070,8 @@ static void writeIndex(OutputList &ol) ol.endIndexSection(isFileIndex); } } + ol.enable(OutputGenerator::Docbook); + if (documentedGroups>0) { ol.startIndexSection(isModuleDocumentation); diff --git a/src/marshal.cpp b/src/marshal.cpp index fa29aed..f0ed2e8 100644 --- a/src/marshal.cpp +++ b/src/marshal.cpp @@ -350,6 +350,7 @@ void marshalLocalToc(StorageIntf *s,const LocalToc <) marshalInt(s,lt.htmlLevel()); marshalInt(s,lt.latexLevel()); marshalInt(s,lt.xmlLevel()); + marshalInt(s,lt.docbookLevel()); } void marshalEntry(StorageIntf *s,Entry *e) @@ -740,6 +741,7 @@ LocalToc unmarshalLocalToc(StorageIntf *s) int htmlLevel = unmarshalInt(s); int latexLevel = unmarshalInt(s); int xmlLevel = unmarshalInt(s); + int docbookLevel = unmarshalInt(s); if ((mask & (1<isObjCMethod()); @@ -172,6 +174,7 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md) ol.enableAll(); ol.disable(OutputGenerator::Html); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); { // other formats if (!md->isObjCMethod()) ol.docify("("); // start argument list @@ -270,6 +273,7 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md) // ol.docify(" "); //} ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.disable(OutputGenerator::Html); ol.docify(" "); /* man page */ if (htmlOn) ol.enable(OutputGenerator::Html); @@ -277,12 +281,15 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md) ol.startEmphasis(); ol.enable(OutputGenerator::Man); if (latexOn) ol.enable(OutputGenerator::Latex); + if (docbookOn) ol.enable(OutputGenerator::Docbook); if (a->name.isEmpty()) ol.docify(a->type); else ol.docify(a->name); ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.endEmphasis(); ol.enable(OutputGenerator::Man); if (latexOn) ol.enable(OutputGenerator::Latex); + if (docbookOn) ol.enable(OutputGenerator::Docbook); } if (!a->array.isEmpty()) { @@ -338,10 +345,12 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md) ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); if (!md->isObjCMethod()) ol.docify(")"); // end argument list ol.enableAll(); if (htmlOn) ol.enable(OutputGenerator::Html); if (latexOn) ol.enable(OutputGenerator::Latex); + if (docbookOn) ol.enable(OutputGenerator::Docbook); if (first) ol.startParameterName(defArgList->count()<2); ol.endParameterName(TRUE,defArgList->count()<2,!md->isObjCMethod()); ol.popGeneratorState(); @@ -1478,6 +1487,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.docify("\n"); ol.popGeneratorState(); } @@ -3836,8 +3846,10 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, typeDecl.pushGeneratorState(); typeDecl.disableAllBut(OutputGenerator::Html); typeDecl.enable(OutputGenerator::Latex); + typeDecl.enable(OutputGenerator::Docbook); typeDecl.lineBreak(); typeDecl.disable(OutputGenerator::Latex); + typeDecl.disable(OutputGenerator::Docbook); typeDecl.writeString("  "); typeDecl.popGeneratorState(); } diff --git a/src/outputgen.h b/src/outputgen.h index 9935bd9..a99cff3 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -322,7 +322,7 @@ class BaseOutputDocInterface : public CodeOutputInterface class OutputGenerator : public BaseOutputDocInterface { public: - enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl }; + enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl , Docbook}; OutputGenerator(); virtual ~OutputGenerator(); diff --git a/src/pagedef.cpp b/src/pagedef.cpp index d2c3f68..79a78d3 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -187,6 +187,7 @@ void PageDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); //2.{ ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::Docbook); ol.disable(OutputGenerator::RTF); ol.disable(OutputGenerator::Man); if (!title().isEmpty() && !name().isEmpty() && si!=0) @@ -207,7 +208,7 @@ void PageDef::writeDocumentation(OutputList &ol) ol.popGeneratorState(); //2.} - if ((m_localToc.isHtmlEnabled() || m_localToc.isLatexEnabled()) && hasSections()) + if ((m_localToc.isHtmlEnabled() || m_localToc.isLatexEnabled() || m_localToc.isDocbookEnabled()) && hasSections()) { writeToc(ol, m_localToc); } @@ -269,6 +270,7 @@ void PageDef::writePageDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disableAll(); ol.enable(OutputGenerator::Latex); + ol.enable(OutputGenerator::Docbook); ol.enable(OutputGenerator::RTF); PageSDict::Iterator pdi(*m_subPageDict); diff --git a/src/types.h b/src/types.h index e58c8fc..d6f0342 100644 --- a/src/types.h +++ b/src/types.h @@ -227,7 +227,8 @@ class LocalToc Html = 0, // index / also to be used as bit position in mask (1 << Html) Latex = 1, // ... Xml = 2, // ... - numTocTypes = 3 // number of enum values + Docbook = 3, // ... + numTocTypes = 4 // number of enum values }; LocalToc() : m_mask(None) { memset(m_level,0,sizeof(m_level)); } @@ -247,15 +248,22 @@ class LocalToc m_mask|=(1<file.data()); ol.writeObjectLink(0,e->file,e->anchor,e->name); @@ -5932,6 +5934,66 @@ QCString convertToXML(const char *s) return growBuf.get(); } +/*! Converts a string to an DocBook-encoded string */ +QCString convertToDocBook(const char *s) +{ + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const unsigned char *q; + int cnt; + const unsigned char *p=(const unsigned char *)s; + char c; + while ((c=*p++)) + { + switch (c) + { + case '<': growBuf.addStr("<"); break; + case '>': growBuf.addStr(">"); break; + case '&': // possibility to have a special symbol + q = p; + cnt = 2; // we have to count & and ; as well + while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9')) + { + cnt++; + q++; + } + if (*q == ';') + { + --p; // we need & as well + DocSymbol::SymType res = HtmlEntityMapper::instance()->name2sym(QCString((char *)p).left(cnt)); + if (res == DocSymbol::Sym_Unknown) + { + p++; + growBuf.addStr("&"); + } + else + { + growBuf.addStr(HtmlEntityMapper::instance()->docbook(res)); + q++; + p = q; + } + } + else + { + growBuf.addStr("&"); + } + break; + case '\'': growBuf.addStr("'"); break; + case '"': growBuf.addStr("""); break; + case '\007': growBuf.addStr("␇"); break; + case 1: case 2: case 3: case 4: case 5: case 6: case 8: + case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: + case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: + case 27: case 28: case 29: case 30: case 31: + break; // skip invalid XML characters (see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char) + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + /*! Converts a string to a HTML-encoded string */ QCString convertToHtml(const char *s,bool keepEntities) { diff --git a/src/util.h b/src/util.h index a9eee67..2ee8b17 100644 --- a/src/util.h +++ b/src/util.h @@ -284,6 +284,8 @@ QCString convertToLaTeX(const QCString &s,bool insideTabbing=FALSE,bool keepSpac QCString convertToXML(const char *s); +QCString convertToDocBook(const char *s); + QCString convertToJSString(const char *s, bool applyTextDir = true); QCString getOverloadDocs(); diff --git a/testing/031/indexpage.xml b/testing/031/indexpage.xml index 3b3a2e3..2c1dfd7 100644 --- a/testing/031/indexpage.xml +++ b/testing/031/indexpage.xml @@ -8,6 +8,7 @@ Some text. Doxygen logo + More text. diff --git a/testing/031_image.dox b/testing/031_image.dox index f437086..8ba47b7 100644 --- a/testing/031_image.dox +++ b/testing/031_image.dox @@ -5,5 +5,6 @@ * Some text. * \image html sample.png * \image latex sample.png "Doxygen logo" width=5cm + * \image docbook sample.png * More text. */ diff --git a/testing/043_page.dox b/testing/043_page.dox index d554da2..9ac5c0e 100644 --- a/testing/043_page.dox +++ b/testing/043_page.dox @@ -4,7 +4,7 @@ /** \page mypage Page Title * \brief Page brief description. * - * @tableofcontents{xml,html,latex} + * @tableofcontents{xml,html,latex,docbook} * * Text at page level. See \ref mysect for more. * \section mysect Section Title. -- cgit v0.12