Ejemplo n.º 1
0
        public HtmlTypographer(string input,
                               HtmlTypographerSettings settings,
                               HtmlTypographerState state)
        {
            Precondition.Require(input, () => Error.ArgumentNull("input"));

            _input    = new StringBuffer(input);
            _output   = new StringBuilder();
            _state    = state ?? new HtmlTypographerState();
            _settings = settings ?? new HtmlTypographerSettings();
        }
Ejemplo n.º 2
0
        public HtmlTypographer(string input, 
			HtmlTypographerSettings settings, 
			HtmlTypographerState state)
        {
			Precondition.Require(input, () => Error.ArgumentNull("input"));
			
			_input = new StringBuffer(input);
			_output = new StringBuilder();
			_state = state ?? new HtmlTypographerState();
			_settings = settings ?? new HtmlTypographerSettings();
        }
Ejemplo n.º 3
0
        protected virtual void WriteText(HtmlElementRule rule, string text)
        {
            if ((rule.Options & HtmlElementOptions.UseTypography) ==
                HtmlElementOptions.UseTypography)
            {
                HtmlTypographer typographer = new HtmlTypographer(text, Typographics, _lastState);
                typographer.Formatter = (element, mode) => FormatElement(rule, element, mode);

                bool lastValue = typographer.Settings.InsertNoBreakTags;
                if (String.Equals(rule.Name, "nobr", StringComparison.OrdinalIgnoreCase))
                {
                    typographer.Settings.InsertNoBreakTags = false;
                }

                _writer.WriteRaw(typographer.Execute());

                typographer.Settings.InsertNoBreakTags = lastValue;
                _lastState = typographer.State;
            }
            else
            {
                _writer.WriteString(text);
            }
        }
Ejemplo n.º 4
0
		protected virtual void WriteText(HtmlElementRule rule, string text)
		{
			if ((rule.Options & HtmlElementOptions.UseTypography) == 
				HtmlElementOptions.UseTypography)
			{
				HtmlTypographer typographer = new HtmlTypographer(text, Typographics, _lastState);
				typographer.Formatter = (element, mode) => FormatElement(rule, element, mode);

				bool lastValue = typographer.Settings.InsertNoBreakTags;
				if (String.Equals(rule.Name, "nobr", StringComparison.OrdinalIgnoreCase))
					typographer.Settings.InsertNoBreakTags = false;

				_writer.WriteRaw(typographer.Execute());

				typographer.Settings.InsertNoBreakTags = lastValue;
				_lastState = typographer.State;
			}
			else
				_writer.WriteString(text);
		}