示例#1
0
        private static void SegmentEnded(Delta newDelta, string segRef)
        {
            if (segRef == null)
            {
                return;
            }

            if (newDelta.Ops.Count == 0)
            {
                newDelta.InsertBlank(segRef);
            }
            else
            {
                JToken lastOp     = newDelta.Ops[newDelta.Ops.Count - 1];
                string lastOpText = "";
                if (lastOp[Delta.InsertType].Type == JTokenType.String)
                {
                    lastOpText = (string)lastOp[Delta.InsertType];
                }
                var embed = lastOp[Delta.InsertType] as JObject;
                var attrs = (JObject)lastOp[Delta.Attributes];
                if ((embed != null && (embed["verse"] != null || embed["chapter"] != null)) ||
                    (attrs != null && (attrs["para"] != null || attrs["table"] != null)) ||
                    lastOpText.EndsWith('\n'))
                {
                    newDelta.InsertBlank(segRef);
                }
            }
        }
        private static void SegmentEnded(Delta newDelta, string segRef)
        {
            if (segRef == null)
            {
                return;
            }

            if (newDelta.Ops.Count == 0)
            {
                newDelta.InsertBlank(segRef);
            }
            else
            {
                JToken lastOp = newDelta.Ops[newDelta.Ops.Count - 1];
                var    attrs  = (JObject)lastOp[Delta.Attributes];
                if (attrs != null && (attrs["verse"] != null || attrs["chapter"] != null || attrs["para"] != null))
                {
                    newDelta.InsertBlank(segRef);
                }
            }
        }