Skip to content

Commit

Permalink
Merge branch 'fix-bugs-apostrophe-language'
Browse files Browse the repository at this point in the history
  • Loading branch information
elvirbrk committed Nov 3, 2017
2 parents 3ad35df + af016a7 commit f2bb789
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 113 deletions.
9 changes: 6 additions & 3 deletions NoteHighlightAddin/AddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ private void InsertHighLightCodeToCurrentSide(string fileName, HighLightParamete
try
{
// Trace.TraceInformation(System.Reflection.MethodBase.GetCurrentMethod().Name);
string htmlContent = File.ReadAllText(fileName, Encoding.UTF8);
string htmlContent = File.ReadAllText(fileName, new UTF8Encoding(false));

string byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
htmlContent = htmlContent.Replace(byteOrderMarkUtf8, "");

var pageNode = GetPageNode();

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

if(item.StartsWith("<pre"))
{
defaultStyle = item.Substring(0,item.IndexOf("<span"));
defaultStyle = item.Substring(0,item.IndexOf(">") +1);
//Sets language to Latin to disable spell check
defaultStyle = defaultStyle.Insert(defaultStyle.Length - 1, " lang=la");
item = item.Substring(item.IndexOf("<span"));
item = item.Substring(item.IndexOf(">")+1);
}

if (item == "</pre>")
Expand Down
20 changes: 16 additions & 4 deletions NoteHighlightAddin/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,36 @@ private void InsertToClipboard(string outputFileName)

using (FileStream fs = new FileStream(outputFileName, FileMode.Open, FileAccess.Read))
{
using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
using (StreamReader sr = new StreamReader(fs, new UTF8Encoding(false)))
{
//Fix 存到剪貼簿空白不見的問題
while (sr.Peek() >= 0)
{
string line = sr.ReadLine();

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

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

StringBuilder sbLine = new StringBuilder();
int index = 0;

if (IsShowLineNumber)
if (IsShowLineNumber && !line.StartsWith("</pre>"))
{
index = line.IndexOf(span) + span.Length;
sbLine.Append(line.Substring(0, index));
string nrLine = line.Substring(0, index);

int endTextIndex = nrLine.IndexOf(span);
int startTextIndex = nrLine.LastIndexOf(">", endTextIndex) + 1;

nrLine = nrLine.Substring(0, startTextIndex) + nrLine.Substring(startTextIndex, endTextIndex-startTextIndex).Replace(" ", "&nbsp;") + nrLine.Substring(endTextIndex);

sbLine.Append(nrLine);
}

for (int i = index; i < charList.Count; i++)
Expand Down
4 changes: 2 additions & 2 deletions NoteHighlightAddin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.1.*")]
[assembly: AssemblyFileVersion("3.1.*")]
[assembly: AssemblyVersion("3.2.*")]
[assembly: AssemblyFileVersion("3.2.*")]
104 changes: 52 additions & 52 deletions Setup/Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,44 @@
}
"Entry"
{
"MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289"
"MsmKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6"
"OwnerKey" = "8:_UNDEFINED"
"MsmKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
"MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B"
"OwnerKey" = "8:_UNDEFINED"
"MsmKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
"MsmKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
Expand Down Expand Up @@ -106,43 +106,43 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_BF0DDD11259532587F856D651F450ECC"
"OwnerKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4"
"OwnerKey" = "8:_E4014126696E456F7FC66801CBFEEE19"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_E4014126696E456F7FC66801CBFEEE19"
"OwnerKey" = "8:_388259E42C7BBB7AA962BAF39F2213B6"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B"
"OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_805E0317B9E0B1539EEBB800C533393B"
"OwnerKey" = "8:_BF0DDD11259532587F856D651F450ECC"
"MsmSig" = "8:_UNDEFINED"
}
}
Expand Down Expand Up @@ -323,10 +323,21 @@
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289"
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_388259E42C7BBB7AA962BAF39F2213B6"
{
"SourcePath" = "8:NoteHighlightAddin.tlb"
"TargetName" = "8:NoteHighlightAddin.tlb"
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_388259E42C7BBB7AA962BAF39F2213B6"
{
"Name" = "8:Helper.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:Helper.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
"Condition" = "8:"
Expand All @@ -338,15 +349,15 @@
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:2"
"Exclude" = "11:FALSE"
"Register" = "3:1"
"Exclude" = "11:TRUE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289"
{
"SourcePath" = "8:..\\NoteHighlightAddin\\App.config"
"TargetName" = "8:NoteHighlightAddin.dll.config"
"SourcePath" = "8:NoteHighlightAddin.tlb"
"TargetName" = "8:NoteHighlightAddin.tlb"
"Tag" = "8:"
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
"Condition" = "8:"
Expand All @@ -358,26 +369,15 @@
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Register" = "3:2"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:HtmlAgilityPack, Version=1.5.1.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_5F7DADAECA95B8A8EECB662A9FCF5BB5"
{
"Name" = "8:HtmlAgilityPack.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:HtmlAgilityPack.dll"
"TargetName" = "8:"
"SourcePath" = "8:..\\NoteHighlightAddin\\App.config"
"TargetName" = "8:NoteHighlightAddin.dll.config"
"Tag" = "8:"
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
"Condition" = "8:"
Expand All @@ -391,23 +391,23 @@
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_805E0317B9E0B1539EEBB800C533393B"
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5F7DADAECA95B8A8EECB662A9FCF5BB5"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:HtmlAgilityPack, Version=1.5.1.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_805E0317B9E0B1539EEBB800C533393B"
"_5F7DADAECA95B8A8EECB662A9FCF5BB5"
{
"Name" = "8:Helper.dll"
"Name" = "8:HtmlAgilityPack.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:Helper.dll"
"SourcePath" = "8:HtmlAgilityPack.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36"
Expand All @@ -421,7 +421,7 @@
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:TRUE"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
Expand Down Expand Up @@ -640,15 +640,15 @@
{
"Name" = "8:NoteHighlightAddin"
"ProductName" = "8:NoteHighlight2016"
"ProductCode" = "8:{FB571ECB-7A79-4417-BC88-04EADC1CAEE0}"
"PackageCode" = "8:{AFFAB118-BED9-4D10-967A-1D8018F1F910}"
"ProductCode" = "8:{588E3316-4AE0-4C59-8FE7-833D5F1FCE17}"
"PackageCode" = "8:{F72A5156-9BC9-4CFE-8EA6-7B21049E04F7}"
"UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:3.1"
"ProductVersion" = "8:3.2"
"Manufacturer" = "8:CodingRoad"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down
Loading

0 comments on commit f2bb789

Please sign in to comment.