summaryrefslogtreecommitdiffstats
path: root/src/rtfdocvisitor.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2018-10-01 16:58:03 (GMT)
committeralbert-github <albert.tests@gmail.com>2018-10-01 16:58:03 (GMT)
commit47fee387821113956e10fffa79ea22062de8c817 (patch)
tree7762308ebbeb2f3465b6515450e2314ab048eb6f /src/rtfdocvisitor.cpp
parentd7d4d5c443887cc63211febe40d43f26dfe41bc0 (diff)
downloadDoxygen-47fee387821113956e10fffa79ea22062de8c817.zip
Doxygen-47fee387821113956e10fffa79ea22062de8c817.tar.gz
Doxygen-47fee387821113956e10fffa79ea22062de8c817.tar.bz2
issue_6517: Emoji support
Added issue support for the different output types. - Sources of the emoji - based on the Unicode definition v11.0: - https://unicode.org/emoji/charts/full-emoji-list.html - http://www.unicode.org/emoji/charts/full-emoji-modifiers.html - github definition list: - https://api.github.com/emojis - Input of emoji: :<test>: with the restriction that direct after the opening colon and direct before the closing colon no space is allowed - doctokinizer.l, adding detection of emoji and new command `\:` - doktokinizer.h, adding "word" type TK_EMOJI - docparser.* handling of new "word" type TK_EMOJI (analogous to HTML Entities), handling of new command `\:` - cmdmapper,cpp, cmdmapper.h, adding new command `\:` - htmlentity.cpp, adding new definition required for new command `\:` - Emoji - emoji.cpp, emoji.h, class for handling emoji analogous to HTML Entities, including small directions on how to update the code when a new emoji is defined. Not everything is converted to lowercase for comparison and accents are removed. - doxygen.cpp possibility to create list of supported emoji - handling emoji for output types (analogous to HTML Entities), see documentation for different output types - docparser.h, *docvisitor.* - rtfdocvisitor.* converting output to UTF-16 (based on http://scruss.com/blog/2017/03/12/in-the-unlikely-event-you-need-to-represent-emoji-in-rtf-using-perl/) - latexdocvisitor.*, handling arguments for emoji in output (see also latexgen.cpp for meaning of the arguments of doxygenemoji). - latexgen.cpp, adding new latex command for doxygen (doxygenemoji) and prevent too many open file (code before documentclass) - config.xml, definition of `LATEX_EMOJI_DIRECTORY` with path to images required for LaTeX output - Documentation: - emojisup.doc, user description - commands.doc, description of new command `\:` - index.doc, reference to emoji chapter - xmlcmds.doc, adjust reference to next chapter as a new chapter is added - Doxyfile*, adding emoji chapter Build system - CMakeLists.txt adding new files
Diffstat (limited to 'src/rtfdocvisitor.cpp')
-rw-r--r--src/rtfdocvisitor.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 7fbfdc8..941b937 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -34,6 +34,7 @@
#include "filedef.h"
#include "config.h"
#include "htmlentity.h"
+#include "emoji.h"
#include "plantuml.h"
//#define DBG_RTF(x) m_t << x
@@ -136,6 +137,48 @@ void RTFDocVisitor::visit(DocSymbol *s)
m_lastIsPara=FALSE;
}
+void RTFDocVisitor::visit(DocEmoji *s)
+{
+ if (m_hide) return;
+ DBG_RTF("{\\comment RTFDocVisitor::visit(DocEmoji)}\n");
+ const char *res = EmojiEntityMapper::instance()->rtf(s->emoji());
+ if (res)
+ {
+ const char *p = res;
+ int val = 0;
+ int val1 = 0;
+ while (*p)
+ {
+ switch(*p)
+ {
+ case '&': case '#': case 'x':
+ break;
+ case ';':
+ val1 = val;
+ val = 0xd800 + ( ( val1 - 0x10000 ) & 0xffc00 ) / 0x400 - 0x10000;
+ m_t << "\\u" << val << "?";
+ val = 0xdC00 + ( ( val1 - 0x10000 ) & 0x3ff ) - 0x10000 ;
+ m_t << "\\u" << val << "?";
+ val = 0;
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ val = val * 16 + *p - '0';
+ break;
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ val = val * 16 + *p - 'a' + 10;
+ break;
+ }
+ p++;
+ }
+ }
+ else
+ {
+ err("RTF: non supported Emoji-entity found: %s\n",EmojiEntityMapper::instance()->html(s->emoji()));
+ }
+ m_lastIsPara=FALSE;
+}
+
void RTFDocVisitor::visit(DocURL *u)
{
if (m_hide) return;