protected virtual string FormatElement(HtmlElementBuilder element,
                                               HtmlElementRenderMode mode)
        {
            Precondition.Require(element, () => Error.ArgumentNull("element"));

            if (Formatter == null)
            {
                return(element.ToString(mode));
            }

            return(Formatter(element, mode));
        }
Beispiel #2
0
        protected string FormatElement(HtmlElementRule parent,
                                       HtmlElementBuilder element, HtmlElementRenderMode renderMode)
        {
            using (StringWriter writer = new StringWriter())
            {
                HtmlFormatterFilter filter = new HtmlFormatterFilter(
                    _settings, parent, element, writer);

                filter.RenderMode = renderMode;
                filter.Parameters = Parameters;
                filter.Execute();

                return(writer.ToString());
            }
        }
Beispiel #3
0
        public string ToString(HtmlElementRenderMode renderMode)
        {
            switch (renderMode)
            {
            case HtmlElementRenderMode.StartTag:
                return(String.Format(CultureInfo.InvariantCulture,
                                     _elementFormatStartTag, _name, _attributes.ToString()));

            case HtmlElementRenderMode.EndTag:
                return(String.Format(CultureInfo.InvariantCulture,
                                     _elementFormatEndTag, _name));

            default:
                if (_content == null)
                {
                    return(String.Format(CultureInfo.InvariantCulture,
                                         _elementFormatSelfClosing, _name, _attributes.ToString()));
                }

                return(String.Format(CultureInfo.InvariantCulture,
                                     _elementFormatNormal, _name, _attributes.ToString(), _content));
            }
        }
		protected string FormatElement(HtmlElementRule parent,
			HtmlElementBuilder element, HtmlElementRenderMode renderMode)
		{
			using (StringWriter writer = new StringWriter())
			{
				HtmlFormatterFilter filter = new HtmlFormatterFilter(
					_settings, parent, element, writer);
				
				filter.RenderMode = renderMode;
				filter.Parameters = Parameters;
				filter.Execute();

				return writer.ToString();
			}
		}
        public string ToString(HtmlElementRenderMode renderMode)
        {
            switch (renderMode)
            {
                case HtmlElementRenderMode.StartTag:
                    return String.Format(CultureInfo.InvariantCulture, 
                        _elementFormatStartTag, _name, _attributes.ToString());

                case HtmlElementRenderMode.EndTag:
                    return String.Format(CultureInfo.InvariantCulture, 
                        _elementFormatEndTag, _name);

                default:
                    if (_content == null)
                        return String.Format(CultureInfo.InvariantCulture, 
                            _elementFormatSelfClosing, _name, _attributes.ToString());

                    return String.Format(CultureInfo.InvariantCulture, 
                        _elementFormatNormal, _name, _attributes.ToString(), _content);
            }
        }
        protected virtual string FormatElement(HtmlElementBuilder element,
            HtmlElementRenderMode mode)
        {
            Precondition.Require(element, () => Error.ArgumentNull("element"));

            if (Formatter == null)
                return element.ToString(mode);
            
			return Formatter(element, mode);
        }