CrazyIter_Bin il y a 1 an
Parent
commit
5b4c97d6fa

+ 3 - 3
HTEXLib/HTEXLib.csproj

@@ -4,9 +4,9 @@
 		<Description>修改解析</Description>
 		<PackageReleaseNotes></PackageReleaseNotes>
 		<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
-		<Version>5.2308.1515</Version>
-		<AssemblyVersion>5.2308.1515.1</AssemblyVersion>
-		<FileVersion>5.2308.1515.1</FileVersion>
+		<Version>5.2312.1416</Version>
+		<AssemblyVersion>5.2312.1416.1</AssemblyVersion>
+		<FileVersion>5.2312.1416.1</FileVersion>
 	</PropertyGroup>
 	<ItemGroup>
 		<PackageReference Include="DocumentFormat.OpenXml" Version="2.13.1" />

+ 12 - 7
HTEXLib/Translator/HTML2ITEMTranslator.cs

@@ -197,7 +197,7 @@ namespace HTEXLib.Translator
                     textImg = testInfo.question.Replace(replace.oldstr, "");
 
                 }
-                textImg = HtmlHelper.DoTextImg(textImg);
+                //textImg = HtmlHelper.DoTextImg(textImg);
                 testInfo.shaCode = ShaHashHelper.GetSHA1(textImg);
                 //处理解析
                 testInfo.explain = testInfo.explain.Replace(langConfig.Item.Start + langConfig.Item.Analysis + langConfig.Item.End, "");//.Replace(Start + EndedTag + End, "");
@@ -233,7 +233,7 @@ namespace HTEXLib.Translator
                 //doc.LoadHtml(optsHtml);
                 //optsHtml = doc.DocumentNode.InnerText;
                 //处理选项
-                StringBuilder textImg = new StringBuilder();
+               StringBuilder textImg = new StringBuilder();
                 for (int i = 0; i < optionsKeys.Length - 1; i++)
                 {
                     string optRgex = optionsKeys[i] + "\\s*(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?)" + optionsKeys[i + 1] + "\\s*(\\.|\\.|\\、|\\:|\\:)";
@@ -246,7 +246,8 @@ namespace HTEXLib.Translator
                     {
                         optHtml = optHtml.Substring(2, optHtml.Length - 4);
                         optHtml = HtmlHelper.DoUselessTag(optHtml);
-                        textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                       //textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                        textImg.Append(optHtml);
                         testInfo.option.Add(new CodeValue { code = optionsKeys[i], value = optHtml });
                         //testInfo.option.Add(new Dictionary<string, string> { { "code", optionsKeys[i] },{ "value", optHtml } });
                         //testInfo.option.TryAdd(optionsKeys[i], optHtml);
@@ -271,7 +272,8 @@ namespace HTEXLib.Translator
                             // optHtml = optHtml.Substring(2, optHtml.Length - 6);
                             optHtml = optHtml.Substring(2).Replace(langConfig.Item.Start + langConfig.Item.Answer + langConfig.Item.End, "").Replace(langConfig.Item.Start + langConfig.Item.Analysis + langConfig.Item.End, "");
                             optHtml = HtmlHelper.DoUselessTag(optHtml);
-                            textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                           // textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                            textImg.Append(optHtml);
                             testInfo.option.Add(new CodeValue { code = optionsKeys[i], value = optHtml });
                             //testInfo.option.Add(new Dictionary<string, string> { { "code", optionsKeys[i] }, { "value", optHtml } });
                             //testInfo.option.TryAdd(optionsKeys[i], optHtml);
@@ -287,7 +289,8 @@ namespace HTEXLib.Translator
                     //TODO
                 }
                 testInfo.question = HtmlHelper.DoUselessTag(testInfo.question);
-                textImg.Append(HtmlHelper.DoTextImg(testInfo.question));
+                //textImg.Append(HtmlHelper.DoTextImg(testInfo.question));
+                textImg.Append(testInfo.question);
                 testInfo.shaCode = ShaHashHelper.GetSHA1(textImg.ToString());
                 List<string> answers = testInfo.answer;
                 HashSet<string> ans = new HashSet<string>();
@@ -334,7 +337,8 @@ namespace HTEXLib.Translator
             {
                 testInfo.question = testInfo.question.Replace(langConfig.Item.Start + langConfig.Item.Analysis + langConfig.Item.End, "").Replace(langConfig.Item.Start + langConfig.Item.Answer + langConfig.Item.End, "");
                 testInfo.question = HtmlHelper.DoUselessTag(testInfo.question);
-                StringBuilder textImg = new StringBuilder(HtmlHelper.DoTextImg(testInfo.question));
+                //StringBuilder textImg = new StringBuilder(HtmlHelper.DoTextImg(testInfo.question));
+                StringBuilder textImg = new StringBuilder(testInfo.question);
                 testInfo.shaCode = ShaHashHelper.GetSHA1(textImg.ToString());
                 for (int i = 0; i < testInfo.answer.Count; i++)
                 {
@@ -386,7 +390,8 @@ namespace HTEXLib.Translator
                 exercise.question = HtmlHelper.DoUselessTag(ls/*.Replace(ComposeStart, "").Replace(ComposeEnd, "")*/);
                 //.Replace(ComposeTag, Start);
                 //获取综合题的材料加每个小题的sha1Code
-                string testQs = HtmlHelper.DoTextImg(exercise.question);
+               // string testQs = HtmlHelper.DoTextImg(exercise.question);
+                string testQs = exercise.question;
                 List<DOCX.Models.ItemInfo> dtos = Translate(testinfo, langConfig);
                 if (dtos.IsNotEmpty())
                 {

+ 2 - 2
HTEXLib/Translator/HTML2ITEMV2Translator.cs

@@ -361,7 +361,7 @@ namespace HTEXLib.Translator
             List<CodeValue> options = new List<CodeValue>();
             string optsRgex = optionsKeys[0] + "\\s*(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?).*"; ;
             string optsHtml = Regex.Match(question, optsRgex).Value;
-            StringBuilder textImg = new StringBuilder();
+            //StringBuilder textImg = new StringBuilder();
             for (int i = 0; i < optionsKeys.Length - 1; i++)
             {
                 string optRgex = optionsKeys[i] + "\\s*(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?)" + optionsKeys[i + 1] + "\\s*(\\.|\\.|\\、|\\:|\\:)";
@@ -376,7 +376,7 @@ namespace HTEXLib.Translator
                     optHtml = optHtml.Substring(2, optHtml.Length - 2);
                     optHtml = HtmlHelper.DoUselessTag(optHtml);
                     optHtml = optHtml.TrimStart().TrimEnd();
-                    textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                    //textImg.Append(HtmlHelper.DoTextImg(optHtml));
                     options.Add(new CodeValue { code = optionsKeys[i], value = optHtml });
                 }
             }

+ 6 - 2
HTEXLib/Translator/HTML2ITEMV3Translator.cs

@@ -282,6 +282,10 @@ namespace HTEXLib.Translator
                     //去掉标签中的{} 空格换行制表符及Html空格数字等
                     var tagValue = BlankTag(array[index]);
                     tagValue = Regex.Replace(tagValue, @"\d", "");
+                    Console.WriteLine(index);
+                    if (index==157) {
+                        Console.WriteLine(index);
+                    }
                     if (dict.TryGetValue(tagValue, out string[] keyInfo))
                     {
                         switch ( keyInfo[1] ) {
@@ -463,7 +467,7 @@ namespace HTEXLib.Translator
             List<CodeValue> options = new List<CodeValue>();
             string optsRgex = optionsKeys[0] + "\\s*(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?).*"; ;
             string optsHtml = Regex.Match(question, optsRgex).Value;
-            StringBuilder textImg = new StringBuilder();
+          //  StringBuilder textImg = new StringBuilder();
             for (int i = 0; i < optionsKeys.Length - 1; i++)
             {
                 string optRgex = optionsKeys[i] + "\\s*(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?)" + optionsKeys[i + 1] + "\\s*(\\.|\\.|\\、|\\:|\\:)";
@@ -478,7 +482,7 @@ namespace HTEXLib.Translator
                     optHtml = optHtml.Substring(2, optHtml.Length - 2);
                     optHtml = HtmlHelper.DoUselessTag(optHtml);
                     optHtml = optHtml.TrimStart().TrimEnd();
-                    textImg.Append(HtmlHelper.DoTextImg(optHtml));
+                   // textImg.Append(HtmlHelper.DoTextImg(optHtml));
                     options.Add(new CodeValue { code = optionsKeys[i], value = optHtml });
                 }
             }