Example #1
0
    public TranslationTerm( IHtmlTextNode textNode )
    {
      TextNode = textNode;
      var specification = textNode.Document.HtmlSpecification;

      if ( !textNode.Ancestors().Any( e => e.ElementTextMode() == TextMode.Preformated ) )
        SourceTerm = whitespaceRegex.Replace( textNode.HtmlText, " " );

      else
        SourceTerm = textNode.HtmlText;
    }
Example #2
0
 public TranslationTerm(IHtmlTextNode textNode)
 {
     TextNode = textNode;
     if (!textNode.Ancestors().Any(e => HtmlSpecification.preformatedElements.Contains(e.Name, StringComparer.OrdinalIgnoreCase)))
     {
         SourceTerm     = whitespaceRegex.Replace(textNode.HtmlText, " ");
         TranslatedTerm = whitespaceRegex.Replace(textNode.HtmlText, " ");
     }
     else
     {
         SourceTerm     = textNode.HtmlText;
         TranslatedTerm = textNode.HtmlText;
     }
 }
Example #3
0
 public TranslationTerm( IHtmlTextNode textNode )
 {
   TextNode = textNode;
   if ( !textNode.Ancestors().Any( e => HtmlSpecification.preformatedElements.Contains( e.Name, StringComparer.OrdinalIgnoreCase ) ) )
   {
     SourceTerm = whitespaceRegex.Replace( textNode.HtmlText, " " );
     TranslatedTerm = whitespaceRegex.Replace( textNode.HtmlText, " " );
   }
   else
   {
     SourceTerm = textNode.HtmlText;
     TranslatedTerm = textNode.HtmlText;
   }
 }
Example #4
0
        public TranslationTerm(IHtmlTextNode textNode)
        {
            TextNode = textNode;
            var specification = textNode.Document.HtmlSpecification;

            if (!textNode.Ancestors().Any(e => e.ElementTextMode() == TextMode.Preformated))
            {
                SourceTerm = whitespaceRegex.Replace(textNode.HtmlText, " ");
            }

            else
            {
                SourceTerm = textNode.HtmlText;
            }
        }
Example #5
0
        private static bool IsTranslatable(IHtmlTextNode textNode)
        {
            if (textNode.IsWhiteSpace())
            {
                return(false);
            }

            if (textNode is IHtmlSpecial)
            {
                return(false);
            }

            if (textNode.Ancestors().Any(e => e.Name.EqualsIgnoreCase("partial") || e.Name.EqualsIgnoreCase("head")))
            {
                return(false);
            }

            if (textNode.Parent() != null && HtmlSpecification.nonTextElements.Contains(textNode.Parent().Name, StringComparer.OrdinalIgnoreCase))
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        private static bool IsTranslatable(IHtmlTextNode textNode)
        {
            if (textNode.IsWhiteSpace())
            {
                return(false);
            }

            if (textNode is IHtmlSpecial)
            {
                return(false);
            }

            if (textNode.Ancestors().Any(e => e.Name.EqualsIgnoreCase("partial") || e.Name.EqualsIgnoreCase("head")))
            {
                return(false);
            }

            if (textNode.Parent() != null && textNode.ElementTextMode() == TextMode.NonText)
            {
                return(false);
            }

            return(true);
        }
Example #7
0
    private static bool IsTranslatable( IHtmlTextNode textNode )
    {
      if ( textNode.IsWhiteSpace() )
        return false;

      if ( textNode is IHtmlSpecial )
        return false;

      if ( textNode.Ancestors().Any( e => e.Name.EqualsIgnoreCase( "partial" ) || e.Name.EqualsIgnoreCase( "head" ) ) )
        return false;

      if ( textNode.Parent() != null && textNode.ElementTextMode() == TextMode.NonText )
        return false;

      return true;
    }
Example #8
0
    private static bool IsTranslatable( IHtmlTextNode textNode )
    {
      if ( textNode.IsWhiteSpace() )
        return false;

      if ( textNode is IHtmlSpecial )
        return false;

      if ( textNode.Ancestors().Any( e => e.Name.EqualsIgnoreCase( "partial" ) || e.Name.EqualsIgnoreCase( "head" ) ) )
        return false;

      if ( textNode.Parent() != null && HtmlSpecification.nonTextElements.Contains( textNode.Parent().Name, StringComparer.OrdinalIgnoreCase ) )
        return false;

      return true;
    }