/// <summary>
 /// Visits the attribute entry.
 /// </summary>
 /// <param name="attributeEntry">The attribute entry.</param>
 public virtual void VisitAttributeEntry(AttributeEntry attributeEntry)
 {
     if (attributeEntry == null)
     {
         return;
     }
     if (!string.IsNullOrEmpty(attributeEntry.Value))
     {
         _writer.WriteLine(":{0}: {1}", attributeEntry.Name, attributeEntry.Value);
     }
     else
     {
         _writer.WriteLine(":{0}:", attributeEntry.Name);
     }
     _writer.WriteLine();
 }
        private static AttributeEntry ParseAttributeEntry(string input)
        {
            var match = PatternMatcher.AttributeEntry.Match(input);

            if (!match.Success)
            {
                throw new ArgumentException("not an attribute entry");
            }

            var            name = match.Groups["name"].Value.ToLowerInvariant();
            AttributeEntry attributeEntry;

            if (name.StartsWith("!"))
            {
                attributeEntry = new UnsetAttributeEntry(name.Substring(1));
            }
            else if (name.EndsWith("!"))
            {
                attributeEntry = new UnsetAttributeEntry(name.Substring(0, name.Length - 1));
            }
            else
            {
                switch (name)
                {
                case "author":
                    attributeEntry = new AuthorInfoAttributeEntry(match.Groups["value"].Value);
                    break;

                default:
                    attributeEntry = new AttributeEntry(name, match.Groups["value"].Value);
                    break;
                }
            }

            return(attributeEntry);
        }
Exemple #3
0
 /// <summary>
 /// Visits the attribute entry.
 /// </summary>
 /// <param name="attributeEntry">The attribute entry.</param>
 public virtual void VisitAttributeEntry(AttributeEntry attributeEntry)
 {
 }
Exemple #4
0
 public virtual void Visit(AttributeEntry attributeEntry)
 {
     _attributeEntries[attributeEntry.Name] = attributeEntry;
 }