示例#1
0
        /* Function: GetAllHTMLTagProperties
         * If <Type> is <JavadocElementType.HTMLTag>, this generates a dictionary of all the properties in the tag, if any.
         */
        public Dictionary <string, string> GetAllHTMLTagProperties()
        {
            if (type != JavadocElementType.HTMLTag)
            {
                throw new InvalidOperationException();
            }

            Dictionary <string, string> properties = new Dictionary <string, string>();

            Match             match    = HTMLTagRegex.Match(RawText, RawTextIndex, length);
            CaptureCollection captures = match.Groups[2].Captures;

            foreach (Capture capture in captures)
            {
                Match propertyMatch = HTMLTagPropertyRegex.Match(RawText, capture.Index, capture.Length);
                properties.Add(propertyMatch.Groups[1].ToString(),
                               DecodeHTMLPropertyValue(propertyMatch.Groups[2].Index, propertyMatch.Groups[2].Length));
            }

            return(properties);
        }
示例#2
0
        /* Function: HTMLTagProperty
         * If <Type> is <JavadocElementType.HTMLTag>, return the value of the passed property, or null if it doesn't exist.  The property
         * name is case-insensitive.
         */
        public string HTMLTagProperty(string name)
        {
            if (type != JavadocElementType.HTMLTag)
            {
                throw new InvalidOperationException();
            }

            Match             match    = HTMLTagRegex.Match(RawText, RawTextIndex, length);
            CaptureCollection captures = match.Groups[2].Captures;

            foreach (Capture capture in captures)
            {
                Match propertyMatch = HTMLTagPropertyRegex.Match(RawText, capture.Index, capture.Length);

                if (name.Length == propertyMatch.Groups[1].Length &&
                    string.Compare(name, 0, RawText, propertyMatch.Groups[1].Index, name.Length, true) == 0)
                {
                    return(DecodeHTMLPropertyValue(propertyMatch.Groups[2].Index, propertyMatch.Groups[2].Length));
                }
            }

            return(null);
        }