Skip to content

Commit 60d633e

Browse files
committed
issue #11240 Add CSS class for @p command
Added general class attribute to style change commands. The value of the class attribute is `doxygen_` followed by the doxygen command or tag name.
1 parent 7748bdf commit 60d633e

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

src/htmldocvisitor.cpp

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -482,46 +482,55 @@ void HtmlDocVisitor::operator()(const DocHorRuler &hr)
482482
void HtmlDocVisitor::operator()(const DocStyleChange &s)
483483
{
484484
if (m_hide) return;
485+
HtmlAttribList extraAttribs;
486+
if (s.enable())
487+
{
488+
HtmlAttrib opt;
489+
opt.name = "class";
490+
opt.value = "doxygen_" + s.tagName();
491+
extraAttribs.push_back(opt);
492+
mergeHtmlAttributes(s.attribs(),extraAttribs);
493+
}
485494
switch (s.style())
486495
{
487496
case DocStyleChange::Bold:
488-
if (s.enable()) m_t << "<b" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</b>";
497+
if (s.enable()) m_t << "<b" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</b>";
489498
break;
490499
case DocStyleChange::S:
491-
if (s.enable()) m_t << "<s" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</s>";
500+
if (s.enable()) m_t << "<s" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</s>";
492501
break;
493502
case DocStyleChange::Strike:
494-
if (s.enable()) m_t << "<strike" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</strike>";
503+
if (s.enable()) m_t << "<strike" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</strike>";
495504
break;
496505
case DocStyleChange::Del:
497-
if (s.enable()) m_t << "<del" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</del>";
506+
if (s.enable()) m_t << "<del" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</del>";
498507
break;
499508
case DocStyleChange::Underline:
500-
if (s.enable()) m_t << "<u" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</u>";
509+
if (s.enable()) m_t << "<u" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</u>";
501510
break;
502511
case DocStyleChange::Ins:
503-
if (s.enable()) m_t << "<ins" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</ins>";
512+
if (s.enable()) m_t << "<ins" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</ins>";
504513
break;
505514
case DocStyleChange::Italic:
506-
if (s.enable()) m_t << "<em" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</em>";
515+
if (s.enable()) m_t << "<em" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</em>";
507516
break;
508517
case DocStyleChange::Kbd:
509-
if (s.enable()) m_t << "<kbd" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</kbd>";
518+
if (s.enable()) m_t << "<kbd" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</kbd>";
510519
break;
511520
case DocStyleChange::Code:
512-
if (s.enable()) m_t << "<code" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</code>";
521+
if (s.enable()) m_t << "<code" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</code>";
513522
break;
514523
case DocStyleChange::Subscript:
515-
if (s.enable()) m_t << "<sub" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</sub>";
524+
if (s.enable()) m_t << "<sub" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</sub>";
516525
break;
517526
case DocStyleChange::Superscript:
518-
if (s.enable()) m_t << "<sup" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</sup>";
527+
if (s.enable()) m_t << "<sup" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</sup>";
519528
break;
520529
case DocStyleChange::Center:
521530
if (s.enable())
522531
{
523532
forceEndParagraph(s);
524-
m_t << "<center" << htmlAttribsToString(s.attribs()) << ">";
533+
m_t << "<center" << htmlAttribsToString(extraAttribs) << ">";
525534
}
526535
else
527536
{
@@ -530,16 +539,16 @@ void HtmlDocVisitor::operator()(const DocStyleChange &s)
530539
}
531540
break;
532541
case DocStyleChange::Small:
533-
if (s.enable()) m_t << "<small" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</small>";
542+
if (s.enable()) m_t << "<small" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</small>";
534543
break;
535544
case DocStyleChange::Cite:
536-
if (s.enable()) m_t << "<cite" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</cite>";
545+
if (s.enable()) m_t << "<cite" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</cite>";
537546
break;
538547
case DocStyleChange::Preformatted:
539548
if (s.enable())
540549
{
541550
forceEndParagraph(s);
542-
m_t << "<pre" << htmlAttribsToString(s.attribs()) << ">";
551+
m_t << "<pre" << htmlAttribsToString(extraAttribs) << ">";
543552
m_insidePre=TRUE;
544553
}
545554
else
@@ -553,7 +562,7 @@ void HtmlDocVisitor::operator()(const DocStyleChange &s)
553562
if (s.enable())
554563
{
555564
forceEndParagraph(s);
556-
m_t << "<div" << htmlAttribsToString(s.attribs()) << ">";
565+
m_t << "<div" << htmlAttribsToString(extraAttribs) << ">";
557566
}
558567
else
559568
{
@@ -562,7 +571,7 @@ void HtmlDocVisitor::operator()(const DocStyleChange &s)
562571
}
563572
break;
564573
case DocStyleChange::Span:
565-
if (s.enable()) m_t << "<span" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</span>";
574+
if (s.enable()) m_t << "<span" << htmlAttribsToString(extraAttribs) << ">"; else m_t << "</span>";
566575
break;
567576
}
568577
}

0 commit comments

Comments
 (0)