예제 #1
0
        private void ParseCode(Tag tag, Token[] tokens)
        {
            var codeReference = tag.Reference as ICodeBlockTagReference;

            for (var i = 0; i < tokens.Length; ++i)
            {
                Content tkContent = null;

                if (tokens[i].Category == TokenCategory.Word)
                {
                    // check if the word is a keyword
                    var tkKeyword = tokens[i];
                    if (codeReference?.IsKeyword(tkKeyword) == true)
                    {
                        tkContent = new SpecialContent(codeKeywordContentReference, tkKeyword);
                    }
                }
                //todo: parse comments (check for special symbols)

                if (tkContent == null)
                {
                    tkContent = CreateContent(tokens[i]);
                }

                tag.Add(tkContent);
            }
        }
예제 #2
0
        internal bool TryCreate(string code, out SpecialContent emoji)
        {
            code = code.ToUpperInvariant();
            if (KnownCodes.ContainsKey(code))
            {
                emoji = new SpecialContent(this, code);
                return(true);
            }

            emoji = null;
            return(false);
        }