Exemplo n.º 1
0
        public SoftHyphen AddSoftHyphen()
        {
            var softHyphen = SoftHyphen.Create();

            Xml.Add(softHyphen.Xml);
            return(softHyphen);
        }
Exemplo n.º 2
0
 public void InsertSoftHyphen(IElementContext context, SoftHyphen hyphen)
 {
     context.AddMutation(new TextInsertion
     {
         Position = context.TextIndex,
         Text     = "­"
     });
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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)
                };
            }));
        }