public NoBreakHyphen AddNoBreakHyphen() { var noBreakHyphen = NoBreakHyphen.Create(); Xml.Add(noBreakHyphen.Xml); return(noBreakHyphen); }
public void InsertNoBreakHyphen(IElementContext context, NoBreakHyphen hyphen) { context.AddMutation(new TextInsertion { Position = context.TextIndex, Text = "‑" }); }
public bool ProcessElement(IElementProcessingState state, NoBreakHyphen noBreakHyphen) { state.CurrentVNode.Text += "‑"; // non breaking hyphen state.CurrentVNode.VOffsets.Add(new VTextOffset { Index = state.Index, Delta = 1 }); return(false); }
public void InsertNoBreakHyphen_Test() { var dash = new NoBreakHyphen(); _instance.InsertNoBreakHyphen(_context, dash); var insertion = _textInsertions.Single(); Assert.AreEqual(666, insertion.Position); Assert.AreEqual("‑", insertion.Text); }
private static IEnumerable <RunContentElementBase> BuildContent(string text) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var parts = splitRegex.Split(text); return(parts.Select <string, RunContentElementBase>(part => { return part switch { "\n" => TextBreak.Create(), "\t" => Tab.Create(), "\u00AD" => SoftHyphen.Create(), "\u2011" => NoBreakHyphen.Create(), _ => RunText.Create(part) }; })); }