Beispiel #1
0
        public void VisitTagPair(ITagPair tagPair)
        {
            TagPairs.Add((ITagPair)tagPair.Clone());


            if (IncludeTagText)
            {
                TagUnits.Add(new TagUnit(tagPair.TagProperties.TagId.Id, tagPair.TagProperties.DisplayText, tagPair.StartTagProperties.TagContent, TagUnit.TagUnitState.IsOpening, TagUnit.TagUnitType.IsTag));

                SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Tag, tagPair.TagProperties.TagId.Id, tagPair.StartTagProperties.TagContent));

                PlainText.Append(tagPair.StartTagProperties.TagContent);
            }

            VisitChildren(tagPair);

            if (!IncludeTagText)
            {
                return;
            }
            TagUnits.Add(new TagUnit(tagPair.TagProperties.TagId.Id, string.Empty, tagPair.EndTagProperties.TagContent, TagUnit.TagUnitState.IsClosing, TagUnit.TagUnitType.IsTag));

            SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.TagClosing, tagPair.TagProperties.TagId.Id, tagPair.EndTagProperties.TagContent));

            PlainText.Append(tagPair.EndTagProperties.TagContent);
        }
Beispiel #2
0
        public void VisitLockedContent(ILockedContent lockedContent)
        {
            LockedContentTags.Add((ILockedContent)lockedContent);

            SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.LockedContent, "", lockedContent.Content.ToString()));

            PlainText.Append(lockedContent.Content);
        }
Beispiel #3
0
        public void VisitTagPair(ITagPair tagPair)
        {
            if (IncludeTagText)
            {
                TagUnits.Add(new TagUnit(tagPair.TagProperties.TagId.Id, tagPair.TagProperties.DisplayText, tagPair.StartTagProperties.TagContent, TagUnit.TagUnitState.IsOpening, TagUnit.TagUnitType.IsTag));

                SegmentSections.Add(IsRevisionMarker
                    ? new SegmentSection(SegmentSection.ContentType.Tag, tagPair.TagProperties.TagId.Id,
                                         tagPair.StartTagProperties.TagContent, RevisionMarker)
                    : new SegmentSection(SegmentSection.ContentType.Tag, tagPair.TagProperties.TagId.Id,
                                         tagPair.StartTagProperties.TagContent));


                PlainText.Append(tagPair.StartTagProperties.TagContent);
            }

            var tgStart = new Sdl.LanguagePlatform.Core.Tag
            {
                Type           = Sdl.LanguagePlatform.Core.TagType.Start,
                Anchor         = TagCounter,
                TagID          = tagPair.StartTagProperties.TagId.Id,
                TextEquivalent = tagPair.StartTagProperties.DisplayText
            };


            Segment.Add(tgStart);



            VisitChildren(tagPair);



            var tgEnd = new Sdl.LanguagePlatform.Core.Tag
            {
                Type           = Sdl.LanguagePlatform.Core.TagType.End,
                TagID          = tagPair.StartTagProperties.TagId.Id,
                Anchor         = TagCounter,
                TextEquivalent = tagPair.EndTagProperties.DisplayText
            };

            Segment.Add(tgEnd);

            if (IncludeTagText)
            {
                TagUnits.Add(new TagUnit(tagPair.TagProperties.TagId.Id, string.Empty, tagPair.EndTagProperties.TagContent, TagUnit.TagUnitState.IsClosing, TagUnit.TagUnitType.IsTag));

                SegmentSections.Add(IsRevisionMarker
                    ? new SegmentSection(SegmentSection.ContentType.TagClosing,
                                         tagPair.TagProperties.TagId.Id, tagPair.EndTagProperties.TagContent, RevisionMarker)
                    : new SegmentSection(SegmentSection.ContentType.TagClosing,
                                         tagPair.TagProperties.TagId.Id, tagPair.EndTagProperties.TagContent));

                PlainText.Append(tagPair.EndTagProperties.TagContent);
            }
            TagCounter++;
        }
        public void VisitPlaceholderTag(IPlaceholderTag tag)
        {
            PlaceholderTags.Add((IPlaceholderTag)tag.Clone());


            if (tag.Properties.HasTextEquivalent && !IncludeTagText)
            {
                var objTag = new Tag
                {
                    AlignmentAnchor = "",
                    Anchor          = TagCounter.ToString(),
                    TagId           = tag.TagProperties.TagId.Id,
                    TextEquivalent  = tag.Properties.TextEquivalent,
                    SectionType     = Tag.Type.Standalone
                };


                TagUnits.Add(objTag);

                objTag.Revision = IsRevisionMarker ? RevisionMarker : null;
                SegmentSections.Add(objTag);

                PlainText.Append(tag.Properties.TextEquivalent);
            }
            else if (IncludeTagText)
            {
                var objTag = new Tag
                {
                    AlignmentAnchor = "",
                    Anchor          = TagCounter.ToString(),
                    TagId           = tag.TagProperties.TagId.Id,
                    TextEquivalent  = tag.Properties.TagContent,
                    SectionType     = Tag.Type.Standalone
                };

                TagUnits.Add(objTag);

                objTag.Revision = IsRevisionMarker ? RevisionMarker : null;
                SegmentSections.Add(objTag);

                PlainText.Append(tag.TagProperties.TagContent);


                var placeHolderTag = new Sdl.LanguagePlatform.Core.Tag
                {
                    Type           = TagType.TextPlaceholder,
                    TagID          = tag.TagProperties.TagId.Id,
                    TextEquivalent = tag.Properties.TextEquivalent,
                    Anchor         = TagCounter
                };
                Segment.Add(placeHolderTag);
            }
            TagCounter++;
        }
Beispiel #5
0
        public void VisitText(IText text)
        {
            if (SegmentSections.Count > 0 && SegmentSections[SegmentSections.Count - 1].IsText)
            {
                SegmentSections[SegmentSections.Count - 1].Content += text.Properties.Text;
            }
            else
            {
                SegmentSections.Add(new SegmentSection(true, text.Properties.Text));
            }

            PlainText.Append(text.Properties.Text);
        }
Beispiel #6
0
        public void VisitText(IText text)
        {
            if (SegmentSections.Count > 0 && SegmentSections[(SegmentSections.Count - 1)].Type == SegmentSection.ContentType.Text)
            {
                SegmentSections[SegmentSections.Count - 1].Content += text.Properties.Text;
            }
            else
            {
                SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Text, "", text.Properties.Text));
            }

            PlainText.Append(text.Properties.Text);
        }
Beispiel #7
0
        public void VisitPlaceholderTag(IPlaceholderTag tag)
        {
            if (tag.Properties.HasTextEquivalent && !IncludeTagText)
            {
                SegmentSections.Add(new SegmentSection(false, tag.Properties.TextEquivalent));

                PlainText.Append(tag.Properties.TextEquivalent);
            }

            if (IncludeTagText)
            {
                SegmentSections.Add(new SegmentSection(false, tag.Properties.TagContent));

                PlainText.Append(tag.TagProperties.TagContent);
            }
        }
        public void VisitLockedContent(ILockedContent lockedContent)
        {
            LockedContentTags.Add((ILockedContent)lockedContent.Clone());

            var objTag = new Tag
            {
                AlignmentAnchor = "",
                Anchor          = "",
                TagId           = lockedContent.UniqueId.ToString(),
                TextEquivalent  = lockedContent.Content.ToString(),
                SectionType     = Tag.Type.LockedContent
            };

            SegmentSections.Add(objTag);

            PlainText.Append(lockedContent.Content);
        }
Beispiel #9
0
        public void VisitText(IText text)
        {
            if (SegmentSections.Count > 0 && SegmentSections[(SegmentSections.Count - 1)].Type == SegmentSection.ContentType.Text)
            {
                if (IsRevisionMarker)
                {
                    if (SegmentSections[(SegmentSections.Count - 1)].RevisionMarker != null && SegmentSections[(SegmentSections.Count - 1)].RevisionMarker.Type == RevisionMarker.Type)
                    {
                        SegmentSections[(SegmentSections.Count - 1)].Content += text.Properties.Text;
                    }
                    else
                    {
                        SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Text, string.Empty, text.Properties.Text, RevisionMarker));
                    }
                }
                else
                {
                    if (SegmentSections[(SegmentSections.Count - 1)].RevisionMarker == null)
                    {
                        SegmentSections[(SegmentSections.Count - 1)].Content += text.Properties.Text;
                    }
                    else
                    {
                        SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Text, string.Empty, text.Properties.Text));
                    }
                }
            }
            else
            {
                SegmentSections.Add(IsRevisionMarker
                    ? new SegmentSection(SegmentSection.ContentType.Text, string.Empty, text.Properties.Text,
                                         RevisionMarker)
                    : new SegmentSection(SegmentSection.ContentType.Text, string.Empty, text.Properties.Text));
            }

            if ((!IsRevisionMarker || RevisionMarker.Type == RevisionMarker.RevisionType.Delete) &&
                IsRevisionMarker)
            {
                return;
            }

            Segment.Add(text.Properties.Text);
            PlainText.Append(text.Properties.Text);
        }
Beispiel #10
0
        public void VisitTagPair(ITagPair tagPair)
        {
            if (IncludeTagText)
            {
                SegmentSections.Add(new SegmentSection(false, tagPair.StartTagProperties.TagContent));

                PlainText.Append(tagPair.StartTagProperties.TagContent);
            }

            VisitChildren(tagPair);

            if (!IncludeTagText)
            {
                return;
            }

            SegmentSections.Add(new SegmentSection(false, tagPair.EndTagProperties.TagContent));

            PlainText.Append(tagPair.EndTagProperties.TagContent);
        }
Beispiel #11
0
        public void VisitLockedContent(ILockedContent lockedContent)
        {
            var lockedTag = new Sdl.LanguagePlatform.Core.Tag
            {
                Type           = Sdl.LanguagePlatform.Core.TagType.LockedContent,
                TextEquivalent = lockedContent.Content.ToString(),
                Anchor         = TagCounter
            };

            Segment.Add(lockedTag);

            TagCounter++;

            SegmentSections.Add(IsRevisionMarker
                ? new SegmentSection(SegmentSection.ContentType.LockedContent, string.Empty,
                                     lockedContent.Content.ToString(), RevisionMarker)
                : new SegmentSection(SegmentSection.ContentType.LockedContent, string.Empty,
                                     lockedContent.Content.ToString()));

            PlainText.Append(lockedContent.Content);
        }
Beispiel #12
0
        public void VisitPlaceholderTag(IPlaceholderTag tag)
        {
            PlaceholderTags.Add((IPlaceholderTag)tag.Clone());


            if (tag.Properties.HasTextEquivalent && !IncludeTagText)
            {
                TagUnits.Add(new TagUnit(tag.TagProperties.TagId.Id, tag.Properties.DisplayText, tag.Properties.TextEquivalent, TagUnit.TagUnitState.IsEmpty, TagUnit.TagUnitType.IsPlaceholder));

                SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id, tag.Properties.TextEquivalent));

                PlainText.Append(tag.Properties.TextEquivalent);
            }

            if (!IncludeTagText)
            {
                return;
            }
            TagUnits.Add(new TagUnit(tag.TagProperties.TagId.Id, tag.Properties.DisplayText, tag.Properties.TagContent, TagUnit.TagUnitState.IsEmpty, TagUnit.TagUnitType.IsPlaceholder));

            SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id, tag.Properties.TagContent));

            PlainText.Append(tag.TagProperties.TagContent);
        }
Beispiel #13
0
        public void VisitPlaceholderTag(IPlaceholderTag tag)
        {
            var placeHolderTag = new Sdl.LanguagePlatform.Core.Tag
            {
                Type           = Sdl.LanguagePlatform.Core.TagType.TextPlaceholder,
                TagID          = tag.TagProperties.TagId.Id,
                TextEquivalent = tag.Properties.TextEquivalent,
                Anchor         = TagCounter
            };

            Segment.Add(placeHolderTag);

            TagCounter++;

            if (tag.Properties.HasTextEquivalent && !IncludeTagText)
            {
                SegmentSections.Add(IsRevisionMarker
                    ? new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id,
                                         tag.Properties.TextEquivalent, RevisionMarker)
                    : new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id,
                                         tag.Properties.TextEquivalent));


                PlainText.Append(tag.Properties.TextEquivalent);
            }
            else if (IncludeTagText)
            {
                SegmentSections.Add(IsRevisionMarker
                    ? new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id,
                                         tag.Properties.TagContent, RevisionMarker)
                    : new SegmentSection(SegmentSection.ContentType.Placeholder, tag.TagProperties.TagId.Id,
                                         tag.Properties.TagContent));

                PlainText.Append(tag.TagProperties.TagContent);
            }
        }
Beispiel #14
0
        public void VisitLockedContent(ILockedContent lockedContent)
        {
            SegmentSections.Add(new SegmentSection(false, lockedContent.Content.ToString()));

            PlainText.Append(lockedContent.Content);
        }
        public void VisitText(IText text)
        {
            if (SegmentSections.Count > 0 && SegmentSections[SegmentSections.Count - 1].GetType() == typeof(Text))
            {
                var objTextPrevious = SegmentSections[SegmentSections.Count - 1] as Text;


                if (IsRevisionMarker)
                {
                    if (objTextPrevious != null && objTextPrevious.Revision != null && objTextPrevious.Revision.RevType == RevisionMarker.RevType)
                    {
                        objTextPrevious.Value   += text.Properties.Text;
                        objTextPrevious.Revision = RevisionMarker;
                        SegmentSections[SegmentSections.Count - 1] = objTextPrevious;
                    }
                    else
                    {
                        var objText = new Text
                        {
                            Value    = text.Properties.Text,
                            Revision = RevisionMarker
                        };
                        SegmentSections.Add(objText);
                    }
                }
                else
                {
                    if (objTextPrevious != null && objTextPrevious.Revision == null)
                    {
                        objTextPrevious.Value   += text.Properties.Text;
                        objTextPrevious.Revision = null;
                        SegmentSections[SegmentSections.Count - 1] = objTextPrevious;
                    }
                    else
                    {
                        var objText = new Text
                        {
                            Value    = text.Properties.Text,
                            Revision = null
                        };
                        SegmentSections.Add(objText);
                    }
                }
            }
            else
            {
                var objText = new Text
                {
                    Value    = text.Properties.Text,
                    Revision = IsRevisionMarker ? RevisionMarker : null
                };
                SegmentSections.Add(objText);
            }

            if ((!IsRevisionMarker || RevisionMarker.RevType == RevisionMarker.RevisionType.Delete) &&
                IsRevisionMarker)
            {
                return;
            }


            PlainText.Append(text.Properties.Text);
            Segment.Add(text.Properties.Text);
        }
        public void VisitTagPair(ITagPair tagPair)
        {
            TagPairs.Add((ITagPair)tagPair.Clone());


            if (IncludeTagText)
            {
                var objTag = new Tag
                {
                    AlignmentAnchor = "",
                    Anchor          = TagCounter.ToString(),
                    TagId           = tagPair.TagProperties.TagId.Id,
                    TextEquivalent  = tagPair.StartTagProperties.TagContent,
                    SectionType     = Tag.Type.Start
                };

                TagUnits.Add(objTag);


                objTag.Revision = IsRevisionMarker ? RevisionMarker : null;
                SegmentSections.Add(objTag);

                PlainText.Append(tagPair.StartTagProperties.TagContent);



                var tgStart = new Sdl.LanguagePlatform.Core.Tag
                {
                    Type           = TagType.Start,
                    Anchor         = TagCounter,
                    TagID          = tagPair.StartTagProperties.TagId.Id,
                    TextEquivalent = tagPair.StartTagProperties.DisplayText
                };
                Segment.Add(tgStart);
            }

            VisitChildren(tagPair);

            if (IncludeTagText)
            {
                var objTag = new Tag
                {
                    AlignmentAnchor = "",
                    Anchor          = TagCounter.ToString(),
                    TagId           = tagPair.TagProperties.TagId.Id,
                    TextEquivalent  = tagPair.EndTagProperties.TagContent,
                    SectionType     = Tag.Type.End
                };

                TagUnits.Add(objTag);

                objTag.Revision = IsRevisionMarker ? RevisionMarker : null;
                SegmentSections.Add(objTag);

                PlainText.Append(tagPair.EndTagProperties.TagContent);


                var tgEnd = new Sdl.LanguagePlatform.Core.Tag
                {
                    Type           = TagType.End,
                    TagID          = tagPair.StartTagProperties.TagId.Id,
                    Anchor         = TagCounter,
                    TextEquivalent = tagPair.EndTagProperties.DisplayText
                };
                Segment.Add(tgEnd);
            }
            TagCounter++;
        }