public SoftHyphen AddSoftHyphen() { var softHyphen = SoftHyphen.Create(); Xml.Add(softHyphen.Xml); return(softHyphen); }
public void InsertSoftHyphen(IElementContext context, SoftHyphen hyphen) { context.AddMutation(new TextInsertion { Position = context.TextIndex, Text = "­" }); }
public bool ProcessElement(IElementProcessingState state, SoftHyphen softHyphen) { state.CurrentVNode.Text += "-"; // soft hyphen state.CurrentVNode.VOffsets.Add(new VTextOffset { Index = state.Index, Delta = 1 }); return(false); }
public void InsertSoftHyphen_Test() { var dash = new SoftHyphen(); _instance.InsertSoftHyphen(_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) }; })); }