Skip to content

Commit

Permalink
Remove #text and em from DNTList
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswendt1 committed Jul 8, 2021
1 parent 99b5218 commit f9f8b79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TranslationAssistant.Business/HTMLTranslationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public static int DoTranslation(string htmlfilename, string fromlanguage, string
/// <param name="nodes">Reference to the node list</param>
private static void AddNodes(HtmlNode rootnode, ref List<HtmlNode> nodes)
{
string[] DNTList = { "script", "#text", "code", "col", "colgroup", "embed", "em", "#comment", "image", "map", "media", "meta", "source", "xml"}; //DNT - Do Not Translate - these nodes are skipped.
string[] DNTList = { "script", "code", "col", "colgroup", "embed", "#comment", "image", "map", "media", "meta", "source", "xml" }; //DNT - Do Not Translate - these nodes are skipped.
HtmlNode child = rootnode;
while (child != null && child != rootnode.LastChild)
{
if (!DNTList.Contains(child.Name.ToLowerInvariant())) {
if (child.InnerHtml.Length > maxRequestSize)
{
if (child.FirstChild.Name == "#text") nodes.Add(child); //only text in here
else AddNodes(child.FirstChild, ref nodes);
else AddNodes(child.FirstChild, ref nodes); //recurse into the elements below this one
}
else
{
Expand Down

0 comments on commit f9f8b79

Please sign in to comment.