From b4e535197890521306d30e0713ca8b88a98f7bf7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 7 Jul 2018 14:47:33 +0200 Subject: Bug 667993 - HTML tags and not supported Added underline possibility and strike through possibility for the different output formats insofar it is possible (other similar possibilities are not always possible for all output formats either). --- doc/htmlcmds.doc | 5 +++++ src/cmdmapper.cpp | 2 ++ src/cmdmapper.h | 2 ++ src/docbookvisitor.cpp | 2 ++ src/docparser.cpp | 35 ++++++++++++++++++++++++++++++++++- src/docparser.h | 4 +++- src/doctokenizer.l | 4 ++-- src/htmldocvisitor.cpp | 6 ++++++ src/latexdocvisitor.cpp | 8 +++++++- src/mandocvisitor.cpp | 7 +++++++ src/perlmodgen.cpp | 2 ++ src/printdocvisitor.h | 6 ++++++ src/rtfdocvisitor.cpp | 6 ++++++ src/xmldocvisitor.cpp | 6 ++++++ templates/html/doxygen.css | 5 +++++ templates/latex/doxygen.sty | 2 +- templates/xml/compound.xsd | 2 ++ 17 files changed, 98 insertions(+), 6 deletions(-) diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc index b8324f8..1ff745f 100644 --- a/doc/htmlcmds.doc +++ b/doc/htmlcmds.doc @@ -83,6 +83,8 @@ of a HTML tag are passed on to the HTML output only
  • \ Ends a \ section.
  • \ Starts an inline text fragment with a specific style (HTML only)
  • \ Ends an inline text fragment with a specific style (HTML only) +
  • \ Starts a section of strike through text. +
  • \ Ends a section of strike through text.
  • \ Starts a section of bold text.
  • \ Ends a section of bold text.
  • \ Starts a piece of text displayed in subscript. @@ -101,6 +103,9 @@ of a HTML tag are passed on to the HTML output only
  • \ Ends a \ section.
  • \ Starts a piece of text displayed in a typewriter font.
  • \ Ends a \ section. +
  • \ Starts a section of underlined text. +
  • \ Ends a section of underlined text. +
  • \ Starts a section of bold text.
  • \ Starts an unnumbered item list.
  • \ Ends an unnumbered item list.
  • \ Starts a piece of text displayed in an italic font. diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index 2c8effc..71da3f3 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -193,6 +193,8 @@ CommandMap htmlTagMap[] = { "span", HTML_SPAN }, { "div", HTML_DIV }, { "blockquote", HTML_BLOCKQUOTE }, + { "strike", HTML_STRIKE }, + { "u", HTML_UNDERLINE }, { "c", XML_C }, // { "code", XML_CODE }, <= ambiguous is also a HTML tag diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 8cb529d..d06de63 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -175,6 +175,8 @@ enum HtmlTagType HTML_SPAN = 31, HTML_DIV = 32, HTML_BLOCKQUOTE= 33, + HTML_STRIKE = 34, + HTML_UNDERLINE = 35, XML_CmdMask = 0x100, diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ab10da0..b83317c 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -196,6 +196,8 @@ void DocbookDocVisitor::visit(DocStyleChange *s) /* There is no equivalent Docbook tag for rendering Small text */ case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break; /* HTML only */ + case DocStyleChange::Strike: break; + case DocStyleChange::Underline: break; case DocStyleChange::Div: /* HTML only */ break; case DocStyleChange::Span: /* HTML only */ break; } diff --git a/src/docparser.cpp b/src/docparser.cpp index 205e818..fba02f4 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1056,7 +1056,8 @@ const char *DocStyleChange::styleString() const case DocStyleChange::Superscript: return "superscript"; case DocStyleChange::Preformatted: return "pre"; case DocStyleChange::Div: return "div"; - case DocStyleChange::Span: return "span"; + case DocStyleChange::Strike: return "strike"; + case DocStyleChange::Underline: return "u"; } return ""; } @@ -1582,6 +1583,26 @@ reparsetoken: handleStyleLeave(parent,children,DocStyleChange::Bold,tokenName); } break; + case HTML_STRIKE: + if (!g_token->endTag) + { + handleStyleEnter(parent,children,DocStyleChange::Strike,&g_token->attribs); + } + else + { + handleStyleLeave(parent,children,DocStyleChange::Strike,tokenName); + } + break; + case HTML_UNDERLINE: + if (!g_token->endTag) + { + handleStyleEnter(parent,children,DocStyleChange::Underline,&g_token->attribs); + } + else + { + handleStyleLeave(parent,children,DocStyleChange::Underline,tokenName); + } + break; case HTML_CODE: case XML_C: if (!g_token->endTag) @@ -5905,6 +5926,12 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta case HTML_BOLD: handleStyleEnter(this,m_children,DocStyleChange::Bold,&g_token->attribs); break; + case HTML_STRIKE: + handleStyleEnter(this,m_children,DocStyleChange::Strike,&g_token->attribs); + break; + case HTML_UNDERLINE: + handleStyleEnter(this,m_children,DocStyleChange::Underline,&g_token->attribs); + break; case HTML_CODE: if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment) // for C# source or inside a or section we @@ -6314,6 +6341,12 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) case HTML_BOLD: handleStyleLeave(this,m_children,DocStyleChange::Bold,"b"); break; + case HTML_STRIKE: + handleStyleLeave(this,m_children,DocStyleChange::Strike,"strike"); + break; + case HTML_UNDERLINE: + handleStyleLeave(this,m_children,DocStyleChange::Underline,"u"); + break; case HTML_CODE: handleStyleLeave(this,m_children,DocStyleChange::Code,"code"); break; diff --git a/src/docparser.h b/src/docparser.h index d7390c2..6b75426 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -367,7 +367,9 @@ class DocStyleChange : public DocNode Superscript = (1<<6), Preformatted = (1<<7), Span = (1<<8), - Div = (1<<9) + Div = (1<<9), + Strike = (1<<10), + Underline = (1<<11) }; DocStyleChange(DocNode *parent,uint position,Style s,bool enable, diff --git a/src/doctokenizer.l b/src/doctokenizer.l index e6b8865..64e8d78 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -394,8 +394,8 @@ WORD1NQ {ESCWORD}|{CHARWORDQ}+|"{"|"}" WORD2NQ "."|","|"("|")"|"["|"]"|":"|";"|"\?"|"="|"'" CAPTION [cC][aA][pP][tT][iI][oO][nN] HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">" -HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p" -HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P" +HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"|"strike"|"u" +HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"|"STRIKE"|"U" HTMLKEYW {HTMLKEYL}|{HTMLKEYU} REFWORD2_PRE ("#"|"::")?((({ID}{TEMPLPART}?)|{ANONNS})("."|"#"|"::"|"-"|"/"))*({ID}{TEMPLPART}?(":")?) REFWORD2 {REFWORD2_PRE}{FUNCARG2}? diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 6a9c142..c3b9066 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -271,6 +271,12 @@ void HtmlDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; break; + case DocStyleChange::Strike: + if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; + break; + case DocStyleChange::Underline: + if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; + break; case DocStyleChange::Italic: if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; break; diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 7fd27bb..58c5d52 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -242,7 +242,13 @@ void LatexDocVisitor::visit(DocStyleChange *s) switch (s->style()) { case DocStyleChange::Bold: - if (s->enable()) m_t << "{\\bfseries "; else m_t << "}"; + if (s->enable()) m_t << "{\\bfseries{"; else m_t << "}}"; + break; + case DocStyleChange::Strike: + if (s->enable()) m_t << "\\sout{"; else m_t << "}"; + break; + case DocStyleChange::Underline: + if (s->enable()) m_t << "\\uline{"; else m_t << "}"; break; case DocStyleChange::Italic: if (s->enable()) m_t << "{\\itshape "; else m_t << "}"; diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 2233cc6..e09cc8e 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -120,6 +120,13 @@ void ManDocVisitor::visit(DocStyleChange *s) if (s->enable()) m_t << "\\fB"; else m_t << "\\fP"; m_firstCol=FALSE; break; + case DocStyleChange::Strike: + /* not supported */ + break; + case DocStyleChange::Underline: //underline is shown as emphasis + if (s->enable()) m_t << "\\fI"; else m_t << "\\fP"; + m_firstCol=FALSE; + break; case DocStyleChange::Italic: if (s->enable()) m_t << "\\fI"; else m_t << "\\fP"; m_firstCol=FALSE; diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index ef5cbc2..2bf03d1 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -626,6 +626,8 @@ void PerlModDocVisitor::visit(DocStyleChange *s) switch (s->style()) { case DocStyleChange::Bold: style = "bold"; break; + case DocStyleChange::Strike: style = "strike"; break; + case DocStyleChange::Underline: style = "underline"; break; case DocStyleChange::Italic: style = "italic"; break; case DocStyleChange::Code: style = "code"; break; case DocStyleChange::Subscript: style = "subscript"; break; diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index d1dbb74..8d9a2b9 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -91,6 +91,12 @@ class PrintDocVisitor : public DocVisitor case DocStyleChange::Bold: if (s->enable()) printf(""); else printf(""); break; + case DocStyleChange::Strike: + if (s->enable()) printf(""); else printf(""); + break; + case DocStyleChange::Underline: + if (s->enable()) printf(""); else printf(""); + break; case DocStyleChange::Italic: if (s->enable()) printf(""); else printf(""); break; diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index ec6d015..7fbfdc8 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -192,6 +192,12 @@ void RTFDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << "{\\b "; else m_t << "} "; break; + case DocStyleChange::Strike: + if (s->enable()) m_t << "{\\strike "; else m_t << "} "; + break; + case DocStyleChange::Underline: + if (s->enable()) m_t << "{\\ul "; else m_t << "} "; + break; case DocStyleChange::Italic: if (s->enable()) m_t << "{\\i "; else m_t << "} "; break; diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 93765b1..7c31687 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -164,6 +164,12 @@ void XmlDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << ""; else m_t << ""; break; + case DocStyleChange::Strike: + if (s->enable()) m_t << ""; else m_t << ""; + break; + case DocStyleChange::Underline: + if (s->enable()) m_t << ""; else m_t << ""; + break; case DocStyleChange::Italic: if (s->enable()) m_t << ""; else m_t << ""; break; diff --git a/templates/html/doxygen.css b/templates/html/doxygen.css index 8a1235a..3bc6d55 100644 --- a/templates/html/doxygen.css +++ b/templates/html/doxygen.css @@ -1750,3 +1750,8 @@ tt, code, kbd, samp direction:ltr; } /* @end */ + +u { + text-decoration: underline; +} + diff --git a/templates/latex/doxygen.sty b/templates/latex/doxygen.sty index 51e369b..166e7ef 100644 --- a/templates/latex/doxygen.sty +++ b/templates/latex/doxygen.sty @@ -19,7 +19,7 @@ \RequirePackage{adjustbox} \RequirePackage{amssymb} \RequirePackage{stackengine} - +\RequirePackage[normalem]{ulem} % for strikeout, but don't modify emphasis %---------- Internal commands used in this style file ---------------- diff --git a/templates/xml/compound.xsd b/templates/xml/compound.xsd index b4356ac..c1be47a 100644 --- a/templates/xml/compound.xsd +++ b/templates/xml/compound.xsd @@ -384,6 +384,8 @@ + + -- cgit v0.12