예제 #1
0
        /* remove attribute from node then free it */
        public virtual void  removeAttribute(AttVal attr)
        {
            AttVal av;
            AttVal prev = null;
            AttVal next;

            for (av = this.attributes; av != null; av = next)
            {
                next = av.next;

                if (av == attr)
                {
                    if (prev != null)
                    {
                        prev.next = next;
                    }
                    else
                    {
                        this.attributes = next;
                    }
                }
                else
                {
                    prev = av;
                }
            }
        }
예제 #2
0
        public virtual System.Object Clone()
        {
            AttVal av = new AttVal();

            if (next != null)
            {
                av.next = (AttVal)next.Clone();
            }
            if (attribute != null)
            {
                av.attribute = attribute;
            }
            if (value_Renamed != null)
            {
                av.value_Renamed = value_Renamed;
            }
            av.delim = delim;
            if (asp != null)
            {
                av.asp = (Node)asp.Clone();
            }
            if (php != null)
            {
                av.php = (Node)php.Clone();
            }
            av.dict = AttributeTable.DefaultAttributeTable.findAttribute(this);
            return(av);
        }
예제 #3
0
 public IStack()
 {
     next       = null;
     tag        = null;
     element    = null;
     attributes = null;
 }
예제 #4
0
            public virtual void  check(Lexer lexer, Node node, AttVal attval)
            {
                System.String value_Renamed;

                value_Renamed = attval.value_Renamed;

                if (value_Renamed == null)
                {
                    Report.attrError(lexer, node, attval.attribute, Report.MISSING_ATTR_VALUE);
                }
                else if (Lexer.wstrcasecmp(value_Renamed, "top") == 0 || Lexer.wstrcasecmp(value_Renamed, "middle") == 0 || Lexer.wstrcasecmp(value_Renamed, "bottom") == 0 || Lexer.wstrcasecmp(value_Renamed, "baseline") == 0)
                {
                    /* all is fine */
                }
                else if (Lexer.wstrcasecmp(value_Renamed, "left") == 0 || Lexer.wstrcasecmp(value_Renamed, "right") == 0)
                {
                    if (!(node.tag != null && ((node.tag.model & Dict.CM_IMG) != 0)))
                    {
                        Report.attrError(lexer, node, value_Renamed, Report.BAD_ATTRIBUTE_VALUE);
                    }
                }
                else if (Lexer.wstrcasecmp(value_Renamed, "texttop") == 0 || Lexer.wstrcasecmp(value_Renamed, "absmiddle") == 0 || Lexer.wstrcasecmp(value_Renamed, "absbottom") == 0 || Lexer.wstrcasecmp(value_Renamed, "textbottom") == 0)
                {
                    lexer.versions &= Dict.VERS_PROPRIETARY;
                    Report.attrError(lexer, node, value_Renamed, Report.PROPRIETARY_ATTR_VALUE);
                }
                else
                {
                    Report.attrError(lexer, node, value_Renamed, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
예제 #5
0
 public AttVal(AttVal next, Attribute dict, int delim, System.String attribute, System.String value_Renamed)
 {
     this.next          = next;
     this.dict          = dict;
     this.asp           = null;
     this.php           = null;
     this.delim         = delim;
     this.attribute     = attribute;
     this.value_Renamed = value_Renamed;
 }
예제 #6
0
 public AttVal()
 {
     this.next          = null;
     this.dict          = null;
     this.asp           = null;
     this.php           = null;
     this.delim         = 0;
     this.attribute     = null;
     this.value_Renamed = null;
 }
예제 #7
0
 public virtual void  check(Lexer lexer, Node node, AttVal attval)
 {
     if (attval.value_Renamed == null)
     {
         Report.attrError(lexer, node, attval.attribute, Report.MISSING_ATTR_VALUE);
     }
     else if (lexer.configuration.FixBackslash)
     {
         attval.value_Renamed = attval.value_Renamed.Replace('\\', '/');
     }
 }
예제 #8
0
        /// <summary>
        /// Public method for finding attribute definition by name
        /// </summary>
        /// <param name="attval"></param>
        /// <returns></returns>
        public virtual Attribute findAttribute(AttVal attval)
        {
            Attribute np;

            if (attval.attribute != null)
            {
                np = Lookup(attval.attribute);
                return(np);
            }

            return(null);
        }
예제 #9
0
            public virtual void  Check(Lexer lexer, Node node)
            {
                AttVal type = node.getAttrByName("type");

                node.checkUniqueAttributes(lexer);

                if (type == null)
                {
                    Report.attrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                    node.addAttribute("type", "text/css");
                }
            }
예제 #10
0
        /*
         * Add class="foo" to node
         */
        public static void  addClass(Node node, System.String classname)
        {
            AttVal classattr = node.getAttrByName("class");

            /*
             * if there already is a class attribute
             * then append class name after a space
             */
            if (classattr != null)
            {
                classattr.value_Renamed = classattr.value_Renamed + " " + classname;
            }
            /* create new class attribute */
            else
            {
                node.addAttribute("class", classname);
            }
        }
예제 #11
0
            public virtual void  Check(Lexer lexer, Node node)
            {
                AttVal rel = node.getAttrByName("rel");

                node.checkUniqueAttributes(lexer);

                if (rel != null && rel.value_Renamed != null && rel.value_Renamed.Equals("stylesheet"))
                {
                    AttVal type = node.getAttrByName("type");

                    if (type == null)
                    {
                        Report.attrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);

                        node.addAttribute("type", "text/css");
                    }
                }
            }
예제 #12
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="type"></param>
 /// <param name="textarray"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 public Node(short type, sbyte[] textarray, int start, int end)
 {
     this.parent           = null;
     this.prev             = null;
     this.next             = null;
     this.last             = null;
     this.start            = start;
     this.end              = end;
     this.textarray        = textarray;
     this.type             = type;
     this.closed           = false;
     this.implicit_Renamed = false;
     this.linebreak        = false;
     this.was              = null;
     this.tag              = null;
     this.element          = null;
     this.attributes       = null;
     this.content          = null;
 }
예제 #13
0
            public virtual void  check(Lexer lexer, Node node, AttVal attval)
            {
                System.String value_Renamed;

                /* IMG, OBJECT, APPLET and EMBED use align for vertical position */
                if (node.tag != null && ((node.tag.model & Dict.CM_IMG) != 0))
                {
                    Comzept.Genesis.Tidy.AttrCheckImpl.getCheckValign().check(lexer, node, attval);
                    return;
                }

                value_Renamed = attval.value_Renamed;

                if (value_Renamed == null)
                {
                    Report.attrError(lexer, node, attval.attribute, Report.MISSING_ATTR_VALUE);
                }
                else if (!(Lexer.wstrcasecmp(value_Renamed, "left") == 0 || Lexer.wstrcasecmp(value_Renamed, "center") == 0 || Lexer.wstrcasecmp(value_Renamed, "right") == 0 || Lexer.wstrcasecmp(value_Renamed, "justify") == 0))
                {
                    Report.attrError(lexer, node, attval.value_Renamed, Report.BAD_ATTRIBUTE_VALUE);
                }
            }
예제 #14
0
        public virtual void  addAttribute(System.String name, System.String value_Renamed)
        {
            AttVal av = new AttVal(null, null, null, null, '"', name, value_Renamed);

            av.dict = AttributeTable.DefaultAttributeTable.findAttribute(av);

            if (this.attributes == null)
            {
                this.attributes = av;
            }
            /* append to end of attributes */
            else
            {
                AttVal here = this.attributes;

                while (here.next != null)
                {
                    here = here.next;
                }

                here.next = av;
            }
        }
예제 #15
0
 public Node(short type, sbyte[] textarray, int start, int end, System.String element, TagTable tt)
 {
     this.parent           = null;
     this.prev             = null;
     this.next             = null;
     this.last             = null;
     this.start            = start;
     this.end              = end;
     this.textarray        = textarray;
     this.type             = type;
     this.closed           = false;
     this.implicit_Renamed = false;
     this.linebreak        = false;
     this.was              = null;
     this.tag              = null;
     this.element          = element;
     this.attributes       = null;
     this.content          = null;
     if (type == StartTag || type == StartEndTag || type == EndTag)
     {
         tt.findTag(this);
     }
 }
예제 #16
0
 public virtual void  check(Lexer lexer, Node node, AttVal attval)
 {
 }