예제 #1
0
        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));
        }
예제 #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());
            }
        }
예제 #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));
            }
        }
예제 #4
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();
			}
		}
        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);
        }