protected HtmlElementRule GetElementRule(HtmlElementRule parent, string tag) { HtmlElementOptions defaultFlags = _settings.DefaultOptions | ((_settings.Mode == HtmlFilteringMode.AllowByDefault) ? HtmlElementOptions.SelfClosing | HtmlElementOptions.Allowed | HtmlElementOptions.AllowContent : HtmlElementOptions.Denied); return(GetRuleOrDefault(parent, tag, defaultFlags)); }
IFluentElementRule IFluentElementRule.As(HtmlElementOptions flags) { foreach (IFluentElementRule rule in this) { rule.As(flags); } return(this); }
public IHtmlContent CreateElement(HtmlElementOptions htmlElemenDefinition) { string text = $"{htmlElemenDefinition.Text}" + $"{(htmlElemenDefinition.Elements != null ? String.Join(' ', htmlElemenDefinition.Elements.Select(x => x.ToString())) : String.Empty)}"; return(HtmlBuilder.CreateHtmlContent( new HtmlNodeElement(htmlElemenDefinition.TagName, text) { Attributes = htmlElemenDefinition.Attributes } )); }
public HtmlElementRule(HtmlElementRule parent, string name, HtmlElementOptions flags) { Precondition.Defined(name, () => Error.ArgumentNull("name")); _name = name; _options = flags; _children = new HtmlElementRuleCollection(); _attributes = new HtmlAttributeRuleCollection(); _parent = parent; }
public HtmlElementRule(HtmlElementRule parent, string name, HtmlElementOptions flags) { Precondition.Defined(name, () => Error.ArgumentNull("name")); _name = name; _options = flags; _children = new HtmlElementRuleCollection(); _attributes = new HtmlAttributeRuleCollection(); _parent = parent; }
public override void Execute() { XmlElement element = CreateContainer(); HtmlElementResult result = ConvertElement(_container, element); if (result == null) { return; } HtmlElementRule rule = result.Rule; WriteStartElement(rule, result.Element); if (_renderMode == HtmlElementRenderMode.StartTag) { _contents.Append('>'); return; } WriteElementContents(rule, result.Element); if (_renderMode == HtmlElementRenderMode.EndTag) { _contents.Length = 0; HtmlElementOptions options = rule.Options; if ((rule.Options & HtmlElementOptions.SelfClosing) == HtmlElementOptions.SelfClosing) { rule.Options = (HtmlElementOptions)((byte)rule.Options - 0x04); } WriteEndElement(rule, result.Element); rule.Options = options; if (_contents.Length > 0 && _contents[0] == '>') { _contents.Remove(0, 1); } } else { WriteEndElement(rule, result.Element); } }
protected HtmlElementRule GetRuleOrDefault(HtmlElementRule parent, string tag, HtmlElementOptions options) { parent = parent ?? _settings.Document; return(GetRule(parent, tag) ?? new HtmlElementRule(parent, tag, options)); }
protected HtmlElementRule GetRuleOrDefault(string tag, HtmlElementOptions options) { return(GetRule(tag) ?? new HtmlElementRule(_settings.Document, tag, options)); }
protected HtmlElementRule GetRuleOrDefault(HtmlElementRule parent, string tag, HtmlElementOptions options) { parent = parent ?? _settings.Document; return GetRule(parent, tag) ?? new HtmlElementRule(parent, tag, options); }
protected HtmlElementRule GetRuleOrDefault(string tag, HtmlElementOptions options) { return GetRule(tag) ?? new HtmlElementRule(_settings.Document, tag, options); }
IFluentElementRule IFluentElementRule.As(HtmlElementOptions flags) { _options = flags; return this; }
IFluentElementRule IFluentElementRule.As(HtmlElementOptions flags) { _options = flags; return(this); }