コード例 #1
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++;
        }
コード例 #2
0
        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++;
        }
コード例 #3
0
        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++;
        }