summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index dff64ff..59ce108 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -76,7 +76,7 @@
// so for example *bla (*.txt) is cool*
#define ignoreCloseEmphChar(i) \
(data[i]=='(' || data[i]=='{' || data[i]=='[' || data[i]=='<' || \
- data[i]=='=' || data[i]=='+' || data[i]=='-' || data[i]=='\\' || \
+ data[i]=='\\' || \
data[i]=='@')
//----------
@@ -396,9 +396,11 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c)
data[i-1]!='\n'
)
{
- out.addStr("<strong>");
+ if (c == '~') out.addStr("<strike>");
+ else out.addStr("<strong>");
processInline(out,data,i);
- out.addStr("</strong>");
+ if (c == '~') out.addStr("</strike>");
+ else out.addStr("</strong>");
return i + 2;
}
i++;
@@ -406,7 +408,7 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c)
return 0;
}
-/** Parsing tripple emphasis.
+/** Parsing triple emphasis.
* Finds the first closing tag, and delegates to the other emph
*/
static int processEmphasis3(GrowBuf &out, const char *data, int size, char c)
@@ -616,7 +618,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
char c = data[0];
int ret;
- if (size>2 && data[1]!=c) // _bla or *bla
+ if (size>2 && c!='~' && data[1]!=c) // _bla or *bla
{
// whitespace cannot follow an opening emphasis
if (data[1]==' ' || data[1]=='\n' ||
@@ -635,7 +637,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
}
return ret+2;
}
- if (size>4 && data[1]==c && data[2]==c && data[3]!=c) // ___bla or ***bla
+ if (size>4 && c!='~' && data[1]==c && data[2]==c && data[3]!=c) // ___bla or ***bla
{
if (data[3]==' ' || data[3]=='\n' ||
(ret = processEmphasis3(out, data+3, size-3, c)) == 0)
@@ -647,6 +649,27 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
return 0;
}
+static void writeMarkdownImage(GrowBuf &out, const char *fmt, bool explicitTitle, QCString title, QCString content, QCString link, FileDef *fd)
+{
+ out.addStr("@image ");
+ out.addStr(fmt);
+ out.addStr(" ");
+ out.addStr(link.mid(fd ? 0 : 5));
+ if (!explicitTitle && !content.isEmpty())
+ {
+ out.addStr(" \"");
+ out.addStr(content);
+ out.addStr("\"");
+ }
+ else if ((content.isEmpty() || explicitTitle) && !title.isEmpty())
+ {
+ out.addStr(" \"");
+ out.addStr(title);
+ out.addStr("\"");
+ }
+ out.addStr("\n");
+}
+
static int processLink(GrowBuf &out,const char *data,int,int size)
{
QCString content;
@@ -854,20 +877,10 @@ static int processLink(GrowBuf &out,const char *data,int,int size)
(fd=findFileDef(Doxygen::imageNameDict,link,ambig)))
// assume doxygen symbol link or local image link
{
- out.addStr("@image html ");
- out.addStr(link.mid(fd ? 0 : 5));
- if (!explicitTitle && !content.isEmpty())
- {
- out.addStr(" \"");
- out.addStr(content);
- out.addStr("\"");
- }
- else if ((content.isEmpty() || explicitTitle) && !title.isEmpty())
- {
- out.addStr(" \"");
- out.addStr(title);
- out.addStr("\"");
- }
+ writeMarkdownImage(out, "html", explicitTitle, title, content, link, fd);
+ writeMarkdownImage(out, "latex", explicitTitle, title, content, link, fd);
+ writeMarkdownImage(out, "rtf", explicitTitle, title, content, link, fd);
+ writeMarkdownImage(out, "docbook", explicitTitle, title, content, link, fd);
}
else
{
@@ -2513,6 +2526,7 @@ QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,cons
// setup callback table for special characters
g_actions[(unsigned int)'_']=processEmphasis;
g_actions[(unsigned int)'*']=processEmphasis;
+ g_actions[(unsigned int)'~']=processEmphasis;
g_actions[(unsigned int)'`']=processCodeSpan;
g_actions[(unsigned int)'\\']=processSpecialCommand;
g_actions[(unsigned int)'@']=processSpecialCommand;