Skip to main content

The HtmlDocVisitor Class Reference

Concrete visitor implementation for HTML output. More...

Declaration

class HtmlDocVisitor { ... }

Included Headers

Base class

classDocVisitor

Helper base class for functionality shared by all visitors. More...

Public Constructors Index

HtmlDocVisitor (TextStream &t, OutputCodeList &ci, const Definition *ctx, const QCString &fn=QCString())

Public Operators Index

voidoperator() (const DocWord &)
voidoperator() (const DocLinkedWord &)
voidoperator() (const DocWhiteSpace &)
voidoperator() (const DocSymbol &)
voidoperator() (const DocEmoji &)
voidoperator() (const DocURL &)
voidoperator() (const DocLineBreak &)
voidoperator() (const DocHorRuler &)
voidoperator() (const DocStyleChange &)
voidoperator() (const DocVerbatim &)
voidoperator() (const DocAnchor &)
voidoperator() (const DocInclude &)
voidoperator() (const DocIncOperator &)
voidoperator() (const DocFormula &)
voidoperator() (const DocIndexEntry &)
voidoperator() (const DocSimpleSectSep &)
voidoperator() (const DocCite &)
voidoperator() (const DocSeparator &)
voidoperator() (const DocAutoList &)
voidoperator() (const DocAutoListItem &)
voidoperator() (const DocPara &)
voidoperator() (const DocRoot &)
voidoperator() (const DocSimpleSect &)
voidoperator() (const DocTitle &)
voidoperator() (const DocSimpleList &)
voidoperator() (const DocSimpleListItem &)
voidoperator() (const DocSection &)
voidoperator() (const DocHtmlList &)
voidoperator() (const DocHtmlListItem &)
voidoperator() (const DocHtmlDescList &)
voidoperator() (const DocHtmlDescTitle &)
voidoperator() (const DocHtmlDescData &)
voidoperator() (const DocHtmlTable &)
voidoperator() (const DocHtmlRow &)
voidoperator() (const DocHtmlCell &)
voidoperator() (const DocHtmlCaption &)
voidoperator() (const DocInternal &)
voidoperator() (const DocHRef &)
voidoperator() (const DocHtmlSummary &)
voidoperator() (const DocHtmlDetails &)
voidoperator() (const DocHtmlHeader &)
voidoperator() (const DocImage &)
voidoperator() (const DocDotFile &)
voidoperator() (const DocMscFile &)
voidoperator() (const DocDiaFile &)
voidoperator() (const DocPlantUmlFile &)
voidoperator() (const DocLink &)
voidoperator() (const DocRef &)
voidoperator() (const DocSecRefItem &)
voidoperator() (const DocSecRefList &)
voidoperator() (const DocParamSect &)
voidoperator() (const DocParamList &)
voidoperator() (const DocXRefItem &)
voidoperator() (const DocInternalRef &)
voidoperator() (const DocText &)
voidoperator() (const DocHtmlBlockQuote &)
voidoperator() (const DocVhdlFlow &)
voidoperator() (const DocParBlock &)

Public Member Functions Index

template <class Node>
voidforceEndParagraph (const Node &n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph. More...

template <class Node>
voidforceStartParagraph (const Node &n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph. More...

Private Member Functions Index

template <class T>
voidvisitChildren (const T &t)
template <class T>
voidvisitCaption (TextStream &t, const T &n)
voidwriteObfuscatedMailAddress (const QCString &url)
voidfilter (const QCString &str, const bool retainNewline=false)
QCStringfilterQuotedCdataAttr (const QCString &str)

Escape basic entities to produce a valid CDATA attribute value, assume that the outer quoting will be using the double quote ". More...

voidstartLink (const QCString &ref, const QCString &file, const QCString &relPath, const QCString &anchor, const QCString &tooltip="")
voidendLink ()
voidwriteDotFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
voidwriteMscFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
voidwriteDiaFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
voidwritePlantUMLFile (const QCString &fileName, const QCString &relPath, const QCString &context, const QCString &srcFile, int srcLine)
template <class DocNode>
voidforceEndParagraph (const DocNode &n)
template <class DocNode>
voidforceStartParagraph (const DocNode &n)

Private Member Attributes Index

TextStream &m_t
OutputCodeList &m_ci
boolm_insidePre = false
boolm_hide = false
boolm_insideTitle = false
const Definition *m_ctx
QCStringm_fileName
QCStringm_langExt

Description

Concrete visitor implementation for HTML output.

Definition at line 29 of file htmldocvisitor.h.

Public Constructors

HtmlDocVisitor()

HtmlDocVisitor::HtmlDocVisitor (TextStream & t, OutputCodeList & ci, const Definition * ctx, const QCString & fn=QCString())

Declaration at line 32 of file htmldocvisitor.h, definition at line 255 of file htmldocvisitor.cpp.

256 const Definition *ctx,const QCString &fn)
257 : m_t(t), m_ci(ci), m_ctx(ctx), m_fileName(fn)
258{
259 if (ctx) m_langExt=ctx->getDefFileExtension();
260}

References Definition::getDefFileExtension, m_ci, m_ctx, m_fileName, m_langExt and m_t.

Public Operators

operator()()

void HtmlDocVisitor::operator() (const DocWord & w)

Declaration at line 38 of file htmldocvisitor.h, definition at line 280 of file htmldocvisitor.cpp.

281{
282 if (m_hide) return;
283 filter(w.word());
284}

References filter, m_hide and DocWord::word.

operator()()

void HtmlDocVisitor::operator() (const DocLinkedWord & w)

Declaration at line 39 of file htmldocvisitor.h, definition at line 286 of file htmldocvisitor.cpp.

287{
288 if (m_hide) return;
289 //printf("linked word: %s\n",qPrint(w.word()));
290 startLink(w.ref(),w.file(),w.relPath(),w.anchor(),w.tooltip());
291 filter(w.word());
292 endLink();
293}

References DocLinkedWord::anchor, endLink, DocLinkedWord::file, filter, m_hide, DocLinkedWord::ref, DocLinkedWord::relPath, startLink, DocLinkedWord::tooltip and DocLinkedWord::word.

operator()()

void HtmlDocVisitor::operator() (const DocWhiteSpace & w)

Declaration at line 40 of file htmldocvisitor.h, definition at line 295 of file htmldocvisitor.cpp.

296{
297 if (m_hide) return;
298 if (m_insidePre)
299 {
300 m_t << w.chars();
301 }
302 else
303 {
304 m_t << " ";
305 }
306}

References DocWhiteSpace::chars, m_hide, m_insidePre and m_t.

operator()()

void HtmlDocVisitor::operator() (const DocSymbol & s)

Declaration at line 41 of file htmldocvisitor.h, definition at line 308 of file htmldocvisitor.cpp.

309{
310 if (m_hide) return;
311 if (m_insideTitle &&
312 (s.symbol()==HtmlEntityMapper::Sym_Quot || s.symbol()==HtmlEntityMapper::Sym_quot)) // escape "'s inside title="..."
313 {
314 m_t << "&quot;";
315 }
316 else
317 {
318 const char *res = HtmlEntityMapper::instance().html(s.symbol());
319 if (res)
320 {
321 m_t << res;
322 }
323 else
324 {
325 err("HTML: non supported HTML-entity found: {}\n",
327 }
328 }
329}

References err, HtmlEntityMapper::html, HtmlEntityMapper::instance, m_hide, m_insideTitle, m_t, HtmlEntityMapper::Sym_Quot, HtmlEntityMapper::Sym_quot, DocSymbol::symbol and TRUE.

operator()()

void HtmlDocVisitor::operator() (const DocEmoji & s)

Declaration at line 42 of file htmldocvisitor.h, definition at line 331 of file htmldocvisitor.cpp.

332{
333 if (m_hide) return;
334 const char *res = EmojiEntityMapper::instance().unicode(s.index());
335 if (res)
336 {
337 m_t << "<span class=\"emoji\">" << res << "</span>";
338 }
339 else
340 {
341 m_t << s.name();
342 }
343}

References DocEmoji::index, EmojiEntityMapper::instance, m_hide, m_t, DocEmoji::name and EmojiEntityMapper::unicode.

operator()()

void HtmlDocVisitor::operator() (const DocURL & u)

Declaration at line 43 of file htmldocvisitor.h, definition at line 373 of file htmldocvisitor.cpp.

374{
375 if (m_hide) return;
376 if (u.isEmail()) // mail address
377 {
378 QCString url = u.url();
379 // obfuscate the mail address link
381 if (!Config_getBool(OBFUSCATE_EMAILS))
382 {
383 m_t << url;
384 }
385 else
386 {
387 const char *p = url.data();
388 // also obfuscate the address as shown on the web page
389 uint32_t size=5;
390 while (*p)
391 {
392 for (uint32_t j=0;j<size && *p;j++)
393 {
394 p = writeUTF8Char(m_t,p);
395 }
396 if (*p) m_t << "<span class=\"obfuscator\">.nosp@m.</span>";
397 if (size==5) size=4; else size=5;
398 }
399 }
400 m_t << "</a>";
401 }
402 else // web address
403 {
404 m_t << "<a href=\"";
405 filter(u.url());
406 m_t << "\">";
407 filter(u.url());
408 m_t << "</a>";
409 }
410}

References Config_getBool, QCString::data, filter, DocURL::isEmail, m_hide, m_t, DocURL::url, writeObfuscatedMailAddress and writeUTF8Char.

operator()()

void HtmlDocVisitor::operator() (const DocLineBreak & br)

Declaration at line 44 of file htmldocvisitor.h, definition at line 412 of file htmldocvisitor.cpp.

413{
414 if (m_hide) return;
415 m_t << "<br "<< br.attribs().toString() << " />\n";
416}

References DocLineBreak::attribs, m_hide, m_t and HtmlAttribList::toString.

operator()()

void HtmlDocVisitor::operator() (const DocHorRuler & hr)

Declaration at line 45 of file htmldocvisitor.h, definition at line 418 of file htmldocvisitor.cpp.

419{
420 if (m_hide) return;
422 m_t << "<hr "<< hr.attribs().toString() << " />\n";
424}

References DocHorRuler::attribs, forceEndParagraph, forceStartParagraph, m_hide, m_t and HtmlAttribList::toString.

operator()()

void HtmlDocVisitor::operator() (const DocStyleChange & s)

Declaration at line 46 of file htmldocvisitor.h, definition at line 426 of file htmldocvisitor.cpp.

427{
428 if (m_hide) return;
429 switch (s.style())
430 {
432 if (s.enable()) m_t << "<b" << s.attribs().toString() << ">"; else m_t << "</b>";
433 break;
435 if (s.enable()) m_t << "<s" << s.attribs().toString() << ">"; else m_t << "</s>";
436 break;
438 if (s.enable()) m_t << "<strike" << s.attribs().toString() << ">"; else m_t << "</strike>";
439 break;
441 if (s.enable()) m_t << "<del" << s.attribs().toString() << ">"; else m_t << "</del>";
442 break;
444 if (s.enable()) m_t << "<u" << s.attribs().toString() << ">"; else m_t << "</u>";
445 break;
447 if (s.enable()) m_t << "<ins" << s.attribs().toString() << ">"; else m_t << "</ins>";
448 break;
450 if (s.enable())
451 {
452 auto attribs = s.attribs();
453 if (s.tagName()=="a")
454 {
455 attribs.mergeAttribute("class","arg");
456 }
457 m_t << "<em" << attribs.toString() << ">";
458 }
459 else
460 {
461 m_t << "</em>";
462 }
463 break;
465 if (s.enable()) m_t << "<kbd" << s.attribs().toString() << ">"; else m_t << "</kbd>";
466 break;
468 if (s.enable())
469 {
470 m_t << "<span class=\"tt\"" << s.attribs().toString() << ">";
471 m_insidePre=true;
472 }
473 else
474 {
475 m_t << "</span>";
476 m_insidePre=false;
477 }
478 break;
480 if (s.enable())
481 {
482 auto attribs = s.attribs();
483 if (s.tagName()=="p")
484 {
485 attribs.mergeAttribute("class","param");
486 }
487 m_t << "<code" << attribs.toString() << ">";
488 m_insidePre=true;
489 }
490 else
491 {
492 m_insidePre=false;
493 m_t << "</code>";
494 }
495 break;
497 if (s.enable()) m_t << "<sub" << s.attribs().toString() << ">"; else m_t << "</sub>";
498 break;
500 if (s.enable()) m_t << "<sup" << s.attribs().toString() << ">"; else m_t << "</sup>";
501 break;
503 if (s.enable())
504 {
506 m_t << "<center" << s.attribs().toString() << ">";
507 }
508 else
509 {
510 m_t << "</center>";
512 }
513 break;
515 if (s.enable()) m_t << "<small" << s.attribs().toString() << ">"; else m_t << "</small>";
516 break;
518 if (s.enable()) m_t << "<cite" << s.attribs().toString() << ">"; else m_t << "</cite>";
519 break;
521 if (s.enable())
522 {
524 m_t << "<pre" << s.attribs().toString() << ">";
526 }
527 else
528 {
530 m_t << "</pre>";
532 }
533 break;
535 if (s.enable())
536 {
538 m_t << "<div" << s.attribs().toString() << ">";
539 }
540 else
541 {
542 m_t << "</div>";
544 }
545 break;
547 if (s.enable()) m_t << "<span" << s.attribs().toString() << ">"; else m_t << "</span>";
548 break;
549 }
550}

References DocStyleChange::attribs, DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Cite, DocStyleChange::Code, DocStyleChange::Del, DocStyleChange::Div, DocStyleChange::enable, FALSE, forceEndParagraph, forceStartParagraph, DocStyleChange::Ins, DocStyleChange::Italic, DocStyleChange::Kbd, m_hide, m_insidePre, m_t, DocStyleChange::Preformatted, DocStyleChange::S, DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Strike, DocStyleChange::style, DocStyleChange::Subscript, DocStyleChange::Superscript, DocStyleChange::tagName, HtmlAttribList::toString, TRUE, DocStyleChange::Typewriter and DocStyleChange::Underline.

operator()()

void HtmlDocVisitor::operator() (const DocVerbatim & s)

Declaration at line 47 of file htmldocvisitor.h, definition at line 554 of file htmldocvisitor.cpp.

555{
556 if (m_hide) return;
557 QCString lang = m_langExt;
558 if (!s.language().isEmpty()) // explicit language setting
559 {
560 lang = s.language();
561 }
562 SrcLangExt langExt = getLanguageFromCodeLang(lang);
563 switch(s.type())
564 {
567 m_ci.startCodeFragment("DoxyCode");
569 s.context(),
570 s.text(),
571 langExt,
572 Config_getBool(STRIP_CODE_COMMENTS),
573 s.isExample(),
574 s.exampleFile(),
575 nullptr, // fileDef
576 -1, // startLine
577 -1, // endLine
578 true, // inlineFragment
579 nullptr, // memberDef
580 true, // show line numbers
581 m_ctx // search context
582 );
583 m_ci.endCodeFragment("DoxyCode");
585 break;
588 m_t << "<pre class=\"fragment\">";
589 filter(s.text());
590 m_t << "</pre>";
592 break;
594 filter(s.text(), true);
595 break;
597 m_t << "<code class=\"JavaDocCode\">";
598 filter(s.text(), true);
599 m_t << "</code>";
600 break;
602 {
603 if (s.isBlock()) forceEndParagraph(s);
604 m_t << s.text();
605 if (s.isBlock()) forceStartParagraph(s);
606 }
607 break;
613 /* nothing */
614 break;
615
617 {
618 static int dotindex = 1;
619 QCString fileName(4096, QCString::ExplicitSize);
620
622 fileName.sprintf("%s%d%s",
623 qPrint(Config_getString(HTML_OUTPUT)+"/inline_dotgraph_"),
624 dotindex++,
625 ".dot"
626 );
627 std::ofstream file = Portable::openOutputStream(fileName);
628 if (!file.is_open())
629 {
630 err("Could not open file {} for writing\n",fileName);
631 }
632 else
633 {
634 QCString stext = s.text();
635 file.write( stext.data(), stext.length() );
636 file.close();
637
638 m_t << "<div class=\"dotgraph\">\n";
639 writeDotFile(fileName,s.relPath(),s.context(),s.srcFile(),s.srcLine());
640 visitCaption(m_t, s);
641 m_t << "</div>\n";
642
643 if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str());
644 }
646 }
647 break;
649 {
651
652 static int mscindex = 1;
653 QCString baseName(4096, QCString::ExplicitSize);
654
655 baseName.sprintf("%s%d",
656 qPrint(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_"),
657 mscindex++
658 );
659 std::ofstream file = Portable::openOutputStream(baseName.str()+".msc");
660 if (!file.is_open())
661 {
662 err("Could not open file {}.msc for writing\n",baseName);
663 }
664 else
665 {
666 QCString text = "msc {";
667 text+=s.text();
668 text+="}";
669
670 file.write( text.data(), text.length() );
671 file.close();
672
673 m_t << "<div class=\"mscgraph\">\n";
674 writeMscFile(baseName+".msc",s.relPath(),s.context(),s.srcFile(),s.srcLine());
675 visitCaption(m_t, s);
676 m_t << "</div>\n";
677
678 if (Config_getBool(DOT_CLEANUP)) Dir().remove(baseName.str()+".msc");
679 }
681 }
682 break;
684 {
686 QCString htmlOutput = Config_getString(HTML_OUTPUT);
688 PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP
689 if (imgExt=="svg")
690 {
692 }
694 htmlOutput,s.exampleFile(),
695 s.text(),format,s.engine(),s.srcFile(),s.srcLine(),true);
696 m_t << "<div class=\"plantumlgraph\">\n";
697 writePlantUMLFile(baseName,s.relPath(),s.context(),s.srcFile(),s.srcLine());
698 visitCaption(m_t, s);
699 m_t << "</div>\n";
701 }
702 break;
703 }
704}

References DocVerbatim::Code, Config_getBool, Config_getString, DocVerbatim::context, QCString::data, DocVerbatim::DocbookOnly, DocVerbatim::Dot, DocVerbatim::engine, err, DocVerbatim::exampleFile, QCString::ExplicitSize, filter, forceEndParagraph, forceStartParagraph, DocVisitor::getCodeParser, getDotImageExtension, getLanguageFromCodeLang, DocVerbatim::HtmlOnly, PlantumlManager::instance, DocVerbatim::isBlock, QCString::isEmpty, DocVerbatim::isExample, DocVerbatim::JavaDocCode, DocVerbatim::JavaDocLiteral, DocVerbatim::language, DocVerbatim::LatexOnly, QCString::length, m_ci, m_ctx, m_hide, m_langExt, m_t, DocVerbatim::ManOnly, DocVerbatim::Msc, Portable::openOutputStream, CodeParserInterface::parseCode, DocVerbatim::PlantUML, PlantumlManager::PUML_BITMAP, PlantumlManager::PUML_SVG, qPrint, DocVerbatim::relPath, Dir::remove, DocVerbatim::RtfOnly, QCString::sprintf, DocVerbatim::srcFile, DocVerbatim::srcLine, QCString::str, DocVerbatim::text, DocVerbatim::type, DocVerbatim::Verbatim, visitCaption, writeDotFile, writeMscFile, writePlantUMLFile, PlantumlManager::writePlantUMLSource and DocVerbatim::XmlOnly.

operator()()

void HtmlDocVisitor::operator() (const DocAnchor & anc)

Declaration at line 48 of file htmldocvisitor.h, definition at line 706 of file htmldocvisitor.cpp.

707{
708 if (m_hide) return;
709 m_t << "<a class=\"anchor\" id=\"" << anc.anchor() << "\"" << anc.attribs().toString() << "></a>";
710}

References DocAnchor::anchor, DocAnchor::attribs, m_hide, m_t and HtmlAttribList::toString.

operator()()

void HtmlDocVisitor::operator() (const DocInclude & inc)

Declaration at line 49 of file htmldocvisitor.h, definition at line 712 of file htmldocvisitor.cpp.

713{
714 if (m_hide) return;
716 switch(inc.type())
717 {
720 m_ci.startCodeFragment("DoxyCode");
722 inc.context(),
723 inc.text(),
724 langExt,
726 inc.isExample(),
727 inc.exampleFile(),
728 nullptr, // fileDef
729 -1, // startLine
730 -1, // endLine
731 TRUE, // inlineFragment
732 nullptr, // memberDef
733 FALSE, // show line numbers
734 m_ctx // search context
735 );
736 m_ci.endCodeFragment("DoxyCode");
738 break;
740 {
742 m_ci.startCodeFragment("DoxyCode");
743 FileInfo cfi( inc.file().str() );
744 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
746 inc.context(),
747 inc.text(),
748 langExt,
750 inc.isExample(),
751 inc.exampleFile(),
752 fd.get(), // fileDef,
753 -1, // start line
754 -1, // end line
755 true, // inline fragment
756 nullptr, // memberDef
757 true, // show line numbers
758 m_ctx // search context
759 );
760 m_ci.endCodeFragment("DoxyCode");
762 }
763 break;
771 break;
773 {
774 if (inc.isBlock()) forceEndParagraph(inc);
775 m_t << inc.text();
776 if (inc.isBlock()) forceStartParagraph(inc);
777 }
778 break;
781 m_t << "<pre class=\"fragment\">";
782 filter(inc.text());
783 m_t << "</pre>";
785 break;
789 m_ci.startCodeFragment("DoxyCode");
791 inc.file(),
792 inc.blockId(),
793 inc.context(),
795 inc.trimLeft(),
797 );
798 m_ci.endCodeFragment("DoxyCode");
800 break;
801 }
802}

References DocInclude::blockId, DocInclude::context, createFileDef, FileInfo::dirPath, DocInclude::DocbookInclude, DocInclude::DontInclude, DocInclude::DontIncWithLines, DocInclude::exampleFile, DocInclude::extension, FALSE, DocInclude::file, FileInfo::fileName, filter, forceEndParagraph, forceStartParagraph, DocVisitor::getCodeParser, getLanguageFromFileName, DocInclude::HtmlInclude, DocInclude::Include, DocInclude::IncWithLines, CodeFragmentManager::instance, DocInclude::isBlock, DocInclude::isExample, DocInclude::LatexInclude, m_ci, m_ctx, m_hide, m_t, DocInclude::ManInclude, CodeParserInterface::parseCode, CodeFragmentManager::parseCodeFragment, DocInclude::RtfInclude, DocInclude::Snippet, DocInclude::SnippetWithLines, QCString::str, DocInclude::stripCodeComments, DocInclude::text, DocInclude::trimLeft, TRUE, DocInclude::type, DocInclude::VerbInclude and DocInclude::XmlInclude.

operator()()

void HtmlDocVisitor::operator() (const DocIncOperator & op)

Declaration at line 50 of file htmldocvisitor.h, definition at line 804 of file htmldocvisitor.cpp.

805{
806 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
807 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
808 if (op.isFirst())
809 {
811 if (!m_hide) m_ci.startCodeFragment("DoxyCode");
814 }
816 if (locLangExt.isEmpty()) locLangExt = m_langExt;
817 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
818 if (op.type()!=DocIncOperator::Skip)
819 {
820 m_hide = popHidden();
821 if (!m_hide)
822 {
823 std::unique_ptr<FileDef> fd;
824 if (!op.includeFileName().isEmpty())
825 {
826 FileInfo cfi( op.includeFileName().str() );
827 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
828 }
829 getCodeParser(locLangExt).parseCode(
830 m_ci,
831 op.context(),
832 op.text(),
833 langExt,
835 op.isExample(),
836 op.exampleFile(),
837 fd.get(), // fileDef
838 op.line(), // startLine
839 -1, // endLine
840 true, // inline fragment
841 nullptr, // memberDef
842 op.showLineNo(), // show line numbers
843 m_ctx // search context
844 );
845 }
848 }
849 if (op.isLast())
850 {
851 m_hide = popHidden();
852 if (!m_hide) m_ci.endCodeFragment("DoxyCode");
854 }
855 else
856 {
857 if (!m_hide) m_t << "\n";
858 }
859}

References DocIncOperator::context, createFileDef, FileInfo::dirPath, DocIncOperator::exampleFile, FileInfo::fileName, forceEndParagraph, forceStartParagraph, DocVisitor::getCodeParser, getFileNameExtension, getLanguageFromFileName, DocIncOperator::includeFileName, QCString::isEmpty, DocIncOperator::isExample, DocIncOperator::isFirst, DocIncOperator::isLast, DocIncOperator::line, m_ci, m_ctx, m_hide, m_langExt, m_t, CodeParserInterface::parseCode, DocVisitor::popHidden, DocVisitor::pushHidden, DocIncOperator::showLineNo, DocIncOperator::Skip, QCString::str, DocIncOperator::stripCodeComments, DocIncOperator::text, TRUE and DocIncOperator::type.

operator()()

void HtmlDocVisitor::operator() (const DocFormula & f)

Declaration at line 51 of file htmldocvisitor.h, definition at line 861 of file htmldocvisitor.cpp.

862{
863 if (m_hide) return;
864 bool bDisplay = !f.isInline();
865 if (bDisplay)
866 {
868 m_t << "<p class=\"formulaDsp\">\n";
869 }
870
871 if (Config_getBool(USE_MATHJAX))
872 {
873 QCString text = f.text();
874 bool closeInline = FALSE;
875 if (!bDisplay && !text.isEmpty() && text.at(0)=='$' &&
876 text.at(text.length()-1)=='$')
877 {
878 closeInline=TRUE;
879 text = text.mid(1,text.length()-2);
880 m_t << "\\(";
881 }
882 else if (!bDisplay && !text.isEmpty())
883 {
884 closeInline=TRUE;
885 m_t << "\\(";
886 }
887 m_t << convertToHtml(text);
888 if (closeInline)
889 {
890 m_t << "\\)";
891 }
892 }
893 else
894 {
895 const Formula *formula = FormulaManager::instance().findFormula(f.id());
896
897 enum class ImageType { Light, Dark };
898 enum class Visibility { Always, Dark, Light, AutoDark, AutoLight };
899 auto writeFormula = [&](ImageType imgType,Visibility visibility) -> QCString {
900 // see https://chipcullen.com/how-to-have-dark-mode-image-that-works-with-user-choice for the design idea
901 TextStream t;
902 QCString extension = Config_getEnum(HTML_FORMULA_FORMAT)==HTML_FORMULA_FORMAT_t::svg ? ".svg":".png" ;
903 if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight)
904 {
905 t << "<picture>";
906 t << "<source srcset=\"" << f.relPath() << f.name();
907 if (visibility==Visibility::AutoDark)
908 {
909 t << extension;
910 t << "\" media=\"(prefers-color-scheme: light)\"";
911 }
912 else // AutoLight
913 {
914 t << "_dark";
915 t << extension;
916 t << "\" media=\"(prefers-color-scheme: dark)\"";
917 }
918 t << "/>";
919 }
920 t << "<img class=\"formula";
921 t << (bDisplay ? "Dsp" : "Inl");
922 if (visibility==Visibility::Light) t << " light-mode-visible";
923 else if (visibility==Visibility::Dark) t << " dark-mode-visible";
924 t << "\" alt=\"" << filterQuotedCdataAttr(f.text()) << "\"" << " src=\"" << f.relPath() << f.name();
925 if (imgType==ImageType::Dark) t << "_dark";
926 t << extension;
927 if (formula && formula->width()!=-1)
928 {
929 t << "\" width=\"";
930 t << formula->width();
931 }
932 if (formula && formula->height()!=-1)
933 {
934 t << "\" height=\"";
935 t << formula->height();
936 }
937 t << "\"/>";
938 if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight)
939 {
940 t << "</picture>";
941 }
942 return QCString(t.str());
943 };
944
945 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
946 switch(colorStyle)
947 {
948 case HTML_COLORSTYLE_t::LIGHT:
949 m_t << writeFormula(ImageType::Light,Visibility::Always);
950 break;
951 case HTML_COLORSTYLE_t::DARK:
952 m_t << writeFormula(ImageType::Dark, Visibility::Always);
953 break;
954 case HTML_COLORSTYLE_t::AUTO_LIGHT:
955 m_t << writeFormula(ImageType::Light, Visibility::AutoLight);
956 break;
957 case HTML_COLORSTYLE_t::AUTO_DARK:
958 m_t << writeFormula(ImageType::Dark, Visibility::AutoDark);
959 break;
960 case HTML_COLORSTYLE_t::TOGGLE:
961 // write the image twice and use javascript (darkmode_toggle.js) to show only one of them
962 m_t << writeFormula(ImageType::Light,Visibility::Light);
963 m_t << writeFormula(ImageType::Dark, Visibility::Dark);
964 break;
965 }
966 }
967 if (bDisplay)
968 {
969 m_t << "\n</p>\n";
971 }
972}

References QCString::at, Config_getBool, Config_getEnum, convertToHtml, FALSE, filterQuotedCdataAttr, FormulaManager::findFormula, forceEndParagraph, forceStartParagraph, Formula::height, DocFormula::id, FormulaManager::instance, QCString::isEmpty, DocFormula::isInline, QCString::length, m_hide, m_t, QCString::mid, DocFormula::name, DocFormula::relPath, TextStream::str, DocFormula::text, TRUE and Formula::width.

operator()()

void HtmlDocVisitor::operator() (const DocIndexEntry & e)

Declaration at line 52 of file htmldocvisitor.h, definition at line 974 of file htmldocvisitor.cpp.

975{
977 if (e.member())
978 {
979 anchor.prepend(e.member()->anchor()+"_");
980 }
981 m_t << "<a id=\"" << anchor << "\" name=\"" << anchor << "\"></a>";
982 //printf("*** DocIndexEntry: word='%s' scope='%s' member='%s'\n",
983 // qPrint(e.entry()),
984 // e.scope() ? qPrint(e.scope()->name()) : "<null>",
985 // e.member() ? qPrint(e.member()->name()) : "<null>"
986 // );
987 Doxygen::indexList->addIndexItem(e.scope(),e.member(),anchor,e.entry());
988}

References Definition::anchor, convertIndexWordToAnchor, DocIndexEntry::entry, Doxygen::indexList, m_t, DocIndexEntry::member, QCString::prepend and DocIndexEntry::scope.

operator()()

void HtmlDocVisitor::operator() (const DocSimpleSectSep &)

Declaration at line 53 of file htmldocvisitor.h, definition at line 990 of file htmldocvisitor.cpp.

991{
992 m_t << "</dd>\n";
993 m_t << "<dd>\n";
994}

Reference m_t.

operator()()

void HtmlDocVisitor::operator() (const DocCite & cite)

Declaration at line 54 of file htmldocvisitor.h, definition at line 996 of file htmldocvisitor.cpp.

997{
998 if (m_hide) return;
999 auto opt = cite.option();
1000 if (!cite.file().isEmpty())
1001 {
1002 if (!opt.noCite()) startLink(cite.ref(),cite.file(),cite.relPath(),cite.anchor());
1003 filter(cite.getText());
1004 if (!opt.noCite()) endLink();
1005 }
1006 else
1007 {
1008 m_t << "<b>";
1009 if (!opt.noPar()) filter("[");
1010 filter(cite.target());
1011 if (!opt.noPar()) filter("]");
1012 m_t << "</b>";
1013 }
1014}

References DocCite::anchor, endLink, DocCite::file, filter, DocCite::getText, QCString::isEmpty, m_hide, m_t, DocCite::option, DocCite::ref, DocCite::relPath, startLink and DocCite::target.

operator()()

void HtmlDocVisitor::operator() (const DocSeparator & s)

Declaration at line 55 of file htmldocvisitor.h, definition at line 1960 of file htmldocvisitor.cpp.

1961{
1962 if (m_hide) return;
1963 m_t << "&#160;" << s.chars() << "&#160;";
1964}

References DocSeparator::chars, m_hide and m_t.

operator()()

void HtmlDocVisitor::operator() (const DocAutoList & l)

Declaration at line 61 of file htmldocvisitor.h, definition at line 1022 of file htmldocvisitor.cpp.

1023{
1024 //printf("DocAutoList::visitPre\n");
1025 if (m_hide) return;
1027 if (l.isEnumList())
1028 {
1029 //
1030 // Do list type based on depth:
1031 // 1
1032 // a.
1033 // i.
1034 // A.
1035 // 1 (repeat)...
1036 //
1037 m_t << "<ol type=\"" << g_types[l.depth() % NUM_HTML_LIST_TYPES] << "\">";
1038 }
1039 else
1040 {
1041 if (l.isCheckedList())
1042 {
1043 m_t << "<ul class=\"check\">";
1044 }
1045 else
1046 {
1047 m_t << "<ul>";
1048 }
1049 }
1050 if (!l.isPreformatted()) m_t << "\n";
1051 visitChildren(l);
1052 if (l.isEnumList())
1053 {
1054 m_t << "</ol>";
1055 }
1056 else
1057 {
1058 m_t << "</ul>";
1059 }
1060 if (!l.isPreformatted()) m_t << "\n";
1062}

References DocAutoList::depth, forceEndParagraph, forceStartParagraph, g_types, DocAutoList::isCheckedList, DocAutoList::isEnumList, DocNode::isPreformatted, m_hide, m_t, NUM_HTML_LIST_TYPES and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocAutoListItem & li)

Declaration at line 62 of file htmldocvisitor.h, definition at line 1064 of file htmldocvisitor.cpp.

1065{
1066 if (m_hide) return;
1067 switch (li.itemNumber())
1068 {
1069 case DocAutoList::Unchecked: // unchecked
1070 m_t << "<li class=\"unchecked\">";
1071 break;
1072 case DocAutoList::Checked_x: // checked with x
1073 case DocAutoList::Checked_X: // checked with X
1074 m_t << "<li class=\"checked\">";
1075 break;
1076 default:
1077 m_t << "<li>";
1078 break;
1079 }
1080 visitChildren(li);
1081 m_t << "</li>";
1082 if (!li.isPreformatted()) m_t << "\n";
1083}

References DocAutoList::Checked_X, DocAutoList::Checked_x, DocNode::isPreformatted, DocAutoListItem::itemNumber, m_hide, m_t, DocAutoList::Unchecked and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocPara & p)

Declaration at line 63 of file htmldocvisitor.h, definition at line 1292 of file htmldocvisitor.cpp.

1293{
1294 if (m_hide) return;
1295
1296 //printf("> DocPara\n");
1297 //dumpDocNodeList(p.children());
1298
1299 bool needsTag = determineIfNeedsTag(p);
1300 //printf(" needsTag=%d\n",needsTag);
1301 bool needsTagBefore = needsTag;
1302 bool needsTagAfter = needsTag;
1303
1304 // if the first element of a paragraph is something that should be outside of
1305 // the paragraph (<ul>,<dl>,<table>,..) then that will already started the
1306 // paragraph and we don't need to do it here
1307 if (!p.children().empty())
1308 {
1309 auto it = std::find_if(std::begin(p.children()),std::end(p.children()),
1310 [](const auto &node) { return !isInvisibleNode(node); });
1311 if (it!=std::end(p.children()))
1312 {
1313 const DocNodeVariant &n = *it;
1315 {
1316 needsTagBefore = FALSE;
1317 }
1318 }
1319 }
1320
1321 // check if this paragraph is the first or last or intermediate child of a <li> or <dd>.
1322 // this allows us to mark the tag with a special class so we can
1323 // fix the otherwise ugly spacing.
1324 bool isFirst = false;
1325 bool isLast = false;
1326 contexts_t t = getParagraphContext(p,isFirst,isLast);
1327 //printf("startPara first=%d last=%d\n",isFirst,isLast);
1328 if (isFirst && isLast) needsTagBefore=FALSE;
1329
1330 //printf(" needsTagBefore=%d\n",needsTagBefore);
1331 // write the paragraph tag (if needed)
1332 if (needsTagBefore)
1333 {
1334 if (contexts(t))
1335 m_t << "<p class=\"" << contexts(t) << "\"" << p.attribs().toString() << ">";
1336 else
1337 m_t << "<p" << p.attribs().toString() << ">";
1338 }
1339
1340 visitChildren(p);
1341
1342 // if the last element of a paragraph is something that should be outside of
1343 // the paragraph (<ul>,<dl>,<table>) then that will already have ended the
1344 // paragraph and we don't need to do it here
1345 if (!p.children().empty())
1346 {
1347 auto it = std::prev(std::end(p.children()));
1348 for (;;)
1349 {
1350 const DocNodeVariant &n = *it;
1351 if (!isInvisibleNode(n))
1352 {
1354 {
1355 needsTagAfter = FALSE;
1356 }
1357 // stop searching if we found a node that is visible
1358 break;
1359 }
1360 if (it==std::begin(p.children()))
1361 {
1362 // stop searching if we are at the beginning of the list
1363 break;
1364 }
1365 else
1366 {
1367 --it;
1368 }
1369 }
1370 }
1371
1372 //printf("endPara first=%d last=%d\n",isFirst,isLast);
1373 if (isFirst && isLast) needsTagAfter=FALSE;
1374
1375 //printf(" needsTagAfter=%d\n",needsTagAfter);
1376 if (needsTagAfter) m_t << "</p>\n";
1377 //printf("< DocPara\n");
1378}

References DocPara::attribs, DocCompoundNode::children, contexts, determineIfNeedsTag, GrowVector< T >::empty, FALSE, getParagraphContext, isInvisibleNode, m_hide, m_t, mustBeOutsideParagraph, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocRoot & r)

Declaration at line 64 of file htmldocvisitor.h, definition at line 1380 of file htmldocvisitor.cpp.

1381{
1382 //printf("> DocRoot\n");
1383 //dumpDocNodeList(r.children());
1384 visitChildren(r);
1385 //printf("< DocRoot\n");
1386}

Reference visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocSimpleSect & s)

Declaration at line 65 of file htmldocvisitor.h, definition at line 1388 of file htmldocvisitor.cpp.

1389{
1390 if (m_hide) return;
1392 m_t << "<dl class=\"section " << s.typeString() << "\"><dt>";
1393 switch(s.type())
1394 {
1396 m_t << theTranslator->trSeeAlso(); break;
1398 m_t << theTranslator->trReturns(); break;
1400 m_t << theTranslator->trAuthor(TRUE,TRUE); break;
1402 m_t << theTranslator->trAuthor(TRUE,FALSE); break;
1404 m_t << theTranslator->trVersion(); break;
1406 m_t << theTranslator->trSince(); break;
1408 m_t << theTranslator->trDate(); break;
1410 m_t << theTranslator->trNote(); break;
1412 m_t << theTranslator->trWarning(); break;
1414 m_t << theTranslator->trPrecondition(); break;
1416 m_t << theTranslator->trPostcondition(); break;
1418 m_t << theTranslator->trCopyright(); break;
1420 m_t << theTranslator->trInvariant(); break;
1422 m_t << theTranslator->trRemarks(); break;
1424 m_t << theTranslator->trAttention(); break;
1426 m_t << theTranslator->trImportant(); break;
1427 case DocSimpleSect::User: break;
1428 case DocSimpleSect::Rcs: break;
1429 case DocSimpleSect::Unknown: break;
1430 }
1431
1432 if (s.title())
1433 {
1434 std::visit(*this,*s.title());
1435 }
1436 m_t << "</dt><dd>";
1437 visitChildren(s);
1438 m_t << "</dd></dl>\n";
1440}

References DocSimpleSect::Attention, DocSimpleSect::Author, DocSimpleSect::Authors, DocSimpleSect::Copyright, DocSimpleSect::Date, FALSE, forceEndParagraph, forceStartParagraph, DocSimpleSect::Important, DocSimpleSect::Invar, m_hide, m_t, DocSimpleSect::Note, DocSimpleSect::Post, DocSimpleSect::Pre, DocSimpleSect::Rcs, DocSimpleSect::Remark, DocSimpleSect::Return, DocSimpleSect::See, DocSimpleSect::Since, theTranslator, DocSimpleSect::title, TRUE, DocSimpleSect::type, DocSimpleSect::typeString, DocSimpleSect::Unknown, DocSimpleSect::User, DocSimpleSect::Version, visitChildren and DocSimpleSect::Warning.

operator()()

void HtmlDocVisitor::operator() (const DocTitle & t)

Declaration at line 66 of file htmldocvisitor.h, definition at line 1442 of file htmldocvisitor.cpp.

1443{
1444 if (m_hide) return;
1445 visitChildren(t);
1446}

References m_hide and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocSimpleList & sl)

Declaration at line 67 of file htmldocvisitor.h, definition at line 1448 of file htmldocvisitor.cpp.

1449{
1450 if (m_hide) return;
1452 m_t << "<ul>";
1453 if (!sl.isPreformatted()) m_t << "\n";
1454 visitChildren(sl);
1455 m_t << "</ul>";
1456 if (!sl.isPreformatted()) m_t << "\n";
1458}

References forceEndParagraph, forceStartParagraph, DocNode::isPreformatted, m_hide, m_t and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocSimpleListItem & li)

Declaration at line 68 of file htmldocvisitor.h, definition at line 1460 of file htmldocvisitor.cpp.

1461{
1462 if (m_hide) return;
1463 m_t << "<li>";
1464 if (li.paragraph())
1465 {
1466 visit(*this,*li.paragraph());
1467 }
1468 m_t << "</li>";
1469 if (!li.isPreformatted()) m_t << "\n";
1470}

References DocNode::isPreformatted, m_hide, m_t and DocSimpleListItem::paragraph.

operator()()

void HtmlDocVisitor::operator() (const DocSection & s)

Declaration at line 69 of file htmldocvisitor.h, definition at line 1472 of file htmldocvisitor.cpp.

1473{
1474 if (m_hide) return;
1476 m_t << "<h" << s.level() << " class=\"doxsection\">";
1477 m_t << "<a class=\"anchor\" id=\"" << s.anchor();
1478 m_t << "\"></a>\n";
1479 if (s.title())
1480 {
1481 std::visit(*this,*s.title());
1482 }
1483 m_t << "</h" << s.level() << ">\n";
1484 visitChildren(s);
1486}

References DocSection::anchor, forceEndParagraph, forceStartParagraph, DocSection::level, m_hide, m_t, DocSection::title and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlList & s)

Declaration at line 70 of file htmldocvisitor.h, definition at line 1488 of file htmldocvisitor.cpp.

1489{
1490 if (m_hide) return;
1492 if (s.type()==DocHtmlList::Ordered)
1493 {
1494 m_t << "<ol" << s.attribs().toString();
1495 }
1496 else
1497 {
1498 m_t << "<ul" << s.attribs().toString();
1499 }
1500 m_t << ">\n";
1501 visitChildren(s);
1502 if (s.type()==DocHtmlList::Ordered)
1503 {
1504 m_t << "</ol>";
1505 }
1506 else
1507 {
1508 m_t << "</ul>";
1509 }
1510 if (!s.isPreformatted()) m_t << "\n";
1512}

References DocHtmlList::attribs, forceEndParagraph, forceStartParagraph, DocNode::isPreformatted, m_hide, m_t, DocHtmlList::Ordered, HtmlAttribList::toString, DocHtmlList::type and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlListItem & i)

Declaration at line 71 of file htmldocvisitor.h, definition at line 1514 of file htmldocvisitor.cpp.

1515{
1516 if (m_hide) return;
1517 m_t << "<li" << i.attribs().toString() << ">";
1518 if (!i.isPreformatted()) m_t << "\n";
1519 visitChildren(i);
1520 m_t << "</li>\n";
1521}

References DocHtmlListItem::attribs, DocNode::isPreformatted, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlDescList & dl)

Declaration at line 72 of file htmldocvisitor.h, definition at line 1523 of file htmldocvisitor.cpp.

1524{
1525 if (m_hide) return;
1527 m_t << "<dl" << dl.attribs().toString() << ">\n";
1528 visitChildren(dl);
1529 m_t << "</dl>\n";
1531}

References DocHtmlDescList::attribs, forceEndParagraph, forceStartParagraph, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlDescTitle & dt)

Declaration at line 73 of file htmldocvisitor.h, definition at line 1533 of file htmldocvisitor.cpp.

1534{
1535 if (m_hide) return;
1536 m_t << "<dt" << dt.attribs().toString() << ">";
1537 visitChildren(dt);
1538 m_t << "</dt>\n";
1539}

References DocHtmlDescTitle::attribs, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlDescData & dd)

Declaration at line 74 of file htmldocvisitor.h, definition at line 1541 of file htmldocvisitor.cpp.

1542{
1543 if (m_hide) return;
1544 m_t << "<dd" << dd.attribs().toString() << ">";
1545 visitChildren(dd);
1546 m_t << "</dd>\n";
1547}

References DocHtmlDescData::attribs, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlTable & t)

Declaration at line 75 of file htmldocvisitor.h, definition at line 1549 of file htmldocvisitor.cpp.

1550{
1551 if (m_hide) return;
1552
1554
1555 if (t.caption())
1556 {
1557 QCString anc = std::get<DocHtmlCaption>(*t.caption()).anchor();
1558 if (!anc.isEmpty())
1559 {
1560 m_t << "<a class=\"anchor\" id=\"" << anc << "\"></a>\n";
1561 }
1562 }
1563
1564 QCString attrs = t.attribs().toString();
1565 if (attrs.isEmpty())
1566 {
1567 m_t << "<table class=\"doxtable\">\n";
1568 }
1569 else
1570 {
1571 m_t << "<table" << t.attribs().toString() << ">\n";
1572 }
1573 if (t.caption())
1574 {
1575 std::visit(*this,*t.caption());
1576 }
1577 visitChildren(t);
1578 m_t << "</table>\n";
1580}

References DocHtmlTable::attribs, DocHtmlTable::caption, forceEndParagraph, forceStartParagraph, QCString::isEmpty, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlRow & tr)

Declaration at line 76 of file htmldocvisitor.h, definition at line 1582 of file htmldocvisitor.cpp.

1583{
1584 if (m_hide) return;
1585 m_t << "<tr" << tr.attribs().toString() << ">\n";
1586 visitChildren(tr);
1587 m_t << "</tr>\n";
1588}

References DocHtmlRow::attribs, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlCell & c)

Declaration at line 77 of file htmldocvisitor.h, definition at line 1590 of file htmldocvisitor.cpp.

1591{
1592 if (m_hide) return;
1593 if (c.isHeading())
1594 {
1595 m_t << "<th" << c.attribs().toString() << ">";
1596 }
1597 else
1598 {
1599 m_t << "<td" << c.attribs().toString() << ">";
1600 }
1601 visitChildren(c);
1602 if (c.isHeading()) m_t << "</th>"; else m_t << "</td>";
1603}

References DocHtmlCell::attribs, DocHtmlCell::isHeading, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlCaption & c)

Declaration at line 78 of file htmldocvisitor.h, definition at line 1605 of file htmldocvisitor.cpp.

1606{
1607 if (m_hide) return;
1608 m_t << "<caption" << c.attribs().toString() << ">";
1609 visitChildren(c);
1610 m_t << "</caption>\n";
1611}

References DocHtmlCaption::attribs, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocInternal & i)

Declaration at line 79 of file htmldocvisitor.h, definition at line 1613 of file htmldocvisitor.cpp.

1614{
1615 if (m_hide) return;
1616 visitChildren(i);
1617}

References m_hide and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHRef & href)

Declaration at line 80 of file htmldocvisitor.h, definition at line 1619 of file htmldocvisitor.cpp.

1620{
1621 if (m_hide) return;
1622 if (href.url().startsWith("mailto:"))
1623 {
1625 }
1626 else
1627 {
1628 QCString url = correctURL(href.url(),href.relPath());
1629 m_t << "<a href=\"" << convertToHtml(url) << "\""
1630 << href.attribs().toString() << ">";
1631 }
1632 visitChildren(href);
1633 m_t << "</a>";
1634}

References DocHRef::attribs, convertToHtml, correctURL, m_hide, m_t, QCString::mid, DocHRef::relPath, QCString::startsWith, HtmlAttribList::toString, DocHRef::url, visitChildren and writeObfuscatedMailAddress.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlSummary & s)

Declaration at line 81 of file htmldocvisitor.h, definition at line 1636 of file htmldocvisitor.cpp.

1637{
1638 if (m_hide) return;
1639 m_t << "<summary " << s.attribs().toString() << ">\n";
1640 visitChildren(s);
1641 m_t << "</summary>\n";
1642}

References DocHtmlSummary::attribs, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlDetails & d)

Declaration at line 82 of file htmldocvisitor.h, definition at line 1644 of file htmldocvisitor.cpp.

1645{
1646 if (m_hide) return;
1648 m_t << "<details " << d.attribs().toString() << ">\n";
1649 auto summary = d.summary();
1650 if (summary)
1651 {
1652 std::visit(*this,*summary);
1653 }
1654 visitChildren(d);
1655 m_t << "</details>\n";
1657}

References DocHtmlDetails::attribs, forceEndParagraph, forceStartParagraph, m_hide, m_t, DocHtmlDetails::summary, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlHeader & header)

Declaration at line 83 of file htmldocvisitor.h, definition at line 1659 of file htmldocvisitor.cpp.

1660{
1661 if (m_hide) return;
1662 forceEndParagraph(header);
1663 m_t << "<h" << header.level() << header.attribs().toString() << ">";
1664 visitChildren(header);
1665 m_t << "</h" << header.level() << ">\n";
1666 forceStartParagraph(header);
1667}

References DocHtmlHeader::attribs, forceEndParagraph, forceStartParagraph, DocHtmlHeader::level, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocImage & img)

Declaration at line 84 of file htmldocvisitor.h, definition at line 1669 of file htmldocvisitor.cpp.

1670{
1671 if (img.type()==DocImage::Html)
1672 {
1673 bool inlineImage = img.isInlineImage();
1674 bool typeSVG = img.isSVG();
1675 QCString url = img.url();
1676
1677 if (!inlineImage)
1678 {
1680 }
1681 if (m_hide) return;
1682 QCString baseName=makeShortName(img.name());
1683 if (!inlineImage) m_t << "<div class=\"image\">\n";
1684 QCString sizeAttribs;
1685 if (!img.width().isEmpty())
1686 {
1687 sizeAttribs+=" width=\""+img.width()+"\"";
1688 }
1689 if (!img.height().isEmpty()) // link to local file
1690 {
1691 sizeAttribs+=" height=\""+img.height()+"\"";
1692 }
1693 // 16 cases: url.isEmpty() | typeSVG | inlineImage | img.hasCaption()
1694
1695 HtmlAttribList attribs = img.attribs();
1696 if (typeSVG)
1697 {
1698 attribs.mergeAttribute("style","pointer-events: none;");
1699 }
1700 QCString alt;
1701 QCString attrs = attribs.toString(&alt);
1702 QCString src;
1703 if (url.isEmpty())
1704 {
1705 src = img.relPath()+img.name();
1706 }
1707 else
1708 {
1709 src = correctURL(url,img.relPath());
1710 }
1711 if (typeSVG && !inlineImage && !src.startsWith("http://") && !src.startsWith("https://"))
1712 {
1713 m_t << "<object type=\"image/svg+xml\" data=\"" << convertToHtml(src)
1714 << "\"" << sizeAttribs << attrs;
1715 if (inlineImage)
1716 {
1717 // skip closing tag
1718 }
1719 else
1720 {
1721 m_t << ">" << alt << "</object>\n";
1722 }
1723 }
1724 else
1725 {
1726 m_t << "<img src=\"" << convertToHtml(src) << "\" alt=\"" << alt << "\"" << sizeAttribs << attrs;
1727 if (inlineImage)
1728 {
1729 m_t << " class=\"inline\"";
1730 }
1731 else
1732 {
1733 m_t << "/>\n";
1734 }
1735 }
1736 if (img.hasCaption())
1737 {
1738 if (inlineImage)
1739 {
1740 m_t << " title=\"";
1741 m_insideTitle=true;
1742 }
1743 else
1744 {
1745 m_t << "<div class=\"caption\">\n";
1746 }
1747 }
1748 else if (inlineImage)
1749 {
1750 m_t << "/>";
1751 }
1752
1753 visitChildren(img);
1754
1755 if (img.hasCaption())
1756 {
1757 if (inlineImage)
1758 {
1759 m_t << "\"/>";
1760 m_insideTitle=false;
1761 }
1762 else // end <div class="caption">
1763 {
1764 m_t << "</div>";
1765 }
1766 }
1767 if (!inlineImage) // end <div class="image">
1768 {
1769 m_t << "</div>\n";
1771 }
1772 }
1773 else // other format -> skip
1774 {
1775 }
1776}

References DocImage::attribs, convertToHtml, correctURL, forceEndParagraph, forceStartParagraph, DocImage::hasCaption, DocImage::height, DocImage::Html, QCString::isEmpty, DocImage::isInlineImage, DocImage::isSVG, m_hide, m_insideTitle, m_t, makeShortName, HtmlAttribList::mergeAttribute, DocImage::name, DocImage::relPath, QCString::startsWith, HtmlAttribList::toString, DocImage::type, DocImage::url, visitChildren and DocImage::width.

operator()()

void HtmlDocVisitor::operator() (const DocDotFile & df)

Declaration at line 85 of file htmldocvisitor.h, definition at line 1778 of file htmldocvisitor.cpp.

1779{
1780 if (m_hide) return;
1781 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1783 m_t << "<div class=\"dotgraph\">\n";
1784 writeDotFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine());
1785 if (df.hasCaption())
1786 {
1787 m_t << "<div class=\"caption\">\n";
1788 }
1789 visitChildren(df);
1790 if (df.hasCaption())
1791 {
1792 m_t << "</div>\n";
1793 }
1794 m_t << "</div>\n";
1796}

References Config_getBool, Config_getString, DocDiagramFileBase::context, copyFile, DocDiagramFileBase::file, forceEndParagraph, forceStartParagraph, DocDiagramFileBase::hasCaption, m_hide, m_t, DocDiagramFileBase::relPath, DocDiagramFileBase::srcFile, DocDiagramFileBase::srcLine, stripPath, visitChildren and writeDotFile.

operator()()

void HtmlDocVisitor::operator() (const DocMscFile & df)

Declaration at line 86 of file htmldocvisitor.h, definition at line 1798 of file htmldocvisitor.cpp.

1799{
1800 if (m_hide) return;
1801 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1803 m_t << "<div class=\"mscgraph\">\n";
1804 writeMscFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine());
1805 if (df.hasCaption())
1806 {
1807 m_t << "<div class=\"caption\">\n";
1808 }
1809 visitChildren(df);
1810 if (df.hasCaption())
1811 {
1812 m_t << "</div>\n";
1813 }
1814 m_t << "</div>\n";
1816}

References Config_getBool, Config_getString, DocDiagramFileBase::context, copyFile, DocDiagramFileBase::file, forceEndParagraph, forceStartParagraph, DocDiagramFileBase::hasCaption, m_hide, m_t, DocDiagramFileBase::relPath, DocDiagramFileBase::srcFile, DocDiagramFileBase::srcLine, stripPath, visitChildren and writeMscFile.

operator()()

void HtmlDocVisitor::operator() (const DocDiaFile & df)

Declaration at line 87 of file htmldocvisitor.h, definition at line 1818 of file htmldocvisitor.cpp.

1819{
1820 if (m_hide) return;
1821 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1823 m_t << "<div class=\"diagraph\">\n";
1824 writeDiaFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine());
1825 if (df.hasCaption())
1826 {
1827 m_t << "<div class=\"caption\">\n";
1828 }
1829 visitChildren(df);
1830 if (df.hasCaption())
1831 {
1832 m_t << "</div>\n";
1833 }
1834 m_t << "</div>\n";
1836}

References Config_getBool, Config_getString, DocDiagramFileBase::context, copyFile, DocDiagramFileBase::file, forceEndParagraph, forceStartParagraph, DocDiagramFileBase::hasCaption, m_hide, m_t, DocDiagramFileBase::relPath, DocDiagramFileBase::srcFile, DocDiagramFileBase::srcLine, stripPath, visitChildren and writeDiaFile.

operator()()

void HtmlDocVisitor::operator() (const DocPlantUmlFile & df)

Declaration at line 88 of file htmldocvisitor.h, definition at line 1838 of file htmldocvisitor.cpp.

1839{
1840 if (m_hide) return;
1841 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file()));
1843 QCString htmlOutput = Config_getString(HTML_OUTPUT);
1845 PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP
1846 if (imgExt=="svg")
1847 {
1849 }
1850 std::string inBuf;
1851 readInputFile(df.file(),inBuf);
1853 htmlOutput,QCString(),
1854 inBuf.c_str(),format,QCString(),df.srcFile(),df.srcLine(),false);
1855 baseName=makeBaseName(baseName);
1856 m_t << "<div class=\"plantumlgraph\">\n";
1857 writePlantUMLFile(baseName,df.relPath(),QCString(),df.srcFile(),df.srcLine());
1858 if (df.hasCaption())
1859 {
1860 m_t << "<div class=\"caption\">\n";
1861 }
1862 visitChildren(df);
1863 if (df.hasCaption())
1864 {
1865 m_t << "</div>\n";
1866 }
1867 m_t << "</div>\n";
1869}

References Config_getBool, Config_getString, copyFile, DocDiagramFileBase::file, forceEndParagraph, forceStartParagraph, getDotImageExtension, DocDiagramFileBase::hasCaption, PlantumlManager::instance, m_hide, m_t, makeBaseName, PlantumlManager::PUML_BITMAP, PlantumlManager::PUML_SVG, readInputFile, DocDiagramFileBase::relPath, DocDiagramFileBase::srcFile, DocDiagramFileBase::srcLine, stripPath, visitChildren, writePlantUMLFile and PlantumlManager::writePlantUMLSource.

operator()()

void HtmlDocVisitor::operator() (const DocLink & lnk)

Declaration at line 89 of file htmldocvisitor.h, definition at line 1871 of file htmldocvisitor.cpp.

1872{
1873 if (m_hide) return;
1874 startLink(lnk.ref(),lnk.file(),lnk.relPath(),lnk.anchor());
1875 visitChildren(lnk);
1876 endLink();
1877}

References DocLink::anchor, endLink, DocLink::file, m_hide, DocLink::ref, DocLink::relPath, startLink and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocRef & ref)

Declaration at line 90 of file htmldocvisitor.h, definition at line 1879 of file htmldocvisitor.cpp.

1880{
1881 if (m_hide) return;
1882 if (!ref.file().isEmpty())
1883 {
1884 // when ref.isSubPage()==TRUE we use ref.file() for HTML and
1885 // ref.anchor() for LaTeX/RTF
1886 startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor());
1887 }
1888 if (!ref.hasLinkText()) filter(ref.targetTitle());
1889 visitChildren(ref);
1890 if (!ref.file().isEmpty()) endLink();
1891 //m_t << " ";
1892}

References DocRef::anchor, endLink, DocRef::file, filter, DocRef::hasLinkText, QCString::isEmpty, DocRef::isSubPage, m_hide, DocRef::ref, DocRef::relPath, startLink, DocRef::targetTitle and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocSecRefItem & ref)

Declaration at line 91 of file htmldocvisitor.h, definition at line 1894 of file htmldocvisitor.cpp.

1895{
1896 if (m_hide) return;
1897 if (!ref.file().isEmpty())
1898 {
1899 m_t << "<li>";
1900 startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor());
1901 }
1902 visitChildren(ref);
1903 if (!ref.file().isEmpty())
1904 {
1905 endLink();
1906 m_t << "</li>\n";
1907 }
1908}

References DocSecRefItem::anchor, endLink, DocSecRefItem::file, QCString::isEmpty, DocSecRefItem::isSubPage, m_hide, m_t, DocSecRefItem::ref, DocSecRefItem::relPath, startLink and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocSecRefList & s)

Declaration at line 92 of file htmldocvisitor.h, definition at line 1910 of file htmldocvisitor.cpp.

1911{
1912 if (m_hide) return;
1914 m_t << "<div>\n";
1915 m_t << "<ul class=\"multicol\">\n";
1916 visitChildren(s);
1917 m_t << "</ul>\n";
1918 m_t << "</div>\n";
1920}

References forceEndParagraph, forceStartParagraph, m_hide, m_t and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocParamSect & s)

Declaration at line 93 of file htmldocvisitor.h, definition at line 1922 of file htmldocvisitor.cpp.

1923{
1924 if (m_hide) return;
1926 QCString className;
1927 QCString heading;
1928 switch(s.type())
1929 {
1931 heading=theTranslator->trParameters();
1932 className="params";
1933 break;
1935 heading=theTranslator->trReturnValues();
1936 className="retval";
1937 break;
1939 heading=theTranslator->trExceptions();
1940 className="exception";
1941 break;
1943 heading=theTranslator->trTemplateParameters();
1944 className="tparams";
1945 break;
1946 default:
1947 ASSERT(0);
1948 }
1949 m_t << "<dl class=\"" << className << "\"><dt>";
1950 m_t << heading;
1951 m_t << "</dt><dd>\n";
1952 m_t << " <table class=\"" << className << "\">\n";
1953 visitChildren(s);
1954 m_t << " </table>\n";
1955 m_t << " </dd>\n";
1956 m_t << "</dl>\n";
1958}

References ASSERT, DocParamSect::Exception, forceEndParagraph, forceStartParagraph, m_hide, m_t, DocParamSect::Param, DocParamSect::RetVal, DocParamSect::TemplateParam, theTranslator, DocParamSect::type and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocParamList & pl)

Declaration at line 94 of file htmldocvisitor.h, definition at line 1966 of file htmldocvisitor.cpp.

1967{
1968 //printf("DocParamList::visitPre\n");
1969 if (m_hide) return;
1970 m_t << " <tr>";
1971 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1972 if (sect && sect->hasInOutSpecifier())
1973 {
1974 m_t << "<td class=\"paramdir\">";
1976 {
1977 m_t << "[";
1978 if (pl.direction()==DocParamSect::In)
1979 {
1980 m_t << "in";
1981 }
1982 else if (pl.direction()==DocParamSect::Out)
1983 {
1984 m_t << "out";
1985 }
1986 else if (pl.direction()==DocParamSect::InOut)
1987 {
1988 m_t << "in,out";
1989 }
1990 m_t << "]";
1991 }
1992 m_t << "</td>";
1993 }
1994 if (sect && sect->hasTypeSpecifier())
1995 {
1996 m_t << "<td class=\"paramtype\">";
1997 for (const auto &type : pl.paramTypes())
1998 {
1999 std::visit(*this,type);
2000 }
2001 m_t << "</td>";
2002 }
2003 m_t << "<td class=\"paramname\">";
2004 bool first=TRUE;
2005 for (const auto &param : pl.parameters())
2006 {
2007 if (!first) m_t << ","; else first=FALSE;
2008 std::visit(*this,param);
2009 }
2010 m_t << "</td><td>";
2011 for (const auto &par : pl.paragraphs())
2012 {
2013 std::visit(*this,par);
2014 }
2015 m_t << "</td></tr>\n";
2016}

References DocParamList::direction, FALSE, DocParamSect::hasInOutSpecifier, DocParamSect::hasTypeSpecifier, DocParamSect::In, DocParamSect::InOut, m_hide, m_t, DocParamSect::Out, DocParamList::paragraphs, DocParamList::parameters, DocParamList::paramTypes, DocNode::parent, TRUE and DocParamSect::Unspecified.

operator()()

void HtmlDocVisitor::operator() (const DocXRefItem & x)

Declaration at line 95 of file htmldocvisitor.h, definition at line 2018 of file htmldocvisitor.cpp.

2019{
2020 if (m_hide) return;
2021 if (x.title().isEmpty()) return;
2022
2024 bool anonymousEnum = x.file()=="@";
2025 if (!anonymousEnum)
2026 {
2027 QCString fn = x.file();
2029 m_t << "<dl class=\"" << x.key() << "\"><dt><b><a class=\"el\" href=\""
2030 << x.relPath() << fn
2031 << "#" << x.anchor() << "\">";
2032 }
2033 else
2034 {
2035 m_t << "<dl class=\"" << x.key() << "\"><dt><b>";
2036 }
2037 filter(x.title());
2038 if (!anonymousEnum) m_t << "</a>";
2039 m_t << "</b></dt><dd>";
2040 visitChildren(x);
2041 if (x.title().isEmpty()) return;
2042 m_t << "</dd></dl>\n";
2044}

References addHtmlExtensionIfMissing, DocXRefItem::anchor, DocXRefItem::file, filter, forceEndParagraph, forceStartParagraph, QCString::isEmpty, DocXRefItem::key, m_hide, m_t, DocXRefItem::relPath, DocXRefItem::title and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocInternalRef & ref)

Declaration at line 96 of file htmldocvisitor.h, definition at line 2046 of file htmldocvisitor.cpp.

2047{
2048 if (m_hide) return;
2049 startLink(QCString(),ref.file(),ref.relPath(),ref.anchor());
2050 visitChildren(ref);
2051 endLink();
2052 m_t << " ";
2053}

References DocInternalRef::anchor, endLink, DocInternalRef::file, m_hide, m_t, DocInternalRef::relPath, startLink and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocText & t)

Declaration at line 97 of file htmldocvisitor.h, definition at line 2055 of file htmldocvisitor.cpp.

2056{
2057 visitChildren(t);
2058}

Reference visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocHtmlBlockQuote & b)

Declaration at line 98 of file htmldocvisitor.h, definition at line 2060 of file htmldocvisitor.cpp.

2061{
2062 if (m_hide) return;
2064 m_t << "<blockquote class=\"doxtable\"" << b.attribs().toString() << ">\n";
2065 visitChildren(b);
2066 m_t << "</blockquote>\n";
2068}

References DocHtmlBlockQuote::attribs, forceEndParagraph, forceStartParagraph, m_hide, m_t, HtmlAttribList::toString and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocVhdlFlow & vf)

Declaration at line 99 of file htmldocvisitor.h, definition at line 2070 of file htmldocvisitor.cpp.

2071{
2072 if (m_hide) return;
2073 if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator
2074 {
2077 m_t << "<p>";
2078 m_t << theTranslator->trFlowchart();
2079 m_t << " ";
2080 m_t << "<a href=\"";
2081 m_t << fname;
2082 m_t << ".svg\">";
2084 m_t << "</a>";
2085 if (vf.hasCaption())
2086 {
2087 m_t << "<br />";
2088 }
2089 }
2090 visitChildren(vf);
2091 if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator
2092 {
2093 m_t << "</p>";
2095 }
2096}

References FlowChart::convertNameToFileName, forceEndParagraph, forceStartParagraph, VhdlDocGen::getFlowMember, DocVhdlFlow::hasCaption, m_hide, m_t, Definition::name, theTranslator and visitChildren.

operator()()

void HtmlDocVisitor::operator() (const DocParBlock & pb)

Declaration at line 100 of file htmldocvisitor.h, definition at line 2098 of file htmldocvisitor.cpp.

2099{
2100 if (m_hide) return;
2101 visitChildren(pb);
2102}

References m_hide and visitChildren.

Public Member Functions

forceEndParagraph()

template <class Node>
void HtmlDocVisitor::forceEndParagraph (const Node & n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.

This method will forcefully end the current paragraph and forceStartParagraph() will restart it.

Definition at line 2324 of file htmldocvisitor.cpp.

2325{
2326 const DocPara *para=std::get_if<DocPara>(n.parent());
2327 if (para)
2328 {
2329 const DocNodeList &children = para->children();
2330
2331 //printf("forceEndParagraph\n");
2332 //dumpDocNodeList(children);
2333
2334 auto it = std::find_if(std::begin(children),std::end(children),
2335 [&n](const auto &np) { return holds_value(&n,np); });
2336 if (it==std::end(children)) return;
2337 if (it==std::begin(children)) return; // first node in paragraph
2338 it = std::prev(it);
2339 bool found=false;
2340 while (!found)
2341 {
2342 found = !isInvisibleNode(*it);
2343 if (found) break;
2344 if (it!=std::begin(children))
2345 {
2346 --it;
2347 }
2348 else
2349 {
2350 break;
2351 }
2352 }
2353 if (!found) return; // first visible node in paragraph
2354 const DocNodeVariant &v = *it;
2355 if (mustBeOutsideParagraph(v)) return; // previous node already outside paragraph context
2356 bool styleOutsideParagraph=false;
2357 if (it!=std::begin(children))
2358 {
2359 it = std::prev(it);
2360 styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it);
2361 }
2362 bool isFirst = false;
2363 bool isLast = false;
2364 getParagraphContext(*para,isFirst,isLast);
2365 //printf("forceEnd first=%d last=%d styleOutsideParagraph=%d\n",isFirst,isLast,styleOutsideParagraph);
2366 if (isFirst && isLast) return;
2367 if (styleOutsideParagraph) return;
2368
2369 //printf("adding </p>\n");
2370 m_t << "</p>";
2371 }
2372}

References DocCompoundNode::children, getParagraphContext, holds_value, insideStyleChangeThatIsOutsideParagraph, isInvisibleNode, m_t and mustBeOutsideParagraph.

forceStartParagraph()

template <class Node>
void HtmlDocVisitor::forceStartParagraph (const Node & n)

Used for items found inside a paragraph, which due to XHTML restrictions have to be outside of the paragraph.

This method will forcefully start the paragraph, that was previously ended by forceEndParagraph().

Definition at line 2379 of file htmldocvisitor.cpp.

2380{
2381 //printf("> forceStartParagraph(%s)\n",docNodeName(n));
2382 const DocPara *para=nullptr;
2383 if (n.parent() && (para = std::get_if<DocPara>(n.parent()))) // if we are inside a paragraph
2384 {
2385 const DocNodeList &children = para->children();
2386
2387 auto it = std::find_if(std::begin(children),
2388 std::end(children),
2389 [&n](const auto &np)
2390 { return holds_value(&n,np); });
2391 if (it==std::end(children)) return;
2392 bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it);
2393 //printf("it=%s (%p) styleOutsideParagraph=%d\n",
2394 // docNodeName(*it), (void *)&*it, styleOutsideParagraph);
2395 if (styleOutsideParagraph) return;
2396 it = std::next(it);
2397 while (it!=std::end(children) && isInvisibleNode(*it))
2398 {
2399 ++it;
2400 }
2401 if (it!=std::end(children))
2402 {
2403 const DocNodeVariant &v = *it;
2404 if (mustBeOutsideParagraph(v)) return; // next element also outside paragraph
2405 }
2406 else
2407 {
2408 return; // only whitespace at the end!
2409 }
2410
2411 bool needsTag = true;
2412 bool isFirst = false;
2413 bool isLast = false;
2414 getParagraphContext(*para,isFirst,isLast);
2415 if (isFirst && isLast) needsTag = false;
2416 //printf("forceStart first=%d last=%d needsTag=%d\n",isFirst,isLast,needsTag);
2417
2418 if (needsTag) m_t << "<p>";
2419 }
2420}

References DocCompoundNode::children, getParagraphContext, holds_value, insideStyleChangeThatIsOutsideParagraph, isInvisibleNode, m_t and mustBeOutsideParagraph.

Private Member Functions

endLink()

void HtmlDocVisitor::endLink ()

Declaration at line 125 of file htmldocvisitor.h, definition at line 2214 of file htmldocvisitor.cpp.

2215{
2216 m_t << "</a>";
2217}

Reference m_t.

Referenced by operator(), operator(), operator(), operator(), operator() and operator().

filter()

void HtmlDocVisitor::filter (const QCString & str, const bool retainNewline=false)

Declaration at line 120 of file htmldocvisitor.h, definition at line 2104 of file htmldocvisitor.cpp.

2104void HtmlDocVisitor::filter(const QCString &str, const bool retainNewline)
2105{
2106 if (str.isEmpty()) return;
2107 const char *p=str.data();
2108 while (*p)
2109 {
2110 char c=*p++;
2111 switch(c)
2112 {
2113 case '\n': if(retainNewline) m_t << "<br/>"; m_t << c; break;
2114 case '<': m_t << "&lt;"; break;
2115 case '>': m_t << "&gt;"; break;
2116 case '&': m_t << "&amp;"; break;
2117 case '\\': if ((*p == '(') || (*p == ')'))
2118 m_t << "\\&zwj;" << *p++;
2119 else
2120 m_t << c;
2121 break;
2122 default:
2123 {
2124 uint8_t uc = static_cast<uint8_t>(c);
2125 if (uc<32 && !isspace(c)) // non-printable control characters
2126 {
2127 m_t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";";
2128 }
2129 else
2130 {
2131 m_t << c;
2132 }
2133 }
2134 break;
2135 }
2136 }
2137}

References QCString::data, hex, QCString::isEmpty and m_t.

Referenced by operator(), operator(), operator(), operator(), operator(), operator(), operator() and operator().

filterQuotedCdataAttr()

QCString HtmlDocVisitor::filterQuotedCdataAttr (const QCString & str)

Escape basic entities to produce a valid CDATA attribute value, assume that the outer quoting will be using the double quote ".

Declaration at line 121 of file htmldocvisitor.h, definition at line 2141 of file htmldocvisitor.cpp.

2142{
2143 GrowBuf growBuf;
2144 if (str.isEmpty()) return str;
2145 const char *p=str.data();
2146 while (*p)
2147 {
2148 char c=*p++;
2149 switch(c)
2150 {
2151 case '&': growBuf.addStr("&amp;"); break;
2152 case '"': growBuf.addStr("&quot;"); break;
2153 case '<': growBuf.addStr("&lt;"); break;
2154 case '>': growBuf.addStr("&gt;"); break;
2155 case '\\':
2156 if ((*p == '(') || (*p == ')'))
2157 {
2158 growBuf.addStr("\\&zwj;");
2159 growBuf.addChar(*p++);
2160 }
2161 else
2162 {
2163 growBuf.addChar(c);
2164 }
2165 break;
2166 default:
2167 {
2168 uint8_t uc = static_cast<uint8_t>(c);
2169 if (uc<32 && !isspace(c)) // non-printable control characters
2170 {
2171 growBuf.addStr("&#x24");
2172 growBuf.addChar(hex[uc>>4]);
2173 growBuf.addChar(hex[uc&0xF]);
2174 growBuf.addStr(";");
2175 }
2176 else
2177 {
2178 growBuf.addChar(c);
2179 }
2180 }
2181 break;
2182 }
2183 }
2184 growBuf.addChar(0);
2185 return growBuf.get();
2186}

References GrowBuf::addChar, GrowBuf::addStr, QCString::data, GrowBuf::get, hex and QCString::isEmpty.

Referenced by operator().

forceEndParagraph()

forceStartParagraph()

startLink()

void HtmlDocVisitor::startLink (const QCString & ref, const QCString & file, const QCString & relPath, const QCString & anchor, const QCString & tooltip="")

Declaration at line 122 of file htmldocvisitor.h, definition at line 2188 of file htmldocvisitor.cpp.

2188void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file,
2189 const QCString &relPath,const QCString &anchor,
2190 const QCString &tooltip)
2191{
2192 //printf("HtmlDocVisitor: file=%s anchor=%s\n",qPrint(file),qPrint(anchor));
2193 if (!ref.isEmpty()) // link to entity imported via tag file
2194 {
2195 m_t << "<a class=\"elRef\" ";
2197 }
2198 else // local link
2199 {
2200 m_t << "<a class=\"el\" ";
2201 }
2202 m_t << "href=\"";
2203 QCString fn = file;
2205 m_t << createHtmlUrl(relPath,ref,true,
2206 m_fileName == Config_getString(HTML_OUTPUT)+"/"+fn,
2207 fn,
2208 anchor);
2209 m_t << "\"";
2210 if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\"";
2211 m_t << ">";
2212}

References addHtmlExtensionIfMissing, Config_getString, convertToHtml, createHtmlUrl, externalLinkTarget, QCString::isEmpty, m_fileName and m_t.

Referenced by operator(), operator(), operator(), operator(), operator() and operator().

visitCaption()

template <class T>
void HtmlDocVisitor::visitCaption (TextStream & t, const T & n)

Declaration at line 113 of file htmldocvisitor.h, definition at line 263 of file htmldocvisitor.cpp.

264{
265 if (n.hasCaption())
266 {
267 t << "<div class=\"caption\">\n";
268 for (const auto &child : n.children())
269 {
270 std::visit(*this, child);
271 }
272 t << "</div>\n";
273 }
274}

Referenced by operator().

visitChildren()

template <class T>
void HtmlDocVisitor::visitChildren (const T & t)
inline

writeDiaFile()

void HtmlDocVisitor::writeDiaFile (const QCString & fileName, const QCString & relPath, const QCString & context, const QCString & srcFile, int srcLine)

Declaration at line 130 of file htmldocvisitor.h, definition at line 2243 of file htmldocvisitor.cpp.

2243void HtmlDocVisitor::writeDiaFile(const QCString &fileName, const QCString &relPath,
2244 const QCString &,const QCString &srcFile,int srcLine)
2245{
2246 QCString baseName=makeBaseName(fileName);
2247 baseName.prepend("dia_");
2248 QCString outDir = Config_getString(HTML_OUTPUT);
2249 writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::BITMAP,srcFile,srcLine);
2250
2251 m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n";
2252}

References BITMAP, Config_getString, m_t, makeBaseName, QCString::prepend and writeDiaGraphFromFile.

Referenced by operator().

writeDotFile()

void HtmlDocVisitor::writeDotFile (const QCString & fileName, const QCString & relPath, const QCString & context, const QCString & srcFile, int srcLine)

Declaration at line 126 of file htmldocvisitor.h, definition at line 2219 of file htmldocvisitor.cpp.

2219void HtmlDocVisitor::writeDotFile(const QCString &fn,const QCString &relPath,
2220 const QCString &context,const QCString &srcFile,int srcLine)
2221{
2222 QCString baseName=makeBaseName(fn);
2223 baseName.prepend("dot_");
2224 QCString outDir = Config_getString(HTML_OUTPUT);
2225 writeDotGraphFromFile(fn,outDir,baseName,GraphOutputFormat::BITMAP,srcFile,srcLine);
2226 writeDotImageMapFromFile(m_t,fn,outDir,relPath,baseName,context,-1,srcFile,srcLine);
2227}

References BITMAP, Config_getString, m_t, makeBaseName, QCString::prepend, writeDotGraphFromFile and writeDotImageMapFromFile.

Referenced by operator() and operator().

writeMscFile()

void HtmlDocVisitor::writeMscFile (const QCString & fileName, const QCString & relPath, const QCString & context, const QCString & srcFile, int srcLine)

Declaration at line 128 of file htmldocvisitor.h, definition at line 2229 of file htmldocvisitor.cpp.

2229void HtmlDocVisitor::writeMscFile(const QCString &fileName,const QCString &relPath,
2230 const QCString &context,const QCString &srcFile,int srcLine)
2231{
2232 QCString baseName=makeBaseName(fileName);
2233 baseName.prepend("msc_");
2234 QCString outDir = Config_getString(HTML_OUTPUT);
2237 if ("svg" == imgExt)
2238 mscFormat = MscOutputFormat::SVG;
2239 writeMscGraphFromFile(fileName,outDir,baseName,mscFormat,srcFile,srcLine);
2240 writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat,srcFile,srcLine);
2241}

References BITMAP, Config_getString, getDotImageExtension, m_t, makeBaseName, QCString::prepend, SVG, writeMscGraphFromFile and writeMscImageMapFromFile.

Referenced by operator() and operator().

writeObfuscatedMailAddress()

void HtmlDocVisitor::writeObfuscatedMailAddress (const QCString & url)

Declaration at line 119 of file htmldocvisitor.h, definition at line 345 of file htmldocvisitor.cpp.

346{
347 if (!Config_getBool(OBFUSCATE_EMAILS))
348 {
349 m_t << "<a href=\"mailto:" << url << "\">";
350 }
351 else
352 {
353 m_t << "<a href=\"#\" onclick=\"location.href='mai'+'lto:'";
354 if (!url.isEmpty())
355 {
356 const char *p = url.data();
357 uint32_t size=3;
358 while (*p)
359 {
360 m_t << "+'";
361 for (uint32_t j=0;j<size && *p;j++)
362 {
363 p = writeUTF8Char(m_t,p);
364 }
365 m_t << "'";
366 if (size==3) size=2; else size=3;
367 }
368 }
369 m_t << "; return false;\">";
370 }
371}

References Config_getBool, QCString::data, QCString::isEmpty, m_t and writeUTF8Char.

Referenced by operator() and operator().

writePlantUMLFile()

void HtmlDocVisitor::writePlantUMLFile (const QCString & fileName, const QCString & relPath, const QCString & context, const QCString & srcFile, int srcLine)

Declaration at line 132 of file htmldocvisitor.h, definition at line 2254 of file htmldocvisitor.cpp.

2254void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, const QCString &relPath,
2255 const QCString &,const QCString &/* srcFile */,int /* srcLine */)
2256{
2257 QCString baseName=makeBaseName(fileName);
2258 QCString outDir = Config_getString(HTML_OUTPUT);
2260 if (imgExt=="svg")
2261 {
2263 //m_t << "<iframe scrolling=\"no\" frameborder=\"0\" src=\"" << relPath << baseName << ".svg" << "\" />\n";
2264 //m_t << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>";
2265 //m_t << "</iframe>\n";
2266 m_t << "<object type=\"image/svg+xml\" data=\"" << relPath << baseName << ".svg\"></object>\n";
2267 }
2268 else
2269 {
2271 m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n";
2272 }
2273}

References Config_getString, PlantumlManager::generatePlantUMLOutput, getDotImageExtension, PlantumlManager::instance, m_t, makeBaseName, PlantumlManager::PUML_BITMAP and PlantumlManager::PUML_SVG.

Referenced by operator() and operator().

Private Member Attributes

m_ci

OutputCodeList& HtmlDocVisitor::m_ci

Definition at line 145 of file htmldocvisitor.h.

Referenced by HtmlDocVisitor, operator(), operator() and operator().

m_ctx

const Definition* HtmlDocVisitor::m_ctx

Definition at line 149 of file htmldocvisitor.h.

Referenced by HtmlDocVisitor, operator(), operator() and operator().

m_fileName

QCString HtmlDocVisitor::m_fileName

Definition at line 150 of file htmldocvisitor.h.

Referenced by HtmlDocVisitor and startLink.

m_hide

m_insidePre

bool HtmlDocVisitor::m_insidePre = false

Definition at line 146 of file htmldocvisitor.h.

146 bool m_insidePre = false;

Referenced by operator() and operator().

m_insideTitle

bool HtmlDocVisitor::m_insideTitle = false

Definition at line 148 of file htmldocvisitor.h.

148 bool m_insideTitle = false;

Referenced by operator() and operator().

m_langExt

QCString HtmlDocVisitor::m_langExt

Definition at line 151 of file htmldocvisitor.h.

Referenced by HtmlDocVisitor, operator() and operator().

m_t


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.