コード例 #1
0
 public static bool ContainBlockName(this AttributeList attributes, string[] blockNames)
 {
     if (attributes == null || attributes.Count == 0)
     {
         return(false);
     }
     return(attributes.Any(a => blockNames.Contains(a.Name, StringComparer.OrdinalIgnoreCase)));
 }
コード例 #2
0
 public static bool ContainBlockName(this AttributeList attributes, string blockName)
 {
     if (attributes == null || attributes.Count == 0)
     {
         return(false);
     }
     return(attributes.Any(a => a.Name.Equals(blockName)));
 }
コード例 #3
0
ファイル: AsciidocVisitor.cs プロジェクト: rlundy/asciidocnet
        /// <summary>
        /// Visits the attribute list.
        /// </summary>
        /// <param name="attributes">The attributes.</param>
        public virtual void VisitAttributeList(AttributeList attributes)
        {
            if (attributes == null)
            {
                return;
            }
            if (attributes.HasAnchor)
            {
                attributes.Anchor.Accept(this);
            }

            if (attributes.IsDiscrete)
            {
                _writer.WriteLine("[discrete]");
            }
            else if (attributes.IsFloating)
            {
                _writer.WriteLine("[float]");
            }

            if (attributes.Any())
            {
                _writer.Write("[");
                for (int index = 0; index < attributes.Count; index++)
                {
                    var lastAttribute  = index == attributes.Count - 1;
                    var asciiAttribute = attributes[index];
                    asciiAttribute.Accept(this);

                    if (!lastAttribute)
                    {
                        _writer.Write(",");
                    }
                }
                _writer.WriteLine("]");
            }

            if (attributes.HasTitle)
            {
                attributes.Title.Accept(this);
            }
        }