public AddAttribute ( string name, string val ) : void | ||
name | string | |
val | string | |
return | void |
public virtual void Check(Lexer lexer, Node node) { node.CheckUniqueAttributes(lexer); AttVal lang = node.GetAttrByName("language"); AttVal type = node.GetAttrByName("type"); if (type == null) { Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE); /* check for javascript */ if (lang != null) { string str = lang.Val; if (str.Length > 10) { str = str.Substring(0, 10); } if ((String.CompareOrdinal(str, "javascript") == 0) || (String.CompareOrdinal(str, "jscript") == 0)) { node.AddAttribute("type", "text/javascript"); } } else { node.AddAttribute("type", "text/javascript"); } } }
public virtual void Check(Lexer lexer, Node node) { node.CheckUniqueAttributes(lexer); AttVal lang = node.GetAttrByName("language"); AttVal type = node.GetAttrByName("type"); if (type == null) { Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE); /* check for javascript */ if (lang != null) { string str = lang.Val; if (str.Length > 10) { str = str.Substring(0, 10); } if ((String.CompareOrdinal(str, "javascript") == 0) || (String.CompareOrdinal(str, "jscript") == 0)) { node.AddAttribute("type", "text/javascript"); } } else { node.AddAttribute("type", "text/javascript"); } } }
public static void AddClass(Node node, 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.Val = classattr.Val + " " + classname; } /* create new class attribute */ else { node.AddAttribute("class", classname); } }
/* Replace implicit blockquote by div with an indent taking care to reduce nested blockquotes to a single div with the indent set to match the nesting depth */ public virtual void Bq2Div(Node node) { while (node != null) { if (node.Tag == _tt.TagBlockquote && node.Isimplicit) { int indent = 1; while (node.HasOneChild() && node.Content.Tag == _tt.TagBlockquote && node.Isimplicit) { ++indent; StripOnlyChild(node); } if (node.Content != null) { Bq2Div(node.Content); } string indentBuf = "margin-left: " + (2*indent).ToString() + "em"; node.Element = _tt.TagDiv.Name; node.Tag = _tt.TagDiv; node.AddAttribute("style", indentBuf); } else if (node.Content != null) { Bq2Div(node.Content); } node = node.Next; } }
/* duplicate name attribute as an id */ public virtual void FixId(Node node) { AttVal name = node.GetAttrByName("name"); AttVal id = node.GetAttrByName("id"); if (name != null) { if (id != null) { if (!id.Val.Equals(name.Val)) { Report.AttrError(this, node, "name", Report.ID_NAME_MISMATCH); } } else if (Options.XmlOut) { node.AddAttribute("id", name.Val); } } }
public static void AddClass(Node node, 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.Val = classattr.Val + " " + classname; } /* create new class attribute */ else { node.AddAttribute("class", classname); } }