Skip to content

Commit f2bb789

Browse files
committed
Merge branch 'fix-bugs-apostrophe-language'
2 parents 3ad35df + af016a7 commit f2bb789

File tree

5 files changed

+128
-113
lines changed

5 files changed

+128
-113
lines changed

NoteHighlightAddin/AddIn.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ private void InsertHighLightCodeToCurrentSide(string fileName, HighLightParamete
248248
try
249249
{
250250
// Trace.TraceInformation(System.Reflection.MethodBase.GetCurrentMethod().Name);
251-
string htmlContent = File.ReadAllText(fileName, Encoding.UTF8);
251+
string htmlContent = File.ReadAllText(fileName, new UTF8Encoding(false));
252+
253+
string byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
254+
htmlContent = htmlContent.Replace(byteOrderMarkUtf8, "");
252255

253256
var pageNode = GetPageNode();
254257

@@ -433,10 +436,10 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High
433436

434437
if(item.StartsWith("<pre"))
435438
{
436-
defaultStyle = item.Substring(0,item.IndexOf("<span"));
439+
defaultStyle = item.Substring(0,item.IndexOf(">") +1);
437440
//Sets language to Latin to disable spell check
438441
defaultStyle = defaultStyle.Insert(defaultStyle.Length - 1, " lang=la");
439-
item = item.Substring(item.IndexOf("<span"));
442+
item = item.Substring(item.IndexOf(">")+1);
440443
}
441444

442445
if (item == "</pre>")

NoteHighlightAddin/MainForm.cs

+16-4
Original file line numberDiff line numberDiff line change
@@ -162,24 +162,36 @@ private void InsertToClipboard(string outputFileName)
162162

163163
using (FileStream fs = new FileStream(outputFileName, FileMode.Open, FileAccess.Read))
164164
{
165-
using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
165+
using (StreamReader sr = new StreamReader(fs, new UTF8Encoding(false)))
166166
{
167167
//Fix 存到剪貼簿空白不見的問題
168168
while (sr.Peek() >= 0)
169169
{
170170
string line = sr.ReadLine();
171171

172-
line = line.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;") + "<br />";
172+
string byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
173+
line = line.Replace(byteOrderMarkUtf8, "");
173174

175+
if (!line.StartsWith("</pre>"))
176+
{
177+
line = line.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;").Replace("&apos;", "'") + "<br />";
178+
}
174179
var charList = line.ToCharArray().ToList();
175180

176181
StringBuilder sbLine = new StringBuilder();
177182
int index = 0;
178183

179-
if (IsShowLineNumber)
184+
if (IsShowLineNumber && !line.StartsWith("</pre>"))
180185
{
181186
index = line.IndexOf(span) + span.Length;
182-
sbLine.Append(line.Substring(0, index));
187+
string nrLine = line.Substring(0, index);
188+
189+
int endTextIndex = nrLine.IndexOf(span);
190+
int startTextIndex = nrLine.LastIndexOf(">", endTextIndex) + 1;
191+
192+
nrLine = nrLine.Substring(0, startTextIndex) + nrLine.Substring(startTextIndex, endTextIndex-startTextIndex).Replace(" ", "&nbsp;") + nrLine.Substring(endTextIndex);
193+
194+
sbLine.Append(nrLine);
183195
}
184196

185197
for (int i = index; i < charList.Count; i++)

NoteHighlightAddin/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
//
3434
// You can specify all the values or you can default the Build and Revision Numbers
3535
// by using the '*' as shown below:
36-
[assembly: AssemblyVersion("3.1.*")]
37-
[assembly: AssemblyFileVersion("3.1.*")]
36+
[assembly: AssemblyVersion("3.2.*")]
37+
[assembly: AssemblyFileVersion("3.2.*")]

Setup/Setup.vdproj

+52-52
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,44 @@
2727
}
2828
"Entry"
2929
{
30-
"MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289"
30+
"MsmKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
3131
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
3232
"MsmSig" = "8:_UNDEFINED"
3333
}
3434
"Entry"
3535
{
36-
"MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6"
37-
"OwnerKey" = "8:_UNDEFINED"
36+
"MsmKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
37+
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
3838
"MsmSig" = "8:_UNDEFINED"
3939
}
4040
"Entry"
4141
{
42-
"MsmKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
42+
"MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289"
4343
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
4444
"MsmSig" = "8:_UNDEFINED"
4545
}
4646
"Entry"
4747
{
48-
"MsmKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
48+
"MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6"
4949
"OwnerKey" = "8:_UNDEFINED"
5050
"MsmSig" = "8:_UNDEFINED"
5151
}
5252
"Entry"
5353
{
54-
"MsmKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B"
55-
"OwnerKey" = "8:_UNDEFINED"
54+
"MsmKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
55+
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
5656
"MsmSig" = "8:_UNDEFINED"
5757
}
5858
"Entry"
5959
{
60-
"MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
61-
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
60+
"MsmKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
61+
"OwnerKey" = "8:_UNDEFINED"
6262
"MsmSig" = "8:_UNDEFINED"
6363
}
6464
"Entry"
6565
{
66-
"MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
67-
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
66+
"MsmKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B"
67+
"OwnerKey" = "8:_UNDEFINED"
6868
"MsmSig" = "8:_UNDEFINED"
6969
}
7070
"Entry"
@@ -106,43 +106,43 @@
106106
"Entry"
107107
{
108108
"MsmKey" = "8:_UNDEFINED"
109-
"OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247"
109+
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
110110
"MsmSig" = "8:_UNDEFINED"
111111
}
112112
"Entry"
113113
{
114114
"MsmKey" = "8:_UNDEFINED"
115-
"OwnerKey" = "8:_BF0DDD11259532587F856D651F450ECC"
115+
"OwnerKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
116116
"MsmSig" = "8:_UNDEFINED"
117117
}
118118
"Entry"
119119
{
120120
"MsmKey" = "8:_UNDEFINED"
121-
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
121+
"OwnerKey" = "8:_E4014126696E456F7FC66801CBFEEE19"
122122
"MsmSig" = "8:_UNDEFINED"
123123
}
124124
"Entry"
125125
{
126126
"MsmKey" = "8:_UNDEFINED"
127-
"OwnerKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
127+
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
128128
"MsmSig" = "8:_UNDEFINED"
129129
}
130130
"Entry"
131131
{
132132
"MsmKey" = "8:_UNDEFINED"
133-
"OwnerKey" = "8:_E4014126696E456F7FC66801CBFEEE19"
133+
"OwnerKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
134134
"MsmSig" = "8:_UNDEFINED"
135135
}
136136
"Entry"
137137
{
138138
"MsmKey" = "8:_UNDEFINED"
139-
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
139+
"OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247"
140140
"MsmSig" = "8:_UNDEFINED"
141141
}
142142
"Entry"
143143
{
144144
"MsmKey" = "8:_UNDEFINED"
145-
"OwnerKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
145+
"OwnerKey" = "8:_BF0DDD11259532587F856D651F450ECC"
146146
"MsmSig" = "8:_UNDEFINED"
147147
}
148148
}
@@ -323,10 +323,21 @@
323323
"IsDependency" = "11:TRUE"
324324
"IsolateTo" = "8:"
325325
}
326-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289"
326+
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_388259E42C7BBB7AA962BAF39F2213B6"
327327
{
328-
"SourcePath" = "8:NoteHighlightAddin.tlb"
329-
"TargetName" = "8:NoteHighlightAddin.tlb"
328+
"AssemblyRegister" = "3:1"
329+
"AssemblyIsInGAC" = "11:FALSE"
330+
"AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL"
331+
"ScatterAssemblies"
332+
{
333+
"_388259E42C7BBB7AA962BAF39F2213B6"
334+
{
335+
"Name" = "8:Helper.dll"
336+
"Attributes" = "3:512"
337+
}
338+
}
339+
"SourcePath" = "8:Helper.dll"
340+
"TargetName" = "8:"
330341
"Tag" = "8:"
331342
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
332343
"Condition" = "8:"
@@ -338,15 +349,15 @@
338349
"Permanent" = "11:FALSE"
339350
"SharedLegacy" = "11:FALSE"
340351
"PackageAs" = "3:1"
341-
"Register" = "3:2"
342-
"Exclude" = "11:FALSE"
352+
"Register" = "3:1"
353+
"Exclude" = "11:TRUE"
343354
"IsDependency" = "11:TRUE"
344355
"IsolateTo" = "8:"
345356
}
346-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6"
357+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289"
347358
{
348-
"SourcePath" = "8:..\\NoteHighlightAddin\\App.config"
349-
"TargetName" = "8:NoteHighlightAddin.dll.config"
359+
"SourcePath" = "8:NoteHighlightAddin.tlb"
360+
"TargetName" = "8:NoteHighlightAddin.tlb"
350361
"Tag" = "8:"
351362
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
352363
"Condition" = "8:"
@@ -358,26 +369,15 @@
358369
"Permanent" = "11:FALSE"
359370
"SharedLegacy" = "11:FALSE"
360371
"PackageAs" = "3:1"
361-
"Register" = "3:1"
372+
"Register" = "3:2"
362373
"Exclude" = "11:FALSE"
363-
"IsDependency" = "11:FALSE"
374+
"IsDependency" = "11:TRUE"
364375
"IsolateTo" = "8:"
365376
}
366-
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
377+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6"
367378
{
368-
"AssemblyRegister" = "3:1"
369-
"AssemblyIsInGAC" = "11:FALSE"
370-
"AssemblyAsmDisplayName" = "8:HtmlAgilityPack, Version=1.5.1.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"
371-
"ScatterAssemblies"
372-
{
373-
"_5F7DADAECA95B8A8EECB662A9FCF5BB5"
374-
{
375-
"Name" = "8:HtmlAgilityPack.dll"
376-
"Attributes" = "3:512"
377-
}
378-
}
379-
"SourcePath" = "8:HtmlAgilityPack.dll"
380-
"TargetName" = "8:"
379+
"SourcePath" = "8:..\\NoteHighlightAddin\\App.config"
380+
"TargetName" = "8:NoteHighlightAddin.dll.config"
381381
"Tag" = "8:"
382382
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
383383
"Condition" = "8:"
@@ -391,23 +391,23 @@
391391
"PackageAs" = "3:1"
392392
"Register" = "3:1"
393393
"Exclude" = "11:FALSE"
394-
"IsDependency" = "11:TRUE"
394+
"IsDependency" = "11:FALSE"
395395
"IsolateTo" = "8:"
396396
}
397-
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_805E0317B9E0B1539EEBB800C533393B"
397+
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
398398
{
399399
"AssemblyRegister" = "3:1"
400400
"AssemblyIsInGAC" = "11:FALSE"
401-
"AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL"
401+
"AssemblyAsmDisplayName" = "8:HtmlAgilityPack, Version=1.5.1.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"
402402
"ScatterAssemblies"
403403
{
404-
"_805E0317B9E0B1539EEBB800C533393B"
404+
"_5F7DADAECA95B8A8EECB662A9FCF5BB5"
405405
{
406-
"Name" = "8:Helper.dll"
406+
"Name" = "8:HtmlAgilityPack.dll"
407407
"Attributes" = "3:512"
408408
}
409409
}
410-
"SourcePath" = "8:Helper.dll"
410+
"SourcePath" = "8:HtmlAgilityPack.dll"
411411
"TargetName" = "8:"
412412
"Tag" = "8:"
413413
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
@@ -421,7 +421,7 @@
421421
"SharedLegacy" = "11:FALSE"
422422
"PackageAs" = "3:1"
423423
"Register" = "3:1"
424-
"Exclude" = "11:TRUE"
424+
"Exclude" = "11:FALSE"
425425
"IsDependency" = "11:TRUE"
426426
"IsolateTo" = "8:"
427427
}
@@ -640,15 +640,15 @@
640640
{
641641
"Name" = "8:NoteHighlightAddin"
642642
"ProductName" = "8:NoteHighlight2016"
643-
"ProductCode" = "8:{FB571ECB-7A79-4417-BC88-04EADC1CAEE0}"
644-
"PackageCode" = "8:{AFFAB118-BED9-4D10-967A-1D8018F1F910}"
643+
"ProductCode" = "8:{588E3316-4AE0-4C59-8FE7-833D5F1FCE17}"
644+
"PackageCode" = "8:{F72A5156-9BC9-4CFE-8EA6-7B21049E04F7}"
645645
"UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}"
646646
"AspNetVersion" = "8:4.0.30319.0"
647647
"RestartWWWService" = "11:FALSE"
648648
"RemovePreviousVersions" = "11:TRUE"
649649
"DetectNewerInstalledVersion" = "11:TRUE"
650650
"InstallAllUsers" = "11:TRUE"
651-
"ProductVersion" = "8:3.1"
651+
"ProductVersion" = "8:3.2"
652652
"Manufacturer" = "8:CodingRoad"
653653
"ARPHELPTELEPHONE" = "8:"
654654
"ARPHELPLINK" = "8:"

0 commit comments

Comments
 (0)