diff options
author | albert-github <albert.tests@gmail.com> | 2018-10-12 17:22:07 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2018-10-12 17:22:07 (GMT) |
commit | 7ef3ba54570275a423ce52f65437607446c15b12 (patch) | |
tree | a2895337962b136e5344cb943ed8d63b2d203fcf /src | |
parent | 59699e3771cf70a3faa988f929dc3fb462413872 (diff) | |
download | Doxygen-7ef3ba54570275a423ce52f65437607446c15b12.zip Doxygen-7ef3ba54570275a423ce52f65437607446c15b12.tar.gz Doxygen-7ef3ba54570275a423ce52f65437607446c15b12.tar.bz2 |
Bug 719541 - Error with inserting images to PDF with Markdown
Create possibility to use images in other output formats conform the `\image` command.
Diffstat (limited to 'src')
-rw-r--r-- | src/markdown.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp index c19d6db..5310a29 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -647,6 +647,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 +875,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 { |