Esempio n. 1
0
        void RenderListing(Listing listing, XmlElement container)
        {
            XmlElement listingElement = container.OwnerDocument.CreateElement("list");
            container.AppendChild(listingElement);

            foreach (ListingItem item in listing.Items)
            {
                string elementName = item.IsLast ? "list-item-last" : "list-item";

                XmlElement listingItemElement = container.OwnerDocument.CreateElement(elementName);
                listingElement.AppendChild(listingItemElement);

                RenderBlockSequenceInto(item, listingItemElement, null);
            }
        }
Esempio n. 2
0
        void RenderListing(Listing listing, XmlElement container)
        {
            XmlElement listingElement = container.OwnerDocument.CreateElement("list");
            container.AppendChild(listingElement);

            foreach (ListingItem item in listing.Items)
            {
                XmlElement listingItemElement = container.OwnerDocument.CreateElement("list-item");
                listingElement.AppendChild(listingItemElement);

                RenderBlockSequenceInto(item, listingItemElement);
            }
        }
Esempio n. 3
0
 public virtual void VisitListingItem(Listing listing)
 {
 }
Esempio n. 4
0
        Listing ParseList()
        {
            Listing listing = new Listing();

            Line firstLine = _classifier.PeekLine();

            Debug.Assert(firstLine.Classification == LineClassification.ListItem ||
                         firstLine.Classification == LineClassification.NumeredListItem);

            int indentLevel = firstLine.ClassificationLevel;

            while (!_classifier.AtEnd)
            {
                ListingItem item = ParseListLine();
                listing.Items.Add(item);

                Line line = _classifier.PeekLine();

                // See what the item parser ended on:
                switch (line.Classification)
                {
                    case LineClassification.Comment:
                        _classifier.ReadLine();
                        break;

                    case LineClassification.TableRowSeparator:
                    case LineClassification.TableCellSeparator:
                    case LineClassification.TableClose:
                    case LineClassification.EndOfStream:
                    case LineClassification.Blank:
                        // (A blank line here means a double blank was seen; all lists end)

                        return listing;

                    case LineClassification.ListItem:
                    case LineClassification.NumeredListItem:
                        Debug.Assert(line.ClassificationLevel <= indentLevel);

                        // If the list de-dents, this list is finished:
                        if (line.ClassificationLevel < indentLevel) return listing;

                        // Otherwise, continue parsing lists:
                        break;

                    case LineClassification.Unclassified:
                    case LineClassification.VerbatimBlockLine:
                    case LineClassification.SingleVerbatimBlockLine:
                    case LineClassification.Title:
                    case LineClassification.NumberedTitle:
                    case LineClassification.DefinitionListTerm:
                    default:
                        throw new AdornedTextParsingException(AdornedTextStrings.UnexpectedLineClassificationInList);
                }
            }

            return listing;
        }