summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/commands.doc16
-rw-r--r--src/cmdmapper.cpp2
-rw-r--r--src/cmdmapper.h4
-rw-r--r--src/commentscan.l6
-rw-r--r--src/docparser.cpp29
-rw-r--r--src/docparser.h2
-rw-r--r--src/doctokenizer.l2
-rw-r--r--src/htmlentity.cpp3
-rw-r--r--src/markdown.cpp10
9 files changed, 70 insertions, 4 deletions
diff --git a/doc/commands.doc b/doc/commands.doc
index 4c3c2fc..0f36e61 100644
--- a/doc/commands.doc
+++ b/doc/commands.doc
@@ -209,6 +209,8 @@ documentation:
\refitem cmdchardot \\\.
\refitem cmddcolon \::
\refitem cmdpipe \\|
+\refitem cmdndash \\\--
+\refitem cmdmdash \\\---
\endsecreflist
The following subsections provide a list of all commands that are recognized by
@@ -3077,6 +3079,20 @@ class Receiver
for Markdown tables.
<hr>
+\section cmdndash \\--
+
+ \addindex \\\--
+ This command writes two dashes (\--) to the output. This allows
+ writing two consecutive dashes to the output instead of one n-dash character (--).
+
+<hr>
+\section cmdmdash \\---
+
+ \addindex \\\---
+ This command writes three dashes (\---) to the output. This allows
+ writing three consecutuve dashes to the output instead of one m-dash character (---).
+
+<hr>
\htmlonly <center> \endhtmlonly
<h2>
\htmlonly --- \endhtmlonly
diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp
index 6320169..45469f2 100644
--- a/src/cmdmapper.cpp
+++ b/src/cmdmapper.cpp
@@ -136,6 +136,8 @@ CommandMap cmdMap[] =
{ "parblock", CMD_PARBLOCK },
{ "endparblock", CMD_ENDPARBLOCK },
{ "diafile", CMD_DIAFILE },
+ { "--", CMD_NDASH },
+ { "---", CMD_MDASH },
{ 0, 0 },
};
diff --git a/src/cmdmapper.h b/src/cmdmapper.h
index eafc77b..d89e368 100644
--- a/src/cmdmapper.h
+++ b/src/cmdmapper.h
@@ -125,7 +125,9 @@ enum CommandType
CMD_PARBLOCK = 95,
CMD_ENDPARBLOCK = 96,
CMD_DIAFILE = 97,
- CMD_LATEXINCLUDE = 98
+ CMD_LATEXINCLUDE = 98,
+ CMD_NDASH = 99,
+ CMD_MDASH = 100
};
enum HtmlTagType
diff --git a/src/commentscan.l b/src/commentscan.l
index 4b25dff..bd20bf0 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -1200,6 +1200,12 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{B}*/\n { // horizontal line (dashed)
addOutput(yytext);
}
+<Comment>{CMD}"---" { // escaped mdash
+ addOutput(yytext);
+ }
+<Comment>{CMD}"--" { // escaped mdash
+ addOutput(yytext);
+ }
<Comment>"---" { // mdash
addOutput(insidePre || Doxygen::markdownSupport ? yytext : "&mdash;");
}
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 3f7a8bc..e5e2895 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -1271,6 +1271,15 @@ reparsetoken:
case CMD_PERCENT:
children.append(new DocSymbol(parent,DocSymbol::Sym_Percent));
break;
+ case CMD_NDASH:
+ children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
+ children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
+ break;
+ case CMD_MDASH:
+ children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
+ children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
+ children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
+ break;
case CMD_QUOTE:
children.append(new DocSymbol(parent,DocSymbol::Sym_Quot));
break;
@@ -3281,6 +3290,8 @@ int DocIndexEntry::parse()
case CMD_HASH: m_entry+='#'; break;
case CMD_DCOLON: m_entry+="::"; break;
case CMD_PERCENT: m_entry+='%'; break;
+ case CMD_NDASH: m_entry+="--"; break;
+ case CMD_MDASH: m_entry+="---"; break;
case CMD_QUOTE: m_entry+='"'; break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command %s found as argument of \\addindex",
@@ -5373,6 +5384,15 @@ int DocPara::handleCommand(const QCString &cmdName)
case CMD_PERCENT:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent));
break;
+ case CMD_NDASH:
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ break;
+ case CMD_MDASH:
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ break;
case CMD_QUOTE:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot));
break;
@@ -6828,6 +6848,15 @@ void DocText::parse()
case CMD_PERCENT:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent));
break;
+ case CMD_NDASH:
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ break;
+ case CMD_MDASH:
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ m_children.append(new DocSymbol(this,DocSymbol::Sym_Minus));
+ break;
case CMD_QUOTE:
m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot));
break;
diff --git a/src/docparser.h b/src/docparser.h
index b37a4a5..fb4f084 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -395,7 +395,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_Quot, Sym_Minus
};
enum PerlType { Perl_unknown = 0, Perl_string, Perl_char, Perl_symbol, Perl_umlaut,
Perl_acute, Perl_grave, Perl_circ, Perl_slash, Perl_tilde,
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index 942c7ef..7ffbbb3 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -350,7 +350,7 @@ HFILEMASK ("."{FILESCHAR}*{FILEECHAR}+)*
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})
+SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---")
SPCMD2 {CMD}[\\@<>&$#%~".|]
SPCMD3 {CMD}form#[0-9]+
SPCMD4 {CMD}"::"
diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp
index c1a9ad0..c49491e 100644
--- a/src/htmlentity.cpp
+++ b/src/htmlentity.cpp
@@ -311,7 +311,8 @@ static struct htmlEntityInfo
{ SYM(DoubleColon), "::", "::", "::", "::", "::", "::", "::", { "::", DocSymbol::Perl_string }},
{ SYM(Percent), "%", "%", "%", "%", "\\%", "%", "%", { "%", DocSymbol::Perl_char }},
{ SYM(Pipe), "|", "|", "|", "|", "$|$", "|", "|", { "|", DocSymbol::Perl_char }},
- { SYM(Quot), "\"", "\"", "\"", "&quot;", "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }}
+ { SYM(Quot), "\"", "\"", "\"", "&quot;", "\"", "\"", "\"", { "\"", DocSymbol::Perl_char }},
+ { SYM(Minus), "-", "-", "-", "-", "-\\/", "-", "-", { "-", DocSymbol::Perl_char }}
};
static const int g_numHtmlEntities = (int)(sizeof(g_htmlEntities)/ sizeof(*g_htmlEntities));
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 593c45e..291e1dc 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -1004,6 +1004,16 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int
if (c=='[' || c==']' || c=='*' || c=='+' || c=='-' ||
c=='!' || c=='(' || c==')' || c=='.' || c=='`' || c=='_')
{
+ if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \---
+ {
+ out.addStr(&data[1],3);
+ return 4;
+ }
+ else if (c=='-' && size>2 && data[2]=='-') // \--
+ {
+ out.addStr(&data[1],2);
+ return 3;
+ }
out.addStr(&data[1],1);
return 2;
}