Exemplo n.º 1
0
        public ElementInfo GetClosingElementInfo(ISpanElement currentSpanElement)
        {
            var position = CurrentPosition;

            for (; position < markdown.Length; position++)
            {
                if (currentSpanElement != null)
                {
                    var elementInfo = GetClosingTag(position, currentSpanElement.GetClosingIndicator());
                    if (elementInfo != null)
                    {
                        var positionToCheck = elementInfo.OpeningIndex + elementInfo.Length;
                        if (positionToCheck < markdown.Length && markdown.ElementAt(positionToCheck) != ' ')
                        {
                            var potentialClosingTag = String.Concat(currentSpanElement.GetClosingIndicator(),
                                                                    markdown.ElementAt(positionToCheck));
                            if (!IsSpanElementClosing(potentialClosingTag, positionToCheck))
                            {
                                return(null);
                            }
                        }

                        return(elementInfo);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public HtmlTag WrapTag(ElementInfo elementInfo, ISpanElement spanElement)
        {
            var tagContent = markdown.Substring(CurrentPosition, elementInfo.OpeningIndex - CurrentPosition);

            CurrentPosition = elementInfo.ClosingIndex + 1;
            if (tagContent == String.Empty)
            {
                tagContent  = String.Concat(spanElement.GetOpeningIndicator(), spanElement.GetClosingIndicator());
                spanElement = null;
            }
            return(new HtmlTag(tagContent, spanElement));
        }