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(); }
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); } }
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); }