Ejemplo n.º 1
0
 /// <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();
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Visits the attribute entry.
 /// </summary>
 /// <param name="attributeEntry">The attribute entry.</param>
 public virtual void VisitAttributeEntry(AttributeEntry attributeEntry)
 {
 }
Ejemplo n.º 4
0
 public virtual void Visit(AttributeEntry attributeEntry)
 {
     _attributeEntries[attributeEntry.Name] = attributeEntry;
 }