Skip to content

Commit

Permalink
Adding HTML s tag, XML corrections for other tags
Browse files Browse the repository at this point in the history
Adding the HTML `<s>` tag (https://www.w3schools.com/tags/tag_s.asp).

Adding 's' and correcting 'inc' to 'ins'  in compound.xsd
  • Loading branch information
albert-github committed Aug 16, 2019
1 parent 66ae8f6 commit cf82dae
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/cmdmapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ CommandMap htmlTagMap[] =
{ "div", HTML_DIV },
{ "blockquote", HTML_BLOCKQUOTE },
{ "strike", HTML_STRIKE },
{ "s", HTML_S },
{ "u", HTML_UNDERLINE },
{ "ins", HTML_INS },
{ "del", HTML_DEL },
Expand Down
1 change: 1 addition & 0 deletions src/cmdmapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ enum HtmlTagType
HTML_UNDERLINE = 35,
HTML_INS = 36,
HTML_DEL = 37,
HTML_S = 38,

XML_CmdMask = 0x100,

Expand Down
1 change: 1 addition & 0 deletions src/docbookvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ DB_VIS_C
/* There is no equivalent Docbook tag for rendering Small text */
case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break;
/* HTML only */
case DocStyleChange::S: break;
case DocStyleChange::Strike: break;
case DocStyleChange::Del: break;
case DocStyleChange::Underline: break;
Expand Down
18 changes: 17 additions & 1 deletion src/docparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ const char *DocStyleChange::styleString() const
case DocStyleChange::Div: return "div";
case DocStyleChange::Span: return "span";
case DocStyleChange::Strike: return "strike";
case DocStyleChange::S: return "s";
case DocStyleChange::Del: return "del";
case DocStyleChange::Underline: return "u";
case DocStyleChange::Ins: return "ins";
Expand Down Expand Up @@ -1171,7 +1172,7 @@ static void handleParameterType(DocNode *parent,QList<DocNode> &children,const Q
{
QCString name = g_token->name; // save token name
QCString name1;
int p=0,i,l,ii;
int p=0,i,ii;
while ((i=paramTypes.find('|',p))!=-1)
{
name1 = paramTypes.mid(p,i-p);
Expand Down Expand Up @@ -1550,6 +1551,15 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children
handleStyleLeave(parent,children,DocStyleChange::Bold,tokenName);
}
break;
case HTML_S:
if (!g_token->endTag)
{
handleStyleEnter(parent,children,DocStyleChange::S,&g_token->attribs);
}
else
{
handleStyleLeave(parent,children,DocStyleChange::S,tokenName);
}
case HTML_STRIKE:
if (!g_token->endTag)
{
Expand Down Expand Up @@ -5925,6 +5935,9 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta
case HTML_BOLD:
handleStyleEnter(this,m_children,DocStyleChange::Bold,&g_token->attribs);
break;
case HTML_S:
handleStyleEnter(this,m_children,DocStyleChange::S,&g_token->attribs);
break;
case HTML_STRIKE:
handleStyleEnter(this,m_children,DocStyleChange::Strike,&g_token->attribs);
break;
Expand Down Expand Up @@ -6346,6 +6359,9 @@ int DocPara::handleHtmlEndTag(const QCString &tagName)
case HTML_BOLD:
handleStyleLeave(this,m_children,DocStyleChange::Bold,"b");
break;
case HTML_S:
handleStyleLeave(this,m_children,DocStyleChange::S,"s");
break;
case HTML_STRIKE:
handleStyleLeave(this,m_children,DocStyleChange::Strike,"strike");
break;
Expand Down
3 changes: 2 additions & 1 deletion src/docparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ class DocStyleChange : public DocNode
Strike = (1<<10),
Underline = (1<<11),
Del = (1<<12),
Ins = (1<<13)
Ins = (1<<13),
S = (1<<14)
};

DocStyleChange(DocNode *parent,uint position,Style s,bool enable,
Expand Down
4 changes: 2 additions & 2 deletions src/doctokenizer.l
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,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"|"strike"|"u"|"del"|"ins"
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"|"DEL"|"INS"
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"|"del"|"ins"|"s"
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"|"DEL"|"INS"|"S"
HTMLKEYW {HTMLKEYL}|{HTMLKEYU}
REFWORD2_PRE ("#"|"::")?((({ID}{TEMPLPART}?)|{ANONNS})("."|"#"|"::"|"-"|"/"))*({ID}{TEMPLPART}?(":")?)
REFWORD2 {REFWORD2_PRE}{FUNCARG2}?
Expand Down
3 changes: 3 additions & 0 deletions src/htmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ void HtmlDocVisitor::visit(DocStyleChange *s)
case DocStyleChange::Bold:
if (s->enable()) m_t << "<b" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</b>";
break;
case DocStyleChange::S:
if (s->enable()) m_t << "<s" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</s>";
break;
case DocStyleChange::Strike:
if (s->enable()) m_t << "<strike" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</strike>";
break;
Expand Down
1 change: 1 addition & 0 deletions src/latexdocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ void LatexDocVisitor::visit(DocStyleChange *s)
case DocStyleChange::Bold:
if (s->enable()) m_t << "{\\bfseries{"; else m_t << "}}";
break;
case DocStyleChange::S:
case DocStyleChange::Strike:
case DocStyleChange::Del:
if (s->enable()) m_t << "\\sout{"; else m_t << "}";
Expand Down
1 change: 1 addition & 0 deletions src/mandocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void ManDocVisitor::visit(DocStyleChange *s)
if (s->enable()) m_t << "\\fB"; else m_t << "\\fP";
m_firstCol=FALSE;
break;
case DocStyleChange::S:
case DocStyleChange::Strike:
case DocStyleChange::Del:
/* not supported */
Expand Down
1 change: 1 addition & 0 deletions src/perlmodgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ void PerlModDocVisitor::visit(DocStyleChange *s)
switch (s->style())
{
case DocStyleChange::Bold: style = "bold"; break;
case DocStyleChange::S: style = "s"; break;
case DocStyleChange::Strike: style = "strike"; break;
case DocStyleChange::Del: style = "del"; break;
case DocStyleChange::Underline: style = "underline"; break;
Expand Down
3 changes: 3 additions & 0 deletions src/printdocvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class PrintDocVisitor : public DocVisitor
case DocStyleChange::Bold:
if (s->enable()) printf("<bold>"); else printf("</bold>");
break;
case DocStyleChange::S:
if (s->enable()) printf("<s>"); else printf("</s>");
break;
case DocStyleChange::Strike:
if (s->enable()) printf("<strike>"); else printf("</strike>");
break;
Expand Down
1 change: 1 addition & 0 deletions src/rtfdocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ void RTFDocVisitor::visit(DocStyleChange *s)
case DocStyleChange::Bold:
if (s->enable()) m_t << "{\\b "; else m_t << "} ";
break;
case DocStyleChange::S:
case DocStyleChange::Strike:
case DocStyleChange::Del:
if (s->enable()) m_t << "{\\strike "; else m_t << "} ";
Expand Down
3 changes: 3 additions & 0 deletions src/xmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ void XmlDocVisitor::visit(DocStyleChange *s)
case DocStyleChange::Bold:
if (s->enable()) m_t << "<bold>"; else m_t << "</bold>";
break;
case DocStyleChange::S:
if (s->enable()) m_t << "<s>"; else m_t << "</s>";
break;
case DocStyleChange::Strike:
if (s->enable()) m_t << "<strike>"; else m_t << "</strike>";
break;
Expand Down
3 changes: 2 additions & 1 deletion templates/xml/compound.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
<xsd:choice>
<xsd:element name="ulink" type="docURLLink" />
<xsd:element name="bold" type="docMarkupType" />
<xsd:element name="s" type="docMarkupType" />
<xsd:element name="strike" type="docMarkupType" />
<xsd:element name="underline" type="docMarkupType" />
<xsd:element name="emphasis" type="docMarkupType" />
Expand All @@ -419,7 +420,7 @@
<xsd:element name="center" type="docMarkupType" />
<xsd:element name="small" type="docMarkupType" />
<xsd:element name="del" type="docMarkupType" />
<xsd:element name="inc" type="docMarkupType" />
<xsd:element name="ins" type="docMarkupType" />
<xsd:element name="htmlonly" type="docHtmlOnlyType" />
<xsd:element name="manonly" type="xsd:string" />
<xsd:element name="xmlonly" type="xsd:string" />
Expand Down
2 changes: 1 addition & 1 deletion testing/086/086__style__tags_8h.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<briefdescription>
</briefdescription>
<detaileddescription>
<para>In the following the word tag has the style as indicated before it.<itemizedlist><listitem><para>This is a bold <bold>tag</bold>.</para></listitem><listitem><para>This is a <computeroutput>strong</computeroutput> bold <bold>tag</bold>.</para></listitem><listitem><para>This is an italic <emphasis>tag</emphasis>.</para></listitem><listitem><para>This is an <computeroutput>em</computeroutput> italic <emphasis>tag</emphasis>.</para></listitem><listitem><para>This is a strike through <strike>tag</strike>.</para></listitem><listitem><para>This is an underline <underline>tag</underline>.</para></listitem><listitem><para>This is an insterted <ins>tag</ins>.</para></listitem><listitem><para>This is a deleted <del>tag</del>.</para></listitem><listitem><para>This is a typewriter <computeroutput>tag</computeroutput>. </para></listitem></itemizedlist>
<para>In the following the word tag has the style as indicated before it.<itemizedlist><listitem><para>This is a bold <bold>tag</bold>.</para></listitem><listitem><para>This is a <computeroutput>strong</computeroutput> bold <bold>tag</bold>.</para></listitem><listitem><para>This is an italic <emphasis>tag</emphasis>.</para></listitem><listitem><para>This is an <computeroutput>em</computeroutput> italic <emphasis>tag</emphasis>.</para></listitem><listitem><para>This is a strike through <strike>tag</strike>.</para></listitem><listitem><para>This is a <computeroutput>s</computeroutput> strike through <s>tag</s>.</para></listitem><listitem><para>This is an underline <underline>tag</underline>.</para></listitem><listitem><para>This is an <computeroutput>ins</computeroutput> inserted <ins>tag</ins>.</para></listitem><listitem><para>This is a deleted <del>tag</del>.</para></listitem><listitem><para>This is a typewriter <computeroutput>tag</computeroutput>. </para></listitem></itemizedlist>
</para>
</detaileddescription>
<location file="086_style_tags.h"/>
Expand Down
3 changes: 2 additions & 1 deletion testing/086_style_tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ In the following the word tag has the style as indicated before it.
- This is an italic <i>tag</i>.
- This is an `em` italic <em>tag</em>.
- This is a strike through <strike>tag</strike>.
- This is a `s` strike through <s>tag</s>.
- This is an underline <u>tag</u>.
- This is an insterted <ins>tag</ins>.
- This is an `ins` inserted <ins>tag</ins>.
- This is a deleted <del>tag</del>.
- This is a typewriter <tt>tag</tt>.
*/
Expand Down

0 comments on commit cf82dae

Please sign in to comment.