Skip to content

Commit

Permalink
Create command for escaped equal sign
Browse files Browse the repository at this point in the history
 This command writes an equal sign (`=`) to the output. This  character sequence has to be escaped in some cases, because it is used in Markdown header processing.
  • Loading branch information
albert-github committed Nov 7, 2018
1 parent 9440d7c commit 8292eee
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 4 deletions.
9 changes: 9 additions & 0 deletions doc/commands.doc
Expand Up @@ -213,6 +213,7 @@ documentation:
\refitem cmdamp \\\&
\refitem cmdtilde \\~
\refitem cmdlt \\\<
\refitem cmdeq \\=
\refitem cmdgt \\\>
\refitem cmdhash \\\#
\refitem cmdperc \\\%
Expand Down Expand Up @@ -3433,6 +3434,14 @@ class Receiver
or to prevent starting a numbered list when the dot follows a number at
the start of a line.

<hr>
\section cmdeq \\=

\addindex \\=
This command writes an equal sign (`=`) to the output. This
character sequence has to be escaped in some cases, because it is used
in Markdown header processing.

<hr>
\section cmddcolon \\::

Expand Down
1 change: 1 addition & 0 deletions src/cmdmapper.cpp
Expand Up @@ -111,6 +111,7 @@ CommandMap cmdMap[] =
{ "\\", CMD_BSLASH },
{ "@", CMD_AT },
{ "<", CMD_LESS },
{ "=", CMD_EQUAL },
{ ">", CMD_GREATER },
{ "&", CMD_AMP },
{ "$", CMD_DOLLAR },
Expand Down
3 changes: 2 additions & 1 deletion src/cmdmapper.h
Expand Up @@ -136,7 +136,8 @@ enum CommandType
CMD_MINUS = 106,
CMD_INCLUDEDOC = 107,
CMD_SNIPPETDOC = 108,
CMD_SNIPWITHLINES= 109
CMD_SNIPWITHLINES= 109,
CMD_EQUAL = 110
};

enum HtmlTagType
Expand Down
10 changes: 10 additions & 0 deletions src/docparser.cpp
Expand Up @@ -1437,6 +1437,9 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children
case CMD_MINUS:
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
break;
case CMD_EQUAL:
children.append(new DocSymbol(parent,DocSymbol::Sym_Equal));
break;
case CMD_EMPHASIS:
{
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,TRUE));
Expand Down Expand Up @@ -3257,6 +3260,7 @@ int DocIndexEntry::parse()
case CMD_PUNT: m_entry+='.'; break;
case CMD_PLUS: m_entry+='+'; break;
case CMD_MINUS: m_entry+='-'; break;
case CMD_EQUAL: m_entry+='='; break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command %s found as argument of \\addindex",
qPrint(g_token->name));
Expand Down Expand Up @@ -5420,6 +5424,9 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok)
case CMD_MINUS:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
break;
case CMD_EQUAL:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Equal));
break;
case CMD_SA:
g_inSeeBlock=TRUE;
retval = handleSimpleSection(DocSimpleSect::See);
Expand Down Expand Up @@ -6975,6 +6982,9 @@ void DocText::parse()
case CMD_MINUS:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
break;
case CMD_EQUAL:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Equal));
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command `%s' found",
qPrint(g_token->name));
Expand Down
2 changes: 1 addition & 1 deletion src/docparser.h
Expand Up @@ -454,7 +454,7 @@ class DocSymbol : public DocNode
/* doxygen commands mapped */
Sym_BSlash, Sym_At, Sym_Less, Sym_Greater, Sym_Amp,
Sym_Dollar, Sym_Hash, Sym_DoubleColon, Sym_Percent, Sym_Pipe,
Sym_Quot, Sym_Minus, Sym_Plus, Sym_Dot
Sym_Quot, Sym_Minus, Sym_Plus, Sym_Dot, Sym_Equal
};
enum PerlType { Perl_unknown = 0, Perl_string, Perl_char, Perl_symbol, Perl_umlaut,
Perl_acute, Perl_grave, Perl_circ, Perl_slash, Perl_tilde,
Expand Down
2 changes: 1 addition & 1 deletion src/doctokenizer.l
Expand Up @@ -358,7 +358,7 @@ FILEMASK ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|{HFILEMASK}
LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)?
VERBATIM "verbatim"{BLANK}*
SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---")
SPCMD2 {CMD}[\\@<>&$#%~".+|-]
SPCMD2 {CMD}[\\@<>&$#%~".+=|-]
SPCMD3 {CMD}form#[0-9]+
SPCMD4 {CMD}"::"
INOUT "inout"|"in"|"out"|("in"{BLANK}*","{BLANK}*"out")|("out"{BLANK}*","{BLANK}*"in")
Expand Down
3 changes: 2 additions & 1 deletion src/htmlentity.cpp
Expand Up @@ -314,7 +314,8 @@ static struct htmlEntityInfo
{ SYM(Quot), "\"", "\"", "\"", "&quot;", "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }},
{ SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }},
{ SYM(Plus), "+", "+", "+", "+", "+", "+", "+", { "+", DocSymbol::Perl_char }},
{ SYM(Dot), ".", ".", ".", ".", ".", ".", ".", { ".", DocSymbol::Perl_char }}
{ SYM(Dot), ".", ".", ".", ".", ".", ".", ".", { ".", DocSymbol::Perl_char }},
{ SYM(Equal), "=", "=", "=", "=", "=", "=", "=", { "=", DocSymbol::Perl_char }}
};

static const int g_numHtmlEntities = (int)(sizeof(g_htmlEntities)/ sizeof(*g_htmlEntities));
Expand Down

0 comments on commit 8292eee

Please sign in to comment.