private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; //determine tag id if (source) { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; _tmpTotalTagCount += 1; _srcSegmentTagCount += 1; } else { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; } return(phTag); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { _tokens.Add(new Token { Content = tag.Properties.TagId.Id, Type = Token.TokenType.TagPlaceholder }); PlainText.Append(tag.Properties.TextEquivalent); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (_element is ElementPlaceholder && tag.TagProperties.TagId.Id == _elementIdToSearch) { FoundElement = tag; } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.TagProperties != null) { _containsTag = true; } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (ElementTypeToSearch == Token.TokenType.TagPlaceholder && tag.TagProperties.TagId.Id == ElementIdToSearch) { FoundElement = tag; } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.MetaDataContainsKey("Anonymizer")) { var abstractMarkupData = tag.Parent.AllSubItems.FirstOrDefault(i => i.IndexInParent.Equals(tag.IndexInParent)); if (abstractMarkupData != null) { //if we catch an exception that means is only a taged text is not encrypted try { var decryptedText = _factory.CreateText( _propertiesFactory.CreateTextProperties( DecryptText(tag.Properties.TagContent))); if (!_decryptSettings.IgnoreEncrypted) { var elementContainer = abstractMarkupData.Parent; elementContainer.Insert(tag.IndexInParent, decryptedText); elementContainer.RemoveAt(tag.IndexInParent); } } catch (Exception e) { // take the text from tag and insert it back as IText InsertTextBack(abstractMarkupData, tag); } } } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { //if (!string.IsNullOrEmpty(_id)) //{ // if (_id == tag.TagProperties.ta) //} }
/// <summary> /// Check if tag pair contains specified property /// </summary> /// <returns></returns> public void VisitPlaceholderTag(IPlaceholderTag tag) { if (_detailLevel == DetailLevel.JustTagContent) { _textBuilder.Append(tag.TagProperties.TagContent); } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.SegmentationHint = SegmentationHint.IncludeWithText; phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; //determine tag id if (source) { /*Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId;*/ totalTagCount += 1; tmpTotalTagCount += 1; srcSegmentTagCount += 1; } else { /*foreach (object tag in thisSrcSegment.AllSubItems) * { * if (tag.ToString().StartsWith("<") && tag.ToString().EndsWith(">")) * { * IPlaceholderTag srcPh = (IPlaceholderTag)tag; * * if (srcPh.TagProperties.TagId.ToString() == totalTagCount.ToString()) * { * if (phTagProperties.TagContent == srcPh.TagProperties.TagContent) * { * Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId; * totalTagCount += 1; * } * } * } * }*/ } return(phTag); }
private void InsertTextBack(IAbstractMarkupData abstractMarkupData, IPlaceholderTag tag) { var elementContainer = abstractMarkupData.Parent; var untagedText = _documentItemFactory.CreateText(_propertiesFactory.CreateTextProperties(tag.Properties.TagContent)); elementContainer.Insert(tag.IndexInParent, untagedText); elementContainer.RemoveAt(tag.IndexInParent); }
public override void VisitPlaceholderTag(IPlaceholderTag tag) { //if (tag.Properties.HasTextEquivalent) //{ // // count text equivalent characters for placeholder tags // Count += tag.Properties.TextEquivalent.Length; //} }
public void VisitPlaceholderTag(IPlaceholderTag placeholderTag) { if (_ignoreTags) { return; } Text += placeholderTag.Properties.TagContent; }
private string ConvertTagToText(IPlaceholderTag phTag) { var content = phTag.TagProperties.TagContent; var text = string.Empty; if (!IsTag(content) && Regex.IsMatch(content, "(?:>|≤|<|≥)\\d+")) { text = content; } else { var parser = new HtmlParser(content); HtmlTag tag; if (parser.ParseNext("*", out tag)) { if (tag.Attributes.Any()) { var isTagPair = settings.Placeholders.FirstOrDefault(p => Regex.Replace(p.Content, @"\s+", "") == Regex.Replace(content, @"\s+", ""))?.IsTagPair; if (isTagPair != null) { text = content; } else { text = tag.Attributes.Values.First(); } } else { if (tag.HasEndTag) { text = $"</{tag.Name}>"; } else if (tag.TrailingSlash) { // Check if there is a space before the trailing slash if (tag.SpaceBeforeTrailingSlash) { text = $"<{tag.Name} />"; } else { text = $"<{tag.Name}/>"; } } else { text = $"<{tag.Name}>"; } } } } return(text); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { var tagContent = tag.TagProperties.TagContent; if (tagContent != null) { phTags.Add(tag); } }
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++; }
private IPlaceholderTag CreatePhTag(string tagContent, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = tagContent; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; if (source) { var thisId = new TagId(totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (tags.ContainsKey(int.Parse(thisId.Id)) && !tags.ContainsValue(phTagProperties)) { totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } if (!(tags.ContainsKey(int.Parse(thisId.Id)) && tags.ContainsValue(phTagProperties))) { tags.Add(totalTagCount, phTagProperties); } tagIds.Enqueue(totalTagCount); totalTagCount++; } else { int id; if (tagIds.Count != 0) { id = tagIds.Dequeue(); } else { id = totalTagCount++; } var thisId = new TagId(id.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (tags.ContainsKey(int.Parse(thisId.Id)) && !tags.ContainsValue(phTagProperties)) { totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } } return(phTag); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.DisplayText.Length > 0) { var item = new RangeOfCharacterInfos { start = CollectedText.Length, length = tag.Properties.DisplayText.Length }; ListOfLockedRanges.Add(item); CollectedText += tag.Properties.DisplayText; } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.HasTextEquivalent && !IncludeTagText) { PlainText.Append(tag.Properties.TextEquivalent); } if (IncludeTagText) { PlainText.Append(tag.TagProperties.TagContent); } }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.HasTextEquivalent && !IncludeTagText) { PlainText.Append(tag.Properties.TextEquivalent); } if (IncludeTagText) { PlainText.Append(tag.TagProperties.TagContent); } }
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 VisitPlaceholderTag(IPlaceholderTag tag) { if (FoundElement != null) { return; } // Dev Notes: should handle the tagContentId differently; potentially have priority var tagContentId = GetTagContentId(tag.TagProperties.TagContent); if (_element is ElementPlaceholder && (tag.TagProperties.TagId.Id == _elementIdToSearch || tagContentId == _elementIdToSearch)) { FoundElement = tag; } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; //determine tag id if (source) { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; _tmpTotalTagCount += 1; _srcSegmentTagCount += 1; //check for source with the same Id and different properties if (CheckForIdAndPropertiesNotEqual(thisId, phTagProperties)) { _totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } //check for source with the same Id and same properties if (!CheckForIdAndPropertiesEqual(thisId, phTagProperties)) { _dictionaryTags.Add(int.Parse(thisId.Id), phTagProperties); } } else { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (CheckForIdAndPropertiesNotEqual(thisId, phTagProperties)) { _totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } } return(phTag); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.MetaDataContainsKey("Anonymizer")) { var abstractMarkupData = tag.Parent.AllSubItems.FirstOrDefault(i => i.IndexInParent.Equals(tag.IndexInParent)); if (abstractMarkupData != null) { var decryptedText = _factory.CreateText( _propertiesFactory.CreateTextProperties(AnonymizeData.DecryptData(tag.Properties.TagContent, "Andrea"))); var elementContainer = abstractMarkupData.Parent; elementContainer.Insert(tag.IndexInParent, decryptedText); elementContainer.RemoveAt(tag.IndexInParent); } } }
public void VisitPlaceholderTag(IPlaceholderTag placeholderTag) { if (IgnoreTags) { return; } TagId++; var tag = new Tag( TagType.Standalone, placeholderTag.Properties.TagId.Id, TagId); if (placeholderTag.Properties.HasTextEquivalent) { tag.Type = TagType.TextPlaceholder; tag.TextEquivalent = placeholderTag.Properties.TextEquivalent; } Segment?.Add(tag); }
public void VisitPlaceholderTag(IPlaceholderTag placeholderTag) { if (_ignoreTags) { return; } var element = new ElementPlaceholder { TagId = placeholderTag.TagProperties.TagId.Id, TagContent = placeholderTag.TagProperties.TagContent, DisplayText = placeholderTag.TagProperties.DisplayText, TextEquivalent = placeholderTag.Properties.TextEquivalent }; Elements.Add(element); Text += placeholderTag.Properties.TagContent; }
public void VisitPlaceholderTag(IPlaceholderTag tag) { if (!phAllUnchecked) { var content = tag.Properties.TagContent; if (!string.IsNullOrEmpty(content)) { bool isChecked; if (settings.PlaceholderTagList.TryGetValue(content, out isChecked)) { if (isChecked) { phTagsToRemove.Push(tag); } } } } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; return(phTag); }
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); }
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); } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.SegmentationHint = SegmentationHint.IncludeWithText; phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; //determine tag id if (source) { /*Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId;*/ totalTagCount += 1; tmpTotalTagCount += 1; srcSegmentTagCount += 1; } return(phTag); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { _tokens.Add(new Token(tag.Properties.TagId.Id, Token.TokenType.TagPlaceholder)); PlainText.Append(tag.Properties.TextEquivalent); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { _currentContainer.Add((IPlaceholderTag)tag.Clone()); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { TagToOriginalText(tag.Properties); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { Tags.Add(tag); }
public void VisitPlaceholderTag(IPlaceholderTag tag) { //Ignore the placeholder }
public void VisitPlaceholderTag(IPlaceholderTag tag) { PlainText.Append(tag.TagProperties.TagContent); }