Exemplo n.º 1
0
        /// <summary>
        /// Erweitert das letzte Morphem
        /// </summary>
        /// <param name="text">Der Text</param>
        private void Append(string text = null)
        {
            var morpheme = new MarkdownMorpheme()
            {
            };

            if (Stack.Count == 0)
            {
                morpheme.Type = MarkdownMorphemeState.Text;
                if (!string.IsNullOrWhiteSpace(text?.Trim()))
                {
                    morpheme.Text.Append(text?.Trim());
                }

                Stack.Push(morpheme);

                return;
            }

            var peek = Stack.Peek();

            if (peek.Text.Length > 0)
            {
                peek.Text.Append(" ");
            }

            peek.Text.Append(text?.Trim());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fügt ein neues Morphem hinzu
        /// </summary>
        /// <param name="type">Der Typ</param>
        /// <param name="text">Der Text</param>
        private void Push(MarkdownMorphemeState type, string text = null)
        {
            var morpheme = new MarkdownMorpheme()
            {
                Type = type
            };


            if (!string.IsNullOrWhiteSpace(text?.Trim()))
            {
                morpheme.Text.Append(text?.Trim());
            }

            Stack.Push(morpheme);
        }