void HtmlDocVisitor::visitPre(DocImage *img) { if (img->type()==DocImage::Html) { forceEndParagraph(img); if (m_hide) return; QString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } m_t << "<div class=\"image\">" << endl; m_t << "<img src=\"" << img->relPath() << img->name() << "\" alt=\"" << baseName << "\"" << htmlAttribsToString(img->attribs()) << "/>" << endl; if (img->hasCaption()) { m_t << "<div class=\"caption\">" << endl; } } else // other format -> skip { pushEnabled(); m_hide=TRUE; } }
void HtmlDocVisitor::visitPre(DocHtmlHeader *header) { if (m_hide) return; forceEndParagraph(header); m_t << "<h" << header->level() << htmlAttribsToString(header->attribs()) << ">"; }
void HtmlDocVisitor::visitPre(DocSecRefList *s) { if (m_hide) return; forceEndParagraph(s); m_t << "<div class=\"multicol\">" << endl; m_t << "<ul>" << endl; }
void HtmlDocVisitor::visitPre(DocParamSect *s) { if (m_hide) return; forceEndParagraph(s); m_t << "<dl><dt><b>"; QCString className; switch(s->type()) { case DocParamSect::Param: m_t << theTranslator->trParameters(); className="params"; break; case DocParamSect::RetVal: m_t << theTranslator->trReturnValues(); className="retval"; break; case DocParamSect::Exception: m_t << theTranslator->trExceptions(); className="exception"; break; case DocParamSect::TemplateParam: /* TODO: add this m_t << theTranslator->trTemplateParam(); break; */ m_t << "Template Parameters"; break; className="tparams"; default: ASSERT(0); } m_t << ":"; m_t << "</b></dt><dd>" << endl; m_t << " <table class=\"" << className << "\">" << endl; }
void HtmlDocVisitor::visitPre(DocSimpleList *sl) { if (m_hide) return; forceEndParagraph(sl); m_t << "<ul>"; if (!sl->isPreformatted()) m_t << "\n"; }
void HtmlDocVisitor::visitPre(DocSection *s) { if (m_hide) return; forceEndParagraph(s); m_t << "<h" << s->level()+1 << ">"; m_t << "<a class=\"anchor\" id=\"" << s->anchor(); m_t << "\"></a>" << endl; filter(convertCharEntitiesToUTF8(s->title().data())); m_t << "</h" << s->level()+1 << ">\n"; }
void HtmlDocVisitor::visitPre(DocHtmlList *s) { if (m_hide) return; forceEndParagraph(s); if (s->type()==DocHtmlList::Ordered) { m_t << "<ol" << htmlAttribsToString(s->attribs()) << ">\n"; } else { m_t << "<ul" << htmlAttribsToString(s->attribs()) << ">\n"; } }
void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b) { if (m_hide) return; forceEndParagraph(b); QString attrs = htmlAttribsToString(b->attribs()); if (attrs.isEmpty()) { m_t << "<blockquote class=\"doxtable\">\n"; } else { m_t << "<blockquote " << htmlAttribsToString(b->attribs()) << ">\n"; } }
void HtmlDocVisitor::visitPre(DocSimpleSect *s) { if (m_hide) return; forceEndParagraph(s); m_t << "<dl class=\"" << s->typeString() << "\"><dt><b>"; switch(s->type()) { case DocSimpleSect::See: m_t << theTranslator->trSeeAlso(); break; case DocSimpleSect::Return: m_t << theTranslator->trReturns(); break; case DocSimpleSect::Author: m_t << theTranslator->trAuthor(TRUE,TRUE); break; case DocSimpleSect::Authors: m_t << theTranslator->trAuthor(TRUE,FALSE); break; case DocSimpleSect::Version: m_t << theTranslator->trVersion(); break; case DocSimpleSect::Since: m_t << theTranslator->trSince(); break; case DocSimpleSect::Date: m_t << theTranslator->trDate(); break; case DocSimpleSect::Note: m_t << theTranslator->trNote(); break; case DocSimpleSect::Warning: m_t << theTranslator->trWarning(); break; case DocSimpleSect::Pre: m_t << theTranslator->trPrecondition(); break; case DocSimpleSect::Post: m_t << theTranslator->trPostcondition(); break; case DocSimpleSect::Copyright: m_t << theTranslator->trCopyright(); break; case DocSimpleSect::Invar: m_t << theTranslator->trInvariant(); break; case DocSimpleSect::Remark: m_t << theTranslator->trRemarks(); break; case DocSimpleSect::Attention: m_t << theTranslator->trAttention(); break; case DocSimpleSect::User: break; case DocSimpleSect::Rcs: break; case DocSimpleSect::Unknown: break; } // special case 1: user defined title if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs) { m_t << ":</b></dt><dd>"; } }
void HtmlDocVisitor::visitPre(DocHtmlTable *t) { if (m_hide) return; forceEndParagraph(t); QString attrs = htmlAttribsToString(t->attribs()); if (attrs.isEmpty()) { m_t << "<table class=\"doxtable\">\n"; } else { m_t << "<table " << htmlAttribsToString(t->attribs()) << ">\n"; } }
void HtmlDocVisitor::visit(DocFormula *f) { if (m_hide) return; bool bDisplay = !f->isInline(); if (bDisplay) { forceEndParagraph(f); m_t << "<p class=\"formulaDsp\">" << endl; } if (Config_getBool("USE_MATHJAX")) { QCString text = f->text(); bool closeInline = FALSE; if (!bDisplay && !text.isEmpty() && text.at(0)=='$' && text.at(text.length()-1)=='$') { closeInline=TRUE; text = text.mid(1,text.length()-2); m_t << "\\("; } m_t << convertToHtml(text); if (closeInline) { m_t << "\\)"; } } else { m_t << "<img class=\"formula" << (bDisplay ? "Dsp" : "Inl"); m_t << "\" alt=\""; filterQuotedCdataAttr(f->text()); m_t << "\""; /// @todo cache image dimensions on formula generation and give height/width /// for faster preloading and better rendering of the page m_t << " src=\"" << f->relPath() << f->name() << ".png\"/>"; } if (bDisplay) { m_t << endl << "</p>" << endl; forceStartParagraph(f); } }
void HtmlDocVisitor::visitPre(DocXRefItem *x) { if (m_hide) return; forceEndParagraph(x); bool anonymousEnum = x->file()=="@"; if (!anonymousEnum) { m_t << "<dl class=\"" << x->key() << "\"><dt><b><a class=\"el\" href=\"" << x->relPath() << x->file() << Doxygen::htmlFileExtension << "#" << x->anchor() << "\">"; } else { m_t << "<dl class=\"" << x->key() << "\"><dt><b>"; } filter(x->title()); m_t << ":"; if (!anonymousEnum) m_t << "</a>"; m_t << "</b></dt><dd>"; }
void HtmlDocVisitor::visitPre(DocAutoList *l) { //printf("DocAutoList::visitPre\n"); if (m_hide) return; forceEndParagraph(l); if (l->isEnumList()) { // // Do list type based on depth: // 1. // a. // i. // A. // 1. (repeat)... // m_t << "<ol type=\"" << types[l->depth() % NUM_HTML_LIST_TYPES] << "\">"; } else { m_t << "<ul>"; } if (!l->isPreformatted()) m_t << "\n"; }
void HtmlDocVisitor::visit(DocInclude *inc) { if (m_hide) return; switch(inc->type()) { case DocInclude::Include: forceEndParagraph(inc); m_t << PREFRAG_START; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), inc->text(), inc->isExample(), inc->exampleFile(), 0, // fd -1, // startLine -1, // endLine TRUE // inlineFragment ); m_t << PREFRAG_END; forceStartParagraph(inc); break; case DocInclude::IncWithLines: { forceEndParagraph(inc); m_t << PREFRAG_START; QFileInfo cfi( inc->file() ); FileDef fd( cfi.dirPath(), cfi.fileName() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), inc->text(), inc->isExample(), inc->exampleFile(), &fd); m_t << PREFRAG_END; forceStartParagraph(inc); } break; case DocInclude::DontInclude: break; case DocInclude::HtmlInclude: m_t << inc->text(); break; case DocInclude::VerbInclude: forceEndParagraph(inc); m_t << PREFRAG_START; filter(inc->text()); m_t << PREFRAG_END; forceStartParagraph(inc); break; case DocInclude::Snippet: { forceEndParagraph(inc); m_t << PREFRAG_START; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), extractBlock(inc->text(),inc->blockId()), inc->isExample(), inc->exampleFile(), 0, -1, // startLine -1, // endLine TRUE // inlineFragment ); m_t << PREFRAG_END; forceStartParagraph(inc); } break; } }
void HtmlDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; switch(s->type()) { case DocVerbatim::Code: forceEndParagraph(s); m_t << PREFRAG_START; Doxygen::parserManager->getParser(m_langExt) ->parseCode(m_ci,s->context(),s->text(), s->isExample(),s->exampleFile()); m_t << PREFRAG_END; forceStartParagraph(s); break; case DocVerbatim::Verbatim: forceEndParagraph(s); m_t << PREFRAG_START; filter(s->text()); m_t << PREFRAG_END; forceStartParagraph(s); break; case DocVerbatim::HtmlOnly: m_t << s->text(); break; case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: /* nothing */ break; case DocVerbatim::Dot: { static int dotindex = 1; QCString fileName(4096); fileName.sprintf("%s%d%s", (Config_getString("HTML_OUTPUT")+"/inline_dotgraph_").data(), dotindex++, ".dot" ); QFile file(fileName); if (!file.open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fileName.data()); } file.writeBlock( s->text(), s->text().length() ); file.close(); forceEndParagraph(s); m_t << "<div align=\"center\">" << endl; writeDotFile(fileName,s->relPath(),s->context()); m_t << "</div>" << endl; forceStartParagraph(s); if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096); baseName.sprintf("%s%d", (Config_getString("HTML_OUTPUT")+"/inline_mscgraph_").data(), mscindex++ ); QFile file(baseName+".msc"); if (!file.open(IO_WriteOnly)) { err("Could not open file %s.msc for writing\n",baseName.data()); } QCString text = "msc {"; text+=s->text(); text+="}"; file.writeBlock( text, text.length() ); file.close(); forceEndParagraph(s); m_t << "<div align=\"center\">" << endl; writeMscFile(baseName+".msc",s->relPath(),s->context()); m_t << "</div>" << endl; forceStartParagraph(s); if (Config_getBool("DOT_CLEANUP")) file.remove(); } break; } }
void HtmlDocVisitor::visit(DocStyleChange *s) { if (m_hide) return; switch (s->style()) { case DocStyleChange::Bold: if (s->enable()) m_t << "<b" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</b>"; break; case DocStyleChange::Italic: if (s->enable()) m_t << "<em" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</em>"; break; case DocStyleChange::Code: if (s->enable()) m_t << "<code" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</code>"; break; case DocStyleChange::Subscript: if (s->enable()) m_t << "<sub" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</sub>"; break; case DocStyleChange::Superscript: if (s->enable()) m_t << "<sup" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</sup>"; break; case DocStyleChange::Center: if (s->enable()) { forceEndParagraph(s); m_t << "<center" << htmlAttribsToString(s->attribs()) << ">"; } else { m_t << "</center>"; forceStartParagraph(s); } break; case DocStyleChange::Small: if (s->enable()) m_t << "<small" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</small>"; break; case DocStyleChange::Preformatted: if (s->enable()) { forceEndParagraph(s); m_t << "<pre" << htmlAttribsToString(s->attribs()) << ">"; m_insidePre=TRUE; } else { m_insidePre=FALSE; m_t << "</pre>"; forceStartParagraph(s); } break; case DocStyleChange::Div: if (s->enable()) { forceEndParagraph(s); m_t << "<div" << htmlAttribsToString(s->attribs()) << ">"; } else { m_t << "</div>"; forceStartParagraph(s); } break; case DocStyleChange::Span: if (s->enable()) m_t << "<span" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</span>"; break; } }
void HtmlDocVisitor::visitPre(DocHtmlDescList *dl) { if (m_hide) return; forceEndParagraph(dl); m_t << "<dl" << htmlAttribsToString(dl->attribs()) << ">\n"; }