Skip to content

Commit e58248c

Browse files
committed
ok
1 parent 4103a46 commit e58248c

File tree

9 files changed

+373
-171
lines changed

9 files changed

+373
-171
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ textBox2中輸入 `fc` :雙欄目錄或詩偈類型文本的排版(fc=format
262262
#### 小注
263263
Alt + s :小注不換行、夾注不換行
264264
>還有其餘類似功能,詳後開列。
265+
#### 《古籍酷》自動標點
266+
Alt + F10 、 Alt + F11 : 將textBox1中選取的文字送去《古籍酷》自動標點。若無選取則將整個textBox1的內容送去。(小於20字元不處理)20240808(臺灣父親節)
267+
268+
Ctrl + F10、 Ctrl + F11: 將textBox1中選取的文字送去《古籍酷》**舊版**自動標點。若無選取則將整個textBox1的內容送去。(小於20字元不處理)20240808(臺灣父親節)
265269
### 文本檢測
266270
Alt + v: 檢查[查字.mdb].[異體字反正]資料表中是否已有該字記錄,以便程式將`異體字轉正`時參照。如果已有資料對應,則閃示橘紅色(表單顏色=Color.Tomato)0.02秒以示警
267271

@@ -343,7 +347,7 @@ Ctrl + Alt + f10: 將textBox1中選取的文字送去《古籍酷》自動標
343347

344348
Ctrl + F10、 Ctrl + F11: 將textBox1中選取的文字送去《古籍酷》舊版自動標點。若無選取則將整個textBox1的內容送去。(小於20字元不處理)20240808(臺灣父親節)
345349

346-
F12 : 同 F8 或 Ctrl + Shift + Alt + + 或在非自動且手動輸入模式下,在textBox1 單獨按下數字鍵盤的「+
350+
F12 : 同 F8 或 Ctrl + Shift + Alt + + 或在非自動且手動輸入模式下,在textBox1 單獨按下數字鍵盤的「`+`
347351

348352
Alt + shift + F12 : 更新最後的備份頁文本
349353

TextForCtextPortable.zip

5.73 KB
Binary file not shown.

WindowsFormsApp1/Browser.cs

+94-25
Large diffs are not rendered by default.

WindowsFormsApp1/CnText.cs

+26-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Diagnostics;
1313
using Microsoft.Office.Interop.Word;
1414
using static System.Net.Mime.MediaTypeNames;
15+
using OpenQA.Selenium.DevTools.V125.Runtime;
1516
//using static System.Windows.Forms.VisualStyles.VisualStyleElement;
1617
//using static System.Net.Mime.MediaTypeNames;
1718
//using System.Reflection;
@@ -699,9 +700,9 @@ internal static int HasPlatecenterTextIncluded(string xChecking)
699700
if (similarity >= threshold)
700701
{
701702
//前一段若為「|」通常是卷末題目
702-
if (i > lines.Length - 2 &&
703+
if (i > lines.Length - 2 &&
703704
("|" + Environment.NewLine).IndexOf(lines[i - 1]) > -1) //也分段/行符號可能還未自動轉換成「|」
704-
continue;
705+
continue;
705706

706707
location = xChecking.IndexOf(lines[i]);
707708
if (location == -1)
@@ -1031,7 +1032,8 @@ public static void Spaces2Braces(ref string text)
10311032
/// <param name="originalText"></param>
10321033
/// <param name="punctuatedText"></param>
10331034
/// <returns></returns>
1034-
public static string RestoreParagraphs(ref string originalText, ref string punctuatedText)
1035+
public static string RestoreParagraphs(string originalText,ref string punctuatedText)
1036+
//public static string RestoreParagraphs(ref string originalText, ref string punctuatedText)
10351037
{
10361038

10371039
// Define a set of punctuation marks to ignore
@@ -1082,7 +1084,11 @@ int FindAdjustedPosition(string text, int pos, string before, string after)
10821084
else
10831085
{
10841086
Debugger.Break();
1085-
break;
1087+
//text=RemovePunctuation(text);
1088+
adjustedPos = (before.Length + offset1 + 1);
1089+
Form1.playSound(Form1.soundLike.error);
1090+
//return -1;
1091+
//break;
10861092
}
10871093
}
10881094
if (subTextWithoutPunctuation.Contains(before))
@@ -1135,7 +1141,7 @@ int FindAdjustedPosition(string text, int pos, string before, string after)
11351141
punctuatedText = punctuatedText.Replace(Environment.NewLine, string.Empty);
11361142
//清除標點符號以利分段符號之比對搜尋
11371143
originalText = RemovePunctuation(originalText);
1138-
//清除縮排即凸排格式標記,即將分段符號前後的空格「 」均予清除
1144+
//清除縮排即凸排格式標記,即將分段符號前後的空格「 」均予清除//當寫在送去自動標點前!!20240918//發現問題出在使用了 .Text屬性值 故先還原再觀察
11391145
originalText = Regex.Replace(originalText, $@"\s*{Environment.NewLine}+\s*", Environment.NewLine);
11401146
#endregion
11411147

@@ -1152,6 +1158,21 @@ int FindAdjustedPosition(string text, int pos, string before, string after)
11521158
string before = originalText.Substring(start, index - start);
11531159
string after = originalText.Substring(index + newLine.Length, end - index - newLine.Length);
11541160

1161+
//if (char.IsHighSurrogate(before.LastOrDefault()))
1162+
// before = originalText.Substring(start, index - start + 1);
1163+
if (char.IsLowSurrogate(before.FirstOrDefault()))
1164+
{
1165+
Debugger.Break();
1166+
before = originalText.Substring(start - 1, index - start);
1167+
}
1168+
if (char.IsHighSurrogate(after.LastOrDefault()))
1169+
{
1170+
Debugger.Break();
1171+
after = originalText.Substring(index + newLine.Length, end - index - newLine.Length + 1);
1172+
}
1173+
//if (char.IsLowSurrogate(after.FirstOrDefault()))
1174+
// after = originalText.Substring(index + newLine.Length, end - index - newLine.Length);
1175+
11551176
// Ensure 'before' and 'after' do not include newline characters
11561177
while (before.Contains('\r') || before.Contains('\n'))
11571178
{

0 commit comments

Comments
 (0)