/// <summary>
        /// </summary>
        /// <param name="markdown">
        /// </param>
        /// <param name="xml">
        /// </param>
        private void WriteYamlMetadata(
            MarkdownReader markdown,
            XmlWriter xml)
        {
            // Deserialize the YAML text.
            var    deserializer = new Deserializer();
            string text         = markdown.Text;

            text = text.TrimEnd()
                   .TrimEnd('-')
                   .TrimEnd();
            var stringReader = new StringReader(text);

            object objects = deserializer.Deserialize(stringReader);

            // Create the metadata from the object graph.
            var metadata = new MetadataInfo();

            metadata.AddYamlObjects(objects);

            // Use the resulting metadata to write out the elements.
            this.WriteMetadata(xml, metadata);
        }
        /// <summary>
        /// Writes out the elements of the metadata to the XML writer.
        /// </summary>
        /// <param name="xml">
        /// </param>
        /// <param name="metadata">
        /// </param>
        private void WriteMetadata(
            XmlWriter xml,
            MetadataInfo metadata)
        {
            // See if we need to write the title tag outside the info
            // block.
            if (metadata.HasTitle && this.TitleOutsideInfo)
            {
                WriteMetadataTitle(xml, metadata);
            }

            // We only write an info element if we have at least one
            // element that needs to be written out.
            bool titleInInfo = metadata.HasTitle && !this.TitleOutsideInfo;
            bool needsInfo   = metadata.HasNonTitleMetadata;

            if (titleInInfo || needsInfo)
            {
                // Write out the info tag first.
                xml.WriteStartElement("info");

                // Write out the info, if we have it.
                if (titleInInfo)
                {
                    WriteMetadataTitle(xml, metadata);
                }

                WriteMetadataCopyright(xml, metadata);
                WriteMetadataDate(xml, metadata);
                WriteMetadataSummary(xml, metadata);
                WriteMetadataSchemes(xml, metadata);

                // Finish up the info tag.
                xml.WriteEndElement();
            }
        }
 /// <summary>
 /// </summary>
 /// <param name="xml">
 /// </param>
 /// <param name="metadata">
 /// </param>
 private static void WriteMetadataTitle(
     XmlWriter xml,
     MetadataInfo metadata)
 {
     xml.WriteElementString("title", metadata.Title);
 }